CR8 Token Testnet Deployment Guide
Prerequisites
Before deploying to testnet, you need:
Testnet ETH - Get Sepolia ETH from a faucet:
Private Key - Your wallet's private key (keep this secure!)
Etherscan API Key (optional, for contract verification):
- Get one at https://etherscan.io/apis
Setup
- Create a
.envfile in the project root:
bash
# Network RPC URLs
# Recommended: Use Alchemy or Infura for better reliability
# Get free API keys at:
# - Alchemy: https://www.alchemy.com/
# - Infura: https://www.infura.io/
# Option 1: Alchemy (Recommended)
SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY
# Option 2: Infura
# SEPOLIA_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_PROJECT_ID
# Option 3: Public RPC (less reliable)
# SEPOLIA_RPC_URL=https://ethereum-sepolia-rpc.publicnode.com
# Private Key (NEVER commit this to git!)
PRIVATE_KEY=your_private_key_here_without_0x_prefix
# Etherscan API Key (for contract verification)
ETHERSCAN_API_KEY=your_etherscan_api_key_here- Fill in your values:
PRIVATE_KEY: Your wallet's private key (without 0x prefix)SEPOLIA_RPC_URL: Can use public RPC or your own providerETHERSCAN_API_KEY: Optional, but recommended for verification
Deployment Steps
Step 1: Verify Setup
Check your account balance:
bash
# This will show your deployer address balance
npx hardhat run scripts/deploy.js --network sepolia --dry-runStep 2: Deploy to Sepolia Testnet
bash
npm run deploy:sepoliaThis will deploy:
- CR8Token (upgradeable proxy) - 1.665 billion tokens (15% of max)
- CR8Staking contract
- AgentDeposit contract
Step 3: Verify Contracts (Optional but Recommended)
After deployment, verify on Etherscan:
bash
# Verify CR8Token implementation
npx hardhat verify --network sepolia <IMPLEMENTATION_ADDRESS>
# Verify CR8Staking
npx hardhat verify --network sepolia <STAKING_ADDRESS> <TOKEN_ADDRESS>
# Verify AgentDeposit
npx hardhat verify --network sepolia <AGENT_DEPOSIT_ADDRESS> <TOKEN_ADDRESS> <STAKING_ADDRESS>Step 4: Test the Deployment
Run the simulation script to test the contracts:
bash
npm run simulate:testnetDeployment Costs
Estimated gas costs on Sepolia:
- CR8Token (proxy): ~2-3M gas
- CR8Staking: ~1-2M gas
- AgentDeposit: ~1-2M gas
- Ownership transfer: ~50k gas
Total: ~4-7M gas (varies with network conditions)
Security Reminders
⚠️ IMPORTANT:
- Never commit your
.envfile to git - Never share your private key
- Use a dedicated wallet for testnet deployments
- Verify all contract addresses after deployment
- Keep your deployment addresses safe
Troubleshooting
"Insufficient funds"
- Get more Sepolia ETH from a faucet
"Nonce too high"
- Reset your wallet nonce or wait a bit
"Contract verification failed"
- Check that all constructor arguments are correct
- Make sure the contract code matches exactly
Next Steps After Deployment
- Save deployment addresses from
deployments/sepolia.json - Share contract addresses with your team
- Test all functionality on testnet
- Run simulation script to verify everything works
- Prepare for mainnet deployment after thorough testing