Deploy Smart Contracts to TeQoin L2
Deploy your Solidity smart contracts to TeQoin L2 using your favorite development framework.What You’ll Learn:
- Deploy with Hardhat
- Deploy with Foundry
- Deploy with Remix
- Verify deployment
- Best practices
🎯 Choose Your Tool
Hardhat
Foundry
Remix
🔨 Deploy with Hardhat
Hardhat is the most popular Ethereum development framework.Prerequisites
Step 1: Create New Project
Step 2: Configure for TeQoin
Step 3: Write Your Contract
contracts/MyToken.sol
Step 4: Compile Contract
Step 5: Create Deployment Script
scripts/deploy.js
Step 6: Deploy to TeQoin
- Deploy to Testnet
- Deploy to Mainnet
Step 7: Verify Deployment
⚒️ Deploy with Foundry
Foundry is a blazing fast, modern development framework written in Rust.Prerequisites
Step 1: Create New Project
Step 2: Configure for TeQoin
foundry.toml
Step 3: Write Your Contract
src/MyToken.sol
Step 4: Install Dependencies
Step 5: Compile Contract
Step 6: Create Deployment Script
script/Deploy.s.sol
Step 7: Deploy to TeQoin
- Deploy to Testnet
- Deploy to Mainnet
Foundry Useful Commands
🌐 Deploy with Remix
Remix is a browser-based IDE - no installation required!Step 1: Open Remix
Visit https://remix.ethereum.orgStep 2: Create Contract
Step 3: Compile
Select Compiler
- Click “Solidity Compiler” tab (left sidebar)
- Select compiler version: 0.8.20
- Click “Compile MyToken.sol”
Step 4: Connect Wallet
Step 5: Deploy
Click Deploy
- Click orange “Deploy” button
- MetaMask popup appears
- Review transaction
- Click “Confirm”
💰 Deployment Costs
Estimated Gas Costs
| Contract Type | Gas Used | Estimated Cost (TeQoin L2) |
|---|---|---|
| Simple Storage | ~100,000 | < $0.01 |
| ERC20 Token | ~1,200,000 | ~0.10 |
| ERC721 NFT | ~2,500,000 | ~0.20 |
| Complex DeFi | ~4,000,000 | ~0.40 |
✅ Post-Deployment Checklist
Verify on Explorer
Visit https://explorer.teqoin.io/address/YOUR_ADDRESSVerify:
- ✅ Contract created successfully
- ✅ Transaction shows “Success”
- ✅ Contract code is visible (after verification)
Verify Contract Source
Verify your contract source code on the explorer:Contract Verification Guide →
🔧 Troubleshooting
'Insufficient funds' error
'Insufficient funds' error
You don’t have enough ETH to pay for deployment gas.Solution:
- For testnet: Get ETH from faucet
- For mainnet: Bridge ETH from L1 to L2
- Check balance:
cast balance YOUR_ADDRESS --rpc-url teqoin
'Nonce too high' error
'Nonce too high' error
Your wallet’s nonce is out of sync.Solution:
- Reset MetaMask: Settings → Advanced → Clear activity tab data
- Or wait a few minutes and try again
Contract deployed but not showing on explorer
Contract deployed but not showing on explorer
The explorer indexer might be delayed.Solution:
- Wait 1-2 minutes
- Refresh the explorer page
- Check the transaction hash directly
'Contract creation code storage out of gas'
'Contract creation code storage out of gas'
Your contract is too large (> 24KB limit).Solution:
- Enable optimizer in compiler settings
- Split contract into multiple contracts
- Use libraries to reduce size
Private key not found / Invalid private key
Private key not found / Invalid private key
Environment variable not set correctly.Solution:
📊 Deployment Comparison
| Feature | Hardhat | Foundry | Remix |
|---|---|---|---|
| Setup Time | 5 minutes | 3 minutes | 0 minutes |
| Speed | Medium | Fast | Slow |
| Testing | Excellent | Excellent | Basic |
| Gas Reports | Yes | Yes | No |
| Best For | Teams | Advanced devs | Beginners |
| Language | JavaScript | Rust/Solidity | Browser |
🎯 Next Steps
Verify Your Contract
Verify source code on block explorer
Integrate with Frontend
Connect your contract to a dApp
Write Tests
Test your contract thoroughly
Deploy to Mainnet
After testing, deploy to production
💡 Best Practices
Contract deployed? Now verify it on the block explorer →