Testnet Deployment

Complete guide for deploying 8-Bit Arcade to Arbitrum Sepolia testnet.

📋 Current Testnet Contracts

For the current deployed testnet contract addresses, see: Contract Addresses

This guide is for deploying your own instance or redeploying to testnet.

Prerequisites

1. Deployer Wallet

  • Create a dedicated wallet for deployment (don't use your main wallet)

  • Export the private key (you'll need this for .env)

  • Fund it with Arbitrum Sepolia ETH from: https://faucet.quicknode.com/arbitrum/sepolia

  • Recommended: 0.1-0.2 ETH for all deployments

2. Arbiscan API Key

  • Sign up at: https://arbiscan.io/

  • Get API key from: https://arbiscan.io/myapikey

  • Used for contract verification

3. Environment Setup

Create /contracts/.env file:

⚠️ NEVER commit the .env file to git!

Deployment Steps

Step 1: Install Dependencies

Step 2: Compile Contracts

This should compile all contracts without errors. If you see errors, check:

  • All OpenZeppelin imports are correct (v5 uses utils/ instead of security/)

  • Uniswap V3 dependencies are installed

  • Solidity version 0.8.20 is available

Step 3: Deploy to Testnet

This will deploy:

  • ✅ EightBitToken (8BIT)

  • ✅ GameRewards

  • ✅ TournamentManager

  • ✅ TournamentPayments (ETH/USDC payment handling)

  • ✅ TokenSale

  • ✅ TreasuryGasManager

  • ✅ TestnetFaucet (testnet only)

Save all deployed addresses! You'll need them for the next steps.

Step 4: Verify Contracts on Arbiscan

The deployment script will print verification commands. Run each one:

Step 5: Update Frontend Config

Edit /frontend/src/config/contracts.ts:

Also add the TournamentPayments ABI to the exports.

Step 6: Configure Firebase Functions

Set environment variables for automated tournament creation:

Step 7: Deploy Firebase Functions

This will deploy the automated tournament creation schedulers:

  • createWeeklyTournaments - Runs every Monday at 00:00 UTC

  • createMonthlyTournaments - Runs on 1st of month at 00:00 UTC

Step 8: Contract Configuration

A. Set Rewards Distributor

B. Set Tournament Manager

C. Fund Treasury Gas Manager

D. Configure TournamentPayments

Testing

1. Test Faucet

  • Visit your frontend

  • Connect wallet

  • Claim tokens from faucet

  • Verify you receive 10,000 8BIT

2. Test Games

  • Play each game

  • Submit scores

  • Check leaderboards update correctly

3. Test Tournaments

  • Wait for automated tournament creation (or create manually)

  • Enter tournament

  • Play games

  • Verify scores are tracked

4. Test Payments

  • Approve USDC spending

  • Pay tournament fee with USDC

  • Pay tournament fee with ETH

  • Verify both payment methods work

Automated Tournament Creation

How It Works

Two scheduled Cloud Functions automatically create tournaments:

Weekly Tournaments (createWeeklyTournaments)

  • Runs: Every Monday at 00:00 UTC

  • Creates: 2 tournaments (Standard + High Roller)

  • Duration: 7 days

  • Entry fees: $1 (Standard), $5 (High Roller)

  • Prizes: $25 (Standard), $75 (High Roller)

Monthly Tournaments (createMonthlyTournaments)

  • Runs: 1st day of each month at 00:00 UTC

  • Creates: 2 tournaments (Standard + High Roller)

  • Duration: 30 days

  • Entry fees: $5 (Standard), $25 (High Roller)

  • Prizes: $50 (Standard), $250 (High Roller)

Manual Tournament Creation (for testing)

If you need to create tournaments manually before the scheduled time:

Or call the Firebase function manually:

Monitoring

Contract Events

Monitor on Arbiscan:

  • TournamentCreated - New tournaments created

  • PlayerEntered - Players entering tournaments

  • WinnerDeclared - Tournament winners

  • RewardDistributed - Daily rewards distributed

Firebase Logs

Look for:

  • Tournament creation logs (every Monday and 1st of month)

  • Daily reward distribution logs

  • Score submission logs

Troubleshooting

Deployment Fails

  • "Insufficient funds": Get more testnet ETH from faucet

  • "Nonce too low": Wait a few minutes and retry

  • Compilation errors: Check OpenZeppelin v5 imports

Tournament Creation Fails

  • Check TOURNAMENT_MANAGER_ADDRESS is set correctly in Firebase config

  • Verify deployer wallet has enough ETH for gas

  • Check deployer wallet is set as owner in contract

Frontend Not Connecting

  • Verify USE_TESTNET = true in contracts.ts

  • Check all contract addresses are updated

  • Make sure MetaMask is on Arbitrum Sepolia network

Next Steps

After successful testnet deployment:

  1. Community Testing (3-6 months)

    • Share testnet with community

    • Collect feedback

    • Fix bugs and improve UX

  2. Add Liquidity (when ready for real trading)

    • Create Uniswap V3 pools (8BIT/USDC, WETH/USDC)

    • Add initial liquidity

    • Configure pool addresses in TournamentPayments

  3. Mainnet Deployment

    • Follow same steps but use npm run deploy:mainnet

    • Use real funds and real USDC

    • Set USE_TESTNET = false in frontend config

  4. Token Sale

    • Announce sale start time

    • Enable TokenSale contract

    • Monitor for participants

  5. Launch 🚀

    • Public announcement

    • Marketing campaign

    • First high roller tournament!

Support

If you encounter issues:

  1. Check Firebase logs: firebase functions:log

  2. Check contract events on Arbiscan

  3. Verify all environment variables are set correctly

  4. Review this guide again - most issues are configuration errors


Security Reminders:

  • ✅ Never commit .env files

  • ✅ Use separate wallets for deployment and operations

  • ✅ Test everything thoroughly on testnet first

  • ✅ Get contracts audited before mainnet launch

  • ✅ Monitor contracts regularly after deployment

Last updated