Skip to main content

Anchor Testing Configuration

Localnet vs Devnet

The Anchor.toml configuration file is set to use localnet by default for testing. This means anchor test will spin up a local Solana validator with free SOL instead of trying to deploy to devnet (which requires real SOL funding).

Running Tests

Why Localnet?

Benefits:
  • Free SOL: Local validator provides unlimited test SOL
  • Fast iteration: No network latency or rate limits
  • Isolated testing: Tests don’t interfere with devnet state
  • No funding required: No need to airdrop or fund test wallets
Devnet/Mainnet Deployment:
  • Use the --provider.cluster flag to override the default cluster
  • Ensure your wallet has sufficient SOL for deployment
  • Update program IDs in your code after deployment

Configuration

The Anchor.toml file in packages/gold-betting-demo/anchor/ contains:

Wallet Setup

For production deployments, configure your Solana keypair:
See packages/server/.env.example for SOLANA_DEPLOYER_PRIVATE_KEY configuration.