Testnet Faucet API (offline)
Last updated
curl -X POST https://api.bitbadges.io/testnet/api/v0/faucet \
-H "Content-Type: application/json" \
-d '{"address": "bb1abc123..."}'// Using fetch directly
const response = await fetch('https://api.bitbadges.io/testnet/api/v0/faucet', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ address: 'bb1abc123...' })
});
if (!response.ok) {
const error = await response.json();
console.error('Faucet error:', error);
}import { GenericEvmAdapter, NETWORK_CONFIGS } from 'bitbadges';
// Generate a new bot wallet
const adapter = await GenericEvmAdapter.fromMnemonic(
process.env.BOT_MNEMONIC!,
NETWORK_CONFIGS['testnet'].evmRpcUrl
);
// Fund it (one-time)
await fetch('https://api.bitbadges.io/testnet/api/v0/faucet', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ address: adapter.address })
});
// Wait briefly for tokens to arrive
await new Promise(r => setTimeout(r, 5000));
// Now ready to sign and broadcast transactions