Skip to main content

Faucet API Methods

Faucet endpoint allows requesting funds from the Faucet.

The API provides the following functions and endpoints:

Client lib APIs:

/faucet

Method: POST

POST request asking for funds from the faucet to be transferred to address in the request.

Parameters

Parameteraddress
Required or Optionalrequired
Descriptionaddress to pledge funds to
Typestring
ParameteraccessManaPledgeID
Required or Optionaloptional
Descriptionnode ID to pledge access mana to
Typestring
ParameterconsensusManaPledgeID
Required or Optionaloptional
Descriptionnode ID to pledge consensus mana to
Typestring
ParameterpowTarget
Required or Optionalrequired
Descriptionproof of the PoW being done, only used in HTTP api
Typeuint64
Parameternonce
Required or Optionalrequired
Descriptiontarget Proof of Work difficulty,only used in client lib
Typeuint64

Body

{
"address": "target address",
"accessManaPledgeID": "nodeID",
"consensusManaPledgeID": "nodeID",
"nonce": 50
}

Examples

cURL

curl --location --request POST 'http://localhost:8080/faucet' \
--header 'Content-Type: application/json' \
--data-raw '{
"address": "target address",
"accessManaPledgeID": "nodeID",
"consensusManaPledgeID": "nodeID",
"nonce": 50
}'

Client lib - SendFaucetRequest

SendFaucetRequest(base58EncodedAddr string, powTarget int, pledgeIDs ...string) (*jsonmodels.FaucetResponse, error)
_, err = webConnector.client.SendFaucetRequest(addr.Address().Base58(), powTarget)
if err != nil {
// return error
}

Response examples

{
"id": "4MSkwAPzGwnjCJmTfbpW4z4GRC7HZHZNS33c2JikKXJc"
}

Results

Return fieldTypeDescription
idstringBlock ID of the faucet request. Omitted if error.
errorstringError block. Omitted if success.