🔨 Compile & Deploy: From Code to Blockchain

Turn Solidity into bytecode and broadcast it to the Ethereum network

Previous
Writing Contract

⚙️ Compilation & Deployment

Let's compile your contract into bytecode and deploy it to the Sepolia testnet. Watch the entire process step-by-step!

🎮 Interactive: Deployment Process Simulator

Step through the deployment journey from compilation to live contract

Step 1 of 6
Write Contract
📝
⚙️
🌐
🚀
⛏️
📝
Write Contract
You wrote SimpleStorage.sol
Contract code ready in Remix IDE
Output:
SimpleStorage.sol (7 lines of Solidity)

🔨 What is Compilation?

Compilation translates human-readable Solidity code into machine-readable bytecode that the EVM can execute.

📝
Input: Solidity
contract SimpleStorage {
uint256 public data;
}

Human-readable code you wrote

⚙️
Output: Bytecode
0x608060405234801...

Machine code for EVM execution

📋 Compilation Outputs

Bytecode

The actual code that runs on the EVM. Hexadecimal string starting with 0x.

Example:
0x608060405234801561001057600080fd5b5060405161012c38...
ABI (Application Binary Interface)

JSON description of contract's functions. Tells Web3.js how to interact with your contract.

Example:
[{
  "inputs": [{"type": "uint256"}],
  "name": "set",
  "type": "function"
}]
Metadata

Additional info: compiler version, source code hash, optimization settings.

Compiler: solc v0.8.0
Optimization: 200 runs
EVM Version: London

🚀 How to Deploy in Remix

1️⃣
Compile Contract

Click "Solidity Compiler" tab → Click "Compile SimpleStorage.sol"

✅ Compilation successful
2️⃣
Select Environment

Click "Deploy & Run" tab → Environment: "Injected Provider - MetaMask"

🦊 MetaMask will connect
3️⃣
Choose Network

In MetaMask: Switch to "Sepolia Test Network"

🌐 Network: Sepolia
4️⃣
Deploy

Select "SimpleStorage" → Click orange "Deploy" button

🚀 MetaMask popup: Confirm transaction
5️⃣
Wait for Confirmation

Transaction appears in Remix console. Wait ~15 seconds for block confirmation.

✅ Contract deployed at 0x742d35...

💰 Deployment Cost Breakdown

ComponentGas CostDescription
Base Transaction21,000Cost for any transaction
Contract Creation32,000Base cost for deploying
Code Storage200 per byteStoring bytecode on-chain
Total (Typical)~50,000For SimpleStorage contract
At 20 Gwei gas price:
50,000 gas × 20 Gwei = 0.001 ETH (~$2 on testnet: FREE!)

🔍 What Happens Under the Hood?

1️⃣
MetaMask Signs Transaction: Your private key signs a transaction containing bytecode + gas payment
2️⃣
Broadcast to Network: Transaction sent to Ethereum nodes via JSON-RPC
3️⃣
Mempool Waiting: Transaction sits in mempool until miner includes it
4️⃣
Miner Executes: Miner runs your bytecode, creates contract at new address
5️⃣
Block Confirmation: Transaction included in block, contract address generated (deterministic)
6️⃣
State Updated: Blockchain state updated, contract code stored permanently

🎯 Common Issues & Solutions

❌ "Insufficient funds"
Solution: Get testnet ETH from Sepolia faucet (sepoliafaucet.com)
❌ "Compilation failed"
Solution: Check syntax errors in Remix console. Fix typos, missing semicolons
❌ "Transaction underpriced"
Solution: Increase gas price in MetaMask settings during deployment
❌ "MetaMask not connecting"
Solution: Refresh page, ensure MetaMask is unlocked, check network selection