Solana Mainnet Migration Guide
Overview
This guide documents the migration from binary market to CLOB (Central Limit Order Book) market program on Solana mainnet for Hyperscape’s duel betting system. Migration Commits:dba3e03/35c14f9- Adapt bot + IDLs for CLOB market program on mainnet2c17000- Merge CLOB bot + IDL fixes for mainnet
Program Changes
Mainnet Program IDs
Fight Oracle (unchanged):IDL Updates
All IDL files updated with mainnet program addresses: Files Updated:packages/gold-betting-demo/keeper/src/idl/fight_oracle.jsonpackages/gold-betting-demo/keeper/src/idl/gold_binary_market.json(deprecated)packages/gold-betting-demo/app/src/idl/fight_oracle.jsonpackages/gold-betting-demo/app/src/idl/gold_clob_market.json(new)
Bot Rewrite (Binary → CLOB)
Binary Market Instructions (Removed)
CLOB Market Instructions (New)
Keeper Bot Changes
File:packages/gold-betting-demo/keeper/src/bot.ts
Removed:
- Binary market vault logic
- Seeding/liquidity provision
- Binary outcome resolution
- CLOB config initialization
- Match + order book creation
- CLOB-specific resolution flow
Server Configuration Updates
Arena Config Fallback
File:packages/server/src/arena/config.ts
Keeper Common Fallbacks
File:packages/gold-betting-demo/keeper/src/common.ts
Frontend Configuration
Mainnet Environment File
File:packages/gold-betting-demo/app/.env.mainnet
All VITE_* variables updated for mainnet:
Migration Checklist
Pre-Migration
- Deploy fight oracle program to mainnet
- Deploy CLOB market program to mainnet
- Update all IDL files with mainnet addresses
- Test CLOB instructions on devnet
- Verify keeper bot logic with CLOB flow
Migration Steps
-
Update Program IDs:
-
Rebuild Programs:
-
Update IDLs:
-
Update Environment Files:
-
Deploy Programs:
-
Initialize On-Chain State:
-
Verify:
Post-Migration
- Monitor keeper bot logs for errors
- Verify first match creation succeeds
- Test order book initialization
- Confirm resolution flow works
- Update frontend to point to mainnet
Breaking Changes
Removed APIs
Binary market instructions no longer available:initializeVaultseedMarketplaceBet(replaced by CLOB order placement)resolveBinaryMarket(replaced byresolveMatch)
New APIs
CLOB market instructions:initializeConfig- One-time config setupinitializeMatch- Create new duel matchinitializeOrderBook- Create order book for matchplaceOrder- Place buy/sell ordercancelOrder- Cancel existing orderresolveMatch- Resolve match outcomesettleOrders- Settle matched orders
Testing
Devnet Testing
Mainnet Testing
Rollback Plan
If mainnet migration fails:-
Revert Program IDs:
-
Redeploy Binary Market:
-
Update IDLs:
-
Restart Keeper:
Monitoring
On-Chain Metrics
Monitor these accounts for health:- Config account (global settings)
- Oracle account (fight outcomes)
- Match accounts (per-duel state)
- Order book accounts (CLOB state)
Keeper Bot Logs
Watch for:[Bot] Initialized config- Config created successfully[Bot] Created match- Match creation working[Bot] Initialized order book- Order book ready[Bot] Resolved match- Resolution successful
Error Patterns
Common issues:Account not found- Program not deployed or wrong addressInvalid instruction data- IDL mismatch with deployed programInsufficient funds- Keeper wallet needs SOLTransaction simulation failed- Check program logs
References
- Commit dba3e03: Adapt bot + IDLs for CLOB market program on mainnet
- Commit 35c14f9: Adapt bot + configs for CLOB market program on mainnet
- Commit 2c17000: Merge CLOB bot + IDL fixes for mainnet
- Anchor Docs: https://www.anchor-lang.com/
- Solana Cookbook: https://solanacookbook.com/