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
1
Initialize Project
2
Initialize Hardhat
3
Install Dependencies
Step 2: Configure for TeQoin
1
Create .env File
.env
2
Configure hardhat.config.js
hardhat.config.js
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
1
Create New File
- In the File Explorer, click ”+” to create new file
- Name it
MyToken.sol
2
Write Contract
Step 3: Compile
1
Select Compiler
- Click “Solidity Compiler” tab (left sidebar)
- Select compiler version: 0.8.20
- Click “Compile MyToken.sol”
2
Verify Compilation
✅ Green checkmark appears when compilation succeeds
Step 4: Connect Wallet
1
Open Deploy Tab
Click “Deploy & Run Transactions” tab
2
Select Environment
In “ENVIRONMENT” dropdown, select:
- “Injected Provider - MetaMask”
3
Connect MetaMask
- MetaMask popup appears
- Select account
- Click “Connect”
- Make sure you’re on TeQoin L2 network in MetaMask
Step 5: Deploy
1
Select Contract
In “CONTRACT” dropdown, select MyToken
2
Click Deploy
- Click orange “Deploy” button
- MetaMask popup appears
- Review transaction
- Click “Confirm”
3
Verify Deployment
- Contract appears under “Deployed Contracts”
- You can interact with it directly in Remix
- Copy contract address for use in your dApp
💰 Deployment Costs
Estimated Gas Costs
✅ Post-Deployment Checklist
1
Save Contract Address
2
Verify on Explorer
Visit https://explorer.teqoin.io/address/YOUR_ADDRESSVerify:
- ✅ Contract created successfully
- ✅ Transaction shows “Success”
- ✅ Contract code is visible (after verification)
3
Test Contract Functions
4
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
🎯 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 →