Skip to main content

Testnet and pubnet

Buckspay supports two Stellar networks: Pass the network field in BuckspayConfig. The same field is forwarded to buckspayFacilitator, which sets the FacilitatorChain header - "stellar-testnet" or "stellar-pubnet" (hyphen-separated).

Mainnet opt-in guard

Mainnet is supported and off by default. Without an explicit opt-in, constructing a client on "pubnet" throws BuckspayError("INVALID_CONFIG"). This makes it impossible for a misconfigured or forgotten config to move real funds.
Constructing a createBuckspayClient with network: "pubnet" without opting in throws BuckspayError("INVALID_CONFIG"). Add the opt-in deliberately, not as a drive-by change.
The opt-in is deliberately different in each environment so neither can accidentally inherit the other’s setting:
  • Browser: allowMainnet: true in the BuckspayConfig.
  • Node / server: BUCKSPAY_ALLOW_MAINNET=1 environment variable.

USDC and the asset-agnostic design

Buckspay does not hardcode any USDC address. You pass the Stellar Asset Contract (SAC) address when constructing a transfer call:
This keeps the SDK asset-agnostic - the same client handles any Soroban token. USDC = 7 decimals on Stellar. Circle’s implementation uses seven decimal places, not the six common on EVM chains. Amounts in the SDK are expressed as human-readable strings ("1.50", "0.000001") and converted internally - you do not deal with raw stroops. On pubnet, the USDC SAC is Circle’s official contract address. On testnet, use the Circle testnet USDC SAC.

Dedicated Soroban RPC

createRpcSimContext(rpcUrl) connects the SDK’s simulation engine to a Soroban RPC node. On pubnet, use a dedicated, consistent RPC endpoint rather than the shared public load balancer, which is eventually-consistent and can cause simulation failures when ledger state lags across nodes. For pubnet with a contract account, mainnetSimContext(rpcUrl, { sponsorAddress }) is the correct preset - it sets the funded sponsor G... address as the simSource that the facilitator uses when recording the transaction.

Pubnet example

The example below shows a complete pubnet configuration with the allowMainnet: true opt-in, a dedicated RPC URL, and mainnetSimContext:

Multi-network rail model

A single asset can be offered over multiple rails: the payer chooses which network to settle on. The FacilitatorChain value ("stellar-testnet" | "stellar-pubnet") in the relay payload tells the facilitator which network to submit to. The SDK resolves the rail from the client’s network field - no extra wiring needed.

Next

Facilitator and BFF

How to configure the relayer and keep the API key server-side.

Account models

Classic and passkey accounts - both work on testnet and pubnet.