2.7 KiB
2.7 KiB
🚀 Deployment Guide - BetFun Arena
Prerequisites
-
Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -
Install Solana CLI
sh -c "$(curl -sSfL https://release.solana.com/stable/install)" -
Install Anchor
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force avm install latest avm use latest
Step 1: Build the Anchor Program
cd packages/anchor
anchor build
This will:
- Compile the Rust program
- Generate the IDL file at
target/idl/betfun.json - Create the deployable
.sofile
Step 2: Copy IDL to SDK
# From project root
mkdir -p packages/sdk/src/idl
cp packages/anchor/target/idl/betfun.json packages/sdk/src/idl/betfun.json
Step 3: Update SDK to Use Real IDL
Update packages/sdk/src/index.ts:
import idl from './idl/betfun.json';
// Replace getMinimalIDL() with:
const program = new Program(idl as any, PROGRAM_ID, provider);
Step 4: Deploy to Devnet
cd packages/anchor
# Ensure you have devnet SOL
solana config set --url devnet
solana airdrop 2
# Deploy
anchor deploy --provider.cluster devnet
After deployment, note the program ID and update:
NEXT_PUBLIC_PROGRAM_IDenvironment variablepackages/sdk/src/index.tsPROGRAM_ID
Step 5: Deploy to Mainnet
cd packages/anchor
# Switch to mainnet
solana config set --url mainnet
# Ensure you have sufficient SOL for deployment
# (Deployment costs ~2-3 SOL)
# Deploy
anchor deploy --provider.cluster mainnet
Step 6: Update Environment Variables
After deployment, update all environment variables:
# .env.local (for frontend)
NEXT_PUBLIC_PROGRAM_ID=<your_deployed_program_id>
# .env (for backend services)
PROGRAM_ID=<your_deployed_program_id>
Step 7: Verify Deployment
-
Check program on Solana Explorer:
https://explorer.solana.com/address/<PROGRAM_ID> -
Test arena creation in the app
-
Verify transactions on Solana Explorer
Current Status
✅ SDK Updated: Now uses Anchor Program interface to build real instructions
✅ Transaction Building: Properly constructs create_arena instructions
⚠️ IDL Required: Need to build Anchor program to generate IDL
⚠️ Program Deployment: Program needs to be deployed before use
Next Steps
- Build the Anchor program (
anchor build) - Copy the IDL to the SDK
- Deploy to devnet for testing
- Update environment variables
- Test arena creation
- Deploy to mainnet when ready
Note: The SDK currently uses a minimal IDL structure. Once the program is built, replace it with the actual IDL for full functionality.