Skip to main content
Version: 2.15.0

faucet

function faucet(
pub: PublicKey,
network?: string,
headers?: HeadersInit): Promise<void>;

Defined in: lib/mina/v1/mina.ts:568

Requests the testnet faucet to fund a public key.

Solves a ZK captcha challenge (sum-to-100 proof) before submitting the funding request. The first call compiles the ZK circuit (~30-60s), subsequent calls reuse the cached circuit.

Parameters

pub

PublicKey

The public key to fund.

network?

string = 'devnet'

The network to fund on: devnet (default) or mesa.

headers?

HeadersInit

Optional headers passed to fetchAccount when polling for funding confirmation.

Returns

Promise<void>

Throws

rate-limit — The address has already been funded on this network (one funding per address).

Throws

rate-limit-ip — Too many faucet requests from this IP (max 5/hour, 10/day).

Throws

forbidden — The faucet rejected the request origin.

Throws

challenge-required — The ZK challenge proof was invalid or expired.

Example

// Fund on Devnet (default)
await Mina.faucet(myPublicKey);

// Fund on Mesa
await Mina.faucet(myPublicKey, 'mesa');