Fund account from faucet

You might have noticed that in our Testnet Fast Walletarrow-up-right, you have a default balance and even before performing a transaction yourself, your account had already benefited from 6 default token transfer transactions.

In addition, you can always add money to your account "from thin air" whenever you press plus + on the button corresponding to the desired token. This corresponds to funding your account from the faucet and in this tutorial we describe how it works.

Fund a single-signer account from faucet

The faucet mechanism is attached to a proxy. The proxy controls an account with a large amount of funds and users can then call a special endpoint on the proxy that will distribute those funds for free.

Using the faucet is straightforward. The code below transfers 10 native tokens from the faucet proxy to the account account, provided the proxy has a faucet enabled and it has enough funds.

  use jsonrpsee::http_client::HttpClient;
  use fast_rust_examples::{fastset_types::*, client::ProxyRpcClient};

  let (sender_pub_key, _sender_priv_key) = get_key_pair();

  let client = HttpClient::builder().build("https://proxy.fastset.xyz")?;
  client.faucet_drip(sender_pub_key, 10.into(), None).await?;

sourcearrow-up-right

Note that there are per-account limitations on the proxy. There is a cool-down for calling the endpoint (often 1 day), and there is a limit for how much you can request in one call.

It is also possible to use the faucet to obtain custom tokens, if the faucet is set up correctly to disperse them. For example:

  use jsonrpsee::http_client::HttpClient;
  use fast_rust_examples::{fastset_types::*, client::ProxyRpcClient};

  let (sender_pub_key, _sender_priv_key) = get_key_pair();

  let client = HttpClient::builder().build("https://proxy.fastset.xyz")?;
  let my_token_id = TokenId::native(); // can replace this with your custom token ID
  client.faucet_drip(sender_pub_key, 10.into(), Some(my_token_id.clone())).await?;

sourcearrow-up-right

Fund a multisig account from faucet

The code below demonstrates how to compute the address of a multisig account and send initial funds to it.

sourcearrow-up-right