Skip to content

Faucet (testnet only)

Mint test tokens to your EOA on Arc testnet. This is a testnet-only flow required to receive the testnet supported token.

use alloy_primitives::U256;
use alloy_provider::network::{EthereumWallet, TxSigner};
use alloy_provider::ProviderBuilder;
use alloy_signer_local::LocalSigner;
use std::str::FromStr;
use trident_sdk::{envs, TridentClient};
#[tokio::main]
async fn main() {
println!("==== Trident faucet walkthrough ====");
// Example config: adjust chain, rpc, token, and private key as needed.
let chain_name = "arc-testnet";
let rpc = "https://rpc.testnet.arc.network";
let token = envs::testnet::arc_testnet::TEST_TOKEN;
let private_key = "0xYOUR_TEST_PRIVATE_KEY";
let amount = U256::from(10u64).pow(U256::from(18u64));
println!("1) Prepare signer, attester client, and deployment metadata");
let signer = LocalSigner::from_str(private_key).expect("valid private key");
let mut client = TridentClient::connect_testnet()
.await
.expect("attester connect");
let deployment = client
.get_deployment_by_name(chain_name)
.unwrap_or_else(|| panic!("deployment '{}' not found", chain_name))
.clone();
let chain_id = deployment.chain_id;
println!("2) Bind a provider to the signer for faucet + balance calls");
let provider = ProviderBuilder::new()
.wallet(EthereumWallet::from(signer.clone()))
.connect_http(rpc.parse().expect("rpc"));
let recipient = TxSigner::address(&signer);
let balance_before = client
.evm_balance(chain_id, recipient, token)
.await
.expect("balance before");
println!(
" - Starting balance for {} on {}: {}",
recipient, deployment.chain_name, balance_before
);
println!("3) Request tokens from faucet");
let faucet_receipt = client
.evm_faucet(&provider, token, recipient, amount)
.await
.expect("faucet mint");
println!(
" - Faucet tx included in block {:?}",
faucet_receipt.block_number
);
let balance_after = client
.evm_balance(chain_id, recipient, token)
.await
.expect("balance after");
println!(
"4) New balance confirmed. {} => {} (delta: {})",
balance_before,
balance_after,
balance_after.saturating_sub(balance_before)
);
println!("Done. Use this funded account in other flows (deposit, spend, etc.).");
}
let chain_name = "arc-testnet";
let rpc = "https://rpc.testnet.arc.network";
let token = envs::testnet::arc_testnet::TEST_TOKEN;
let private_key = "0xYOUR_TEST_PRIVATE_KEY";
let amount = U256::from(10u64).pow(U256::from(18u64));

Pick the testnet deployment, RPC endpoint, token address, private key, and mint amount the faucet should issue.

let signer = LocalSigner::from_str(private_key).expect("valid private key");
let mut client = TridentClient::connect_testnet()
.await
.expect("attester connect");
let deployment = client
.get_deployment_by_name(chain_name)
.unwrap_or_else(|| panic!("deployment '{}' not found", chain_name))
.clone();
let chain_id = deployment.chain_id;

Load the signer, connect to the testnet attester, and resolve deployment metadata (including chain_id) required for faucet and balance calls.

let provider = ProviderBuilder::new()
.wallet(EthereumWallet::from(signer.clone()))
.connect_http(rpc.parse().expect("rpc"));

Attach the signer to an HTTP provider so the faucet transaction and balance reads both target the selected RPC endpoint.

let balance_before = client
.evm_balance(chain_id, recipient, token)
.await
.expect("balance before");
let faucet_receipt = client
.evm_faucet(&provider, token, recipient, amount)
.await
.expect("faucet mint");
let balance_after = client
.evm_balance(chain_id, recipient, token)
.await
.expect("balance after");

Request the mint, capture the receipt (with block number), and compare balances before and after to confirm the faucet succeeded.