Skip to content

How to obtain tokens from the faucet

Luca Moser edited this page Jun 24, 2020 · 5 revisions

The faucet dApp

The faucet is a dApp built on top of the value- and communication layer. It sends IOTA tokens to addresses by listening to faucet request messages. A faucet message is a Message containing an address encoded in Base58, and it is retrievable via FindMessageByID(). After sending a faucet request message, you can check your balances via GetUnspentOutputs().

Obtain tokens from the faucet

There are 3 ways to send a faucet request message to obtain IOTA tokens:

  1. Via the Go client library
  2. Via the HTTP API directly
  3. Requesting tokens via the GoShimmer web dashboard

Via the Go client library

Follow the instructions in Use the API to set up the API instance.

Example:

// provide your Base58 encoded destination address
messageID, err := goshimAPI.SendFaucetRequest("JaMauTaTSVBNc13edCCvBK9fZxZ1KKW5fXegT1B7N9jY")

---- or

// get the given address from your wallet instance and 
// use String() to get its Base58 representation
addr := wallet.Seed().Address(0)
messageID, err := goshimAPI.SendFaucetRequest(addr.String())

Via the HTTP API directly

The URI for POSTing faucet request messages is http://<host>:<web-api-port>/faucet

Parameter Required Description Type
address Yes Destination address to which to send tokens to encoded in Base58 string

cURL example:

curl http://localhost:8080 \
-X POST \
-H 'Content-Type: application/json' \
-d '{
  "address": "JaMauTaTSVBNc13edCCvBK9fZxZ1KKW5fXegT1B7N9jY"
}'

Requesting tokens via the GoShimmer web dashboard

You can send the faucet request message via the faucet tab on the dashboard by filling in a Base58 encoded address to receive tokens.

You can then use the link provided below to check the funds on your supplied address.

faucet on dashboard