Anchor Testing Configuration
Localnet vs Devnet
TheAnchor.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
- Use the
--provider.clusterflag to override the default cluster - Ensure your wallet has sufficient SOL for deployment
- Update program IDs in your code after deployment
Configuration
TheAnchor.toml file in packages/gold-betting-demo/anchor/ contains:
Wallet Setup
For production deployments, configure your Solana keypair:packages/server/.env.example for SOLANA_DEPLOYER_PRIVATE_KEY configuration.