Ethereum Explained — Beginner's Guide
Ethereum is a decentralized global computer that runs smart contracts — self-executing programs that run exactly as programmed without any possibility of downtime, censorship, fraud, or third-party interference.
What You’ll Learn
By the end of this tutorial, you’ll understand what makes Ethereum different from Bitcoin, how the Ethereum Virtual Machine (EVM) works, what gas fees are, what decentralized applications (dApps) look like, and you’ll write a simple smart contract.
Why Ethereum Matters
Ethereum, launched in 2015 by Vitalik Buterin, extended blockchain technology from a simple ledger (Bitcoin) to a programmable blockchain. This innovation enabled decentralized finance (DeFi), non-fungible tokens (NFTs), decentralized autonomous organizations (DAOs), and thousands of other applications.
Ethereum Learning Path
flowchart LR
A[Blockchain Basics] --> B[Bitcoin]
B --> C[Ethereum]
C --> D[Smart Contracts]
C --> E{You Are Here}
style E fill:#f90,color:#fff
What Is Ethereum? (The “Why” First)
Think of Bitcoin as a calculator — it does one thing (transfer value) very well. Ethereum is like a smartphone — it can run any application you can imagine, all on a decentralized global network.
Bitcoin’s blockchain only tracks balances and transactions. Ethereum’s blockchain tracks state — the current status of thousands of smart contracts, each with their own data and logic. This makes Ethereum a “world computer” that anyone can use without permission.
Ethereum vs Bitcoin
| Feature | Bitcoin | Ethereum |
|---|---|---|
| Purpose | Digital currency | Programmable blockchain |
| Programming | Limited (Script) | Turing-complete (Solidity) |
| Block time | ~10 minutes | ~12 seconds |
| Consensus | Proof of Work | Proof of Stake (since 2022) |
| Supply | Capped at 21M | No fixed cap (but burned) |
| Account model | UTXO | Account-based |
| Creator | Satoshi Nakamoto | Vitalik Buterin |
The Ethereum Virtual Machine (EVM)
The EVM is the runtime environment for smart contracts on Ethereum. Think of it as a global, decentralized computer that:
- Runs the same code everywhere (deterministic)
- Every node executes every transaction
- Results are verified by consensus
- No single point of failure
flowchart TD
A[Smart Contract<br/>Written in Solidity] --> B[Compiled to<br/>Bytecode]
B --> C[Deployed to<br/>Ethereum Network]
C --> D[EVM on Node 1]
C --> E[EVM on Node 2]
C --> F[EVM on Node 3]
C --> G[EVM on Node N]
D --> H[All nodes execute<br/>same code, same result]
E --> H
F --> H
G --> H
Every node in the Ethereum network runs an EVM instance. When a transaction is processed, every node executes the same smart contract code and must reach the same result. This is how the network achieves consensus without trust.
Gas — The Fuel of Ethereum
Gas is the unit that measures the computational effort required to execute operations on Ethereum. Think of gas like gasoline for your car — every operation costs a certain amount of gas, and you pay for the total gas used.
Why Gas Exists
Gas prevents infinite loops and wasteful computations. Without gas, a malicious contract could run forever, and every node would be forced to run it too. Gas ensures that:
- Developers optimize their code (expensive code costs more)
- The network stays responsive (no runaway computations)
- Resources are fairly allocated (pay for what you use)
Gas Calculation
# gas_calculation.py
def estimate_gas(operation):
"""Simplified Ethereum gas costs."""
gas_costs = {
"simple_transfer": 21000, # Base cost for sending ETH
"contract_deployment": 53000, # Plus variable cost per byte
"storage_write": 20000, # Writing to blockchain storage
"storage_read": 2900, # Reading from storage (warm)
"addition": 3, # Arithmetic operation
"multiplication": 5, # Arithmetic operation
"keccak256_hash": 30, # Hashing operation
"sload": 2100, # Loading from storage (cold)
"sstore": 20000, # Storing to storage (set to non-zero)
}
return gas_costs.get(operation, "Unknown operation")
# Simulate a transaction cost
print("=== Ethereum Gas Estimation ===")
print(f"Simple ETH transfer: {estimate_gas('simple_transfer'):,} gas")
print(f"Contract deployment: {estimate_gas('contract_deployment'):,}+ gas")
print(f"Storage write: {estimate_gas('storage_write'):,} gas")
print(f"Arithmetic: {estimate_gas('addition')} gas")
# Calculate total cost in ETH
gas_used = 21000 + 20000 + 3 # transfer + storage + math
gas_price_gwei = 25 # 25 Gwei (1 Gwei = 10^-9 ETH)
total_cost_eth = gas_used * gas_price_gwei / 1_000_000_000
print(f"\nTotal gas used: {gas_used:,}")
print(f"Gas price: {gas_price_gwei} Gwei")
print(f"Total cost: {total_cost_eth:.6f} ETH")Expected output:
=== Ethereum Gas Estimation ===
Simple ETH transfer: 21,000 gas
Contract deployment: 53,000+ gas
Storage write: 20,000 gas
Arithmetic: 3 gas
Total gas used: 41,003
Gas price: 25 Gwei
Total cost: 0.001025 ETHGas Price and Priority Fee
In Ethereum’s current system (EIP-1559):
- Base fee: Burned (destroyed), fluctuates based on network demand
- Priority fee (tip): Goes to validators, incentivizes them to include your transaction
def calculate_transaction_cost(gas_units, base_fee_gwei, priority_fee_gwei):
base_cost = gas_units * base_fee_gwei / 1e9
tip_cost = gas_units * priority_fee_gwei / 1e9
total = base_cost + tip_cost
print(f"Base fee ({base_fee_gwei} Gwei): {base_cost:.6f} ETH (burned)")
print(f"Priority fee ({priority_fee_gwei} Gwei): {tip_cost:.6f} ETH (validator tip)")
print(f"Total cost: {total:.6f} ETH")
return total
calculate_transaction_cost(21000, 50, 5)Expected output:
Base fee (50 Gwei): 0.001050 ETH (burned)
Priority fee (5 Gwei): 0.000105 ETH (validator tip)
Total cost: 0.001155 ETHSmart Contracts on Ethereum
A smart contract is a program stored on the Ethereum blockchain that runs when predetermined conditions are met. Think of it like a vending machine — you put in coins (ETH), press a button (call a function), and the machine (contract) dispenses a product (executes code).
Simple Smart Contract Example (Solidity)
// SimpleStorage.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract SimpleStorage {
// State variable — stored on the blockchain
uint256 private storedNumber;
// Event — emitted when data changes
event NumberChanged(uint256 newNumber, address changedBy);
// Store a number
function store(uint256 _number) public {
storedNumber = _number;
emit NumberChanged(_number, msg.sender);
}
// Retrieve the stored number
function retrieve() public view returns (uint256) {
return storedNumber;
}
}Line-by-line explanation:
pragma solidity ^0.8.19— tells the compiler which version to usecontract SimpleStorage— defines the contract (like a class in OOP)uint256 private storedNumber— a variable stored permanently on the blockchainevent NumberChanged(...)— logs that the number changed (frontends can listen for this)function store(uint256 _number) public— anyone can call this to update the numberfunction retrieve() public view returns (uint256)— reads the number without modifying statemsg.sender— the address that called this function (likethisin other languages)
Why this matters: This simple contract demonstrates core concepts — state storage, function calls, events, and the msg object. Real contracts build on these basics to implement tokens, exchanges, lending protocols, and more.
Decentralized Applications (dApps)
A dApp is an application that runs on a decentralized network (like Ethereum) rather than centralized servers. Think of it as a regular app with a blockchain backend.
dApp Architecture
Traditional App:
┌────────┐ ┌──────────┐ ┌──────────┐
│Browser │────▶│Backend │────▶│Database │
│(React) │ │(Node.js) │ │(Postgres)│
└────────┘ └──────────┘ └──────────┘
All controlled by one company
Decentralized App:
┌────────┐ ┌──────────┐ ┌──────────┐
│Browser │────▶│Smart │ │ │
│(Web3) │ │Contract │ │ Ethereum │
│ │ │(on EVM) │────▶│ Blockchain│
│Wallet │ │ │ │ │
└────────┘ └──────────┘ └──────────┘
No central server neededHow Users Interact with dApps
- User installs a wallet (like MetaMask)
- User visits the dApp website
- The dApp connects to the user’s wallet
- When the user performs an action, the wallet prompts them to sign a transaction
- The transaction is broadcast to Ethereum
- The smart contract executes, and the state changes
Real-World dApp Example — A Simple Token Swap
// Example: Interacting with a smart contract from JavaScript
// Requires: web3.js library
const Web3 = require("web3");
// Connect to Ethereum (via Infura or local node)
const web3 = new Web3("https://mainnet.infura.io/v3/YOUR_PROJECT_ID");
// ABI (Application Binary Interface) — describes the contract's functions
const contractABI = [
{
"inputs": [{"name": "_to", "type": "address"}, {"name": "_amount", "type": "uint256"}],
"name": "transfer",
"outputs": [{"name": "", "type": "bool"}],
"stateMutability": "nonpayable",
"type": "function"
}
];
// Contract address on Ethereum
const contractAddress = "0x1234567890abcdef...";
// Create contract instance
const tokenContract = new web3.eth.Contract(contractABI, contractAddress);
// Check balance (read — no gas needed)
async function checkBalance(address) {
const balance = await tokenContract.methods.balanceOf(address).call();
console.log(`Balance: ${web3.utils.fromWei(balance, "ether")} tokens`);
}
// Transfer tokens (write — requires gas)
async function transferTokens(from, to, amount) {
const tx = await tokenContract.methods.transfer(to, amount).send({
from: from,
gas: 50000,
gasPrice: 25000000000 // 25 Gwei in Wei
});
console.log(`Transaction hash: ${tx.transactionHash}`);
}Common Ethereum Mistakes
1. Sending ETH to a Contract Without Enough Gas
If you send ETH to a contract but don’t provide enough gas for the contract to execute its logic, the ETH is sent but the contract logic fails. The ETH may be lost.
2. Not Understanding Gas Price Spikes
During NFT mints or DeFi activity, gas prices can spike 10x or more. Always check current gas prices before sending transactions. Use gas tracking sites like etherscan.io/gastracker.
3. Interacting with Unverified Contracts
Anyone can deploy a contract on Ethereum. Always verify the contract source code on Etherscan before interacting with it. Scammers deploy fake contracts that steal your funds.
4. Forgetting the Blockchain Is Public
Everything on Ethereum is public — every transaction, every contract, every storage variable. Private data should never be stored on-chain without encryption.
5. Reusing Nonces
Each address has a transaction nonce (counter). If you send two transactions with the same nonce, one will fail. Some wallet errors during high congestion cause nonce management issues.
6. Not Testing on Testnets First
Always test contracts on Ethereum testnets (Sepolia, Goerli) before deploying to mainnet. Testnet ETH is free and errors don’t cost real money.
7. Ignoring MEV (Maximal Extractable Value)
Miners/validators can reorder transactions within a block to extract value. This can cause your transaction to fail or cost more than expected. Slippage protection helps mitigate this.
Common Mistakes Beginners Make
1. Skipping the Fundamentals
Many beginners jump straight to advanced topics without mastering the basics. Take time to understand the core concepts before moving on.
2. Not Practicing Enough
Reading tutorials without writing code leads to shallow understanding. Code along with every example and experiment on your own.
3. Ignoring Error Messages
Error messages tell you exactly what went wrong. Read them carefully — they usually point to the line and type of issue.
4. Copy-Pasting Without Understanding
It’s tempting to copy code from tutorials, but typing it yourself and understanding each line builds real skill.
5. Giving Up Too Early
Every developer hits frustrating bugs. Take breaks, ask for help, and remember that struggling is part of learning.
Practice Questions
1. What’s the main difference between Bitcoin and Ethereum?
Bitcoin is primarily a digital currency with limited scripting. Ethereum is a programmable blockchain that runs smart contracts — full applications on-chain.
2. What is gas and why does it exist?
Gas measures computational effort on Ethereum. It prevents infinite loops, compensates validators, and allocates block space fairly. Every operation has a gas cost.
3. What does the Ethereum Virtual Machine do?
The EVM executes smart contract bytecode across all network nodes. It ensures deterministic execution — every node computes the same result for the same input.
4. What’s the difference between a read and a write transaction on Ethereum?
Read transactions (view/pure functions) are free — they query state without changing it. Write transactions cost gas because they modify the blockchain state.
5. Challenge: Write a Solidity function that returns the sum of two numbers.
function add(uint256 a, uint256 b) public pure returns (uint256) {
return a + b;
}The pure keyword means this function doesn’t read or write contract state — it only uses its parameters.
Real-World Task: Explore Ethereum with Etherscan
- Go to etherscan.io
- Look up the latest block
- Find a transaction and examine:
- Transaction hash and block number
- From and To addresses
- Value transferred (ETH)
- Gas used vs gas limit
- Gas price and transaction fee
- Look at a smart contract (search for USDC or another popular token)
- Find the “Contract” tab and read the source code
- Check the “Events” tab to see what the contract has logged
FAQ
Try It Yourself
Install MetaMask (browser wallet) and interact with a testnet:
- Install MetaMask extension for Chrome/Firefox
- Switch to Sepolia testnet
- Get free test ETH from a faucet (https://sepoliafaucet.com)
- Visit a testnet dApp like Uniswap (testnet version)
- Try swapping test ETH for test tokens
- Check your transaction on etherscan.io (Sepolia version)
This costs nothing and lets you experience Ethereum firsthand. The same principles apply to mainnet — just with real value at stake.
What’s Next
What’s Next
Congratulations on completing this Ethereum tutorial! Here’s where to go from here:
- Practice daily — Consistency is more important than long study sessions
- Build a project — Apply what you learned by building something real
- Explore related topics — Check out other tutorials in the same category
- Join the community — Discuss with other learners and share your progress
Remember: every expert was once a beginner. Keep coding!
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro