Production deployment of Eco Routes Protocol to mainnet chains
Production Deployment: Mainnet deployment involves real assets and irreversible transactions. Follow this guide carefully and ensure thorough testing on testnets before proceeding.
Never commit mainnet .env files to version control. Use .gitignore to exclude .env files.
Create a production .env file:
.env.production
# CRITICAL: Use hardware wallet or secure key managementPRIVATE_KEY=your_secure_mainnet_private_key# Alchemy API key for reliable RPC accessALCHEMY_API_KEY=your_production_alchemy_api_key# Chain configurationCHAIN_DATA_URL="https://raw.githubusercontent.com/eco/eco-chains/refs/heads/main/src/assets/chain.json"# Deployment outputDEPLOY_FILE="out/deploy-mainnet.csv"# IMPORTANT: Use the same SALT as testnet for consistent addressesSALT=0x88f72b566ae0c96f6fffac4bc8ac74909f61512ac0c06a8124d5ed420d306f90# Portal configuration# Leave empty to deploy new Portal, or set existing Portal addressPORTAL_CONTRACT=# Ethereum Mainnet Bridge ContractsMAILBOX_CONTRACT=0xYourHyperlaneMailboxAddressROUTER_CONTRACT=0xYourMetalayerRouterAddressLAYERZERO_ENDPOINT=0xYourLayerZeroEndpointAddressLAYERZERO_DELEGATE=0xYourDelegateAddress # Optional, defaults to deployerPOLYMER_CROSS_L2_PROVER_V2=0xYourPolymerProverAddress# Cross-VM prover addresses for non-EVM chainsHYPER_CROSS_VM_PROVERS=0xSolanaHyperProverAddress,0xCosmosHyperProverAddressMETA_CROSS_VM_PROVERS=0xSolanaMetaProverAddressLAYERZERO_CROSS_VM_PROVERS=0xSolanaLZProverAddressPOLYMER_CROSS_VM_PROVERS=0xSolanaPolymerProverAddress# Multi-chain deploymentRESULTS_FILE=deployments/mainnet-results.jsonAPPEND_RESULTS=false# Contract verificationVERIFICATION_KEYS_FILE=verification-keys-mainnet.json
# Deploy to all chains with explicit configurationCHAIN_DATA_URL="./chain-data-mainnet.json" \RESULTS_FILE="deployments/mainnet-results.json" \SALT=0x88f72b566ae0c96f6fffac4bc8ac74909f61512ac0c06a8124d5ed420d306f90 \PRIVATE_KEY=$PRIVATE_KEY \ALCHEMY_API_KEY=$ALCHEMY_API_KEY \./scripts/deployRoutes.sh
For cross-chain deployment including non-EVM chains:
# Set cross-VM prover addressesexport HYPER_CROSS_VM_PROVERS="0x1234...solana,0x5678...cosmos"export LAYERZERO_CROSS_VM_PROVERS="0x9abc...solana"# Deploy with cross-VM support./scripts/deployRoutes.sh
Cross-VM prover addresses must be in bytes32 format:
# Example: Convert Solana address to bytes32# Solana addresses are 32 bytes, can be used directlyCROSS_VM_PROVERS="0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
Critical: Verify that Portal addresses match across all chains. This is essential for cross-chain operations.
# Check Portal address on Ethereumcast code 0x742d35Cc6634C0532925a3b844Bc454e4438f44e \ --rpc-url https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY# Verify same address on Basecast code 0x742d35Cc6634C0532925a3b844Bc454e4438f44e \ --rpc-url https://base-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY# Addresses should match if using same SALT
Monitor gas prices during deployment. Mainnet gas costs can be significant.
# Check current gas pricecast gas-price --rpc-url https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY# Set maximum gas price (30 gwei example)forge script scripts/Deploy.s.sol \ --broadcast \ --rpc-url $MAINNET_RPC_URL \ --with-gas-price 30000000000