Faucet (Technical)

Obtain tokens from the Faucet

If we run a testnet node we would use a faucet or token fountain, usually found in testnet nodes.

Every script node has a faucet service that would kindly transfer you funds on request. No questions. The objective of testnet is to give users the opportunity to test the system with ‘play money’

However if we run a mainnet node we would use an exchange and buy tokens instead.

Before asking the faucet let’s use an address we control.

If you wanted to fund this-node address, your node, such address can be obtained in the following way:

        stv:~$ scriptcli query status
                {
                    "address": "0x8d1F3236d790415d631d554091dE7A25913FB561",                       <=== address
                    "chain_id": "testnet",
                    "current_epoch": "1019",
                    "current_hash": "0x44d71c52e6ddc4a905dc1901e7cc1a5b9bceed11ab4ea4cd023bb3b82b8d9147",
                    "current_height": "1017",
                    "current_time": "1721812158",
                    "genesis_block_hash": "0x42a81f3f7ef0a5297997c8428ae945d5176f07082224b006f1979a5ebbe2744c",
                    "latest_finalized_block_epoch": "1017",
                    "latest_finalized_block_hash": "0x270bdf99bea4a90554ef13138721d33a4302f9c55925e0a14f8ca2ef8bda3359",
                    "latest_finalized_block_height": "1017",
                    "latest_finalized_block_time": "1721812142",
                    "peer_id": "0x8d1F3236d790415d631d554091dE7A25913FB561",
                    "snapshot_block_hash": "0x42a81f3f7ef0a5297997c8428ae945d5176f07082224b006f1979a5ebbe2744c",
                    "snapshot_block_height": "0",
                    "syncing": false,
                    "tip_hash": "0xc7134d79a766cef0bcd32f267c0662fa6cafb7e4a22c73620ad5baeff1238ff3"
                }

Our address can be found on the response, 0x8d1F3236d790415d631d554091dE7A25913FB561.

Let’s then invoke stvtool to obtain funds for this aforementioned address, we do it with the command query_faucet, passing the recipient address as argument:

        stv:~$ bin/stvtool query_faucet 0x8d1F3236d790415d631d554091dE7A25913FB561

The command can be repeated as many times as wished up to a balance limit of 1M. We can easy earn tokens this way.

By feeding with tokens your node address your faucet is automatically enabled using it as source of funds and making the faucet service available to other participants in the script network.

After a few seconds from ordering the transfer we can check our balance:

        stv:~$ scriptcli query account --address=0x8d1F3236d790415d631d554091dE7A25913FB561
                {
                    "code": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
                    "coins": {
                        "scptwei": "12000000000000000000000",
                        "spaywei": "1200000000000000000000"
                    },
                    "last_updated_block_height": "1180",
                    "reserved_funds": [],
                    "root": "0x0000000000000000000000000000000000000000000000000000000000000000",
                    "sequence": "0"
                }

Which effectively shows the expected amounts given to us by the remote faucet.

Removing 18 trailing zeroes we obtain our balance of tokens (provided you called the faucet 12 times)

    SCPT token: 12000;  SPAY token:1200

The command will use by default the Script Network reference Node at https://backend-wallet-testnet.script.tv

Other nodes offer the same service on URsL:

    * Human: https://wallet-testnet.<your-domain>
            * API: https://backend-wallet-testnet.<your-domain>

Last updated