Understanding Ethereum is essential for anyone entering the world of decentralized applications (dApps), smart contracts, or blockchain development. This guide breaks down core concepts—from accounts and transactions to contract deployment and storage—offering clear, actionable insights for developers and enthusiasts alike.
Whether you're preparing for blockchain challenges or building your first dApp, this resource covers the foundational knowledge needed to interact effectively with the Ethereum network.
Core Ethereum Concepts
Ethereum operates as a decentralized, global computer powered by a vast network of nodes. At its core, it enables the creation and execution of smart contracts—self-executing agreements written in code. To navigate this ecosystem, it's crucial to understand key components like accounts, transactions, and how data is stored and accessed.
Key Components of the Ethereum Ecosystem
To get started, developers typically use a set of essential tools:
- Remix: An integrated development environment (IDE) for writing, compiling, and deploying smart contracts directly from the browser.
- MetaMask: A widely used cryptocurrency wallet that allows users to manage Ethereum accounts and interact with dApps.
- Etherscan: A blockchain explorer for viewing transaction details, contract code, and account balances.
- Geth (Go Ethereum): A command-line interface for running an Ethereum node and interacting with the network via RPC calls.
These tools form the foundation for developing, testing, and deploying on Ethereum.
Ethereum Accounts: EOA vs Contract Accounts
Ethereum distinguishes between two types of accounts: Externally Owned Accounts (EOAs) and Contract Accounts.
Externally Owned Accounts (EOAs)
EOAs are controlled by private keys and typically represent users. They can:
- Hold ETH (Ether)
- Send transactions
- Deploy and interact with smart contracts
Each EOA has:
- A private key (256-bit number)
- A public key, derived from the private key using ECDSA
- An address, generated by taking the last 20 bytes of the Keccak-256 hash of the public key (formatted as
0xfollowed by 40 hex characters)
Contract Accounts
These are created when an EOA deploys a smart contract. Unlike EOAs, contract accounts:
- Contain executable code
- Can hold ETH
- Are triggered by incoming transactions
- Cannot initiate transactions on their own
Both account types are "state objects" containing:
nonce: Number of transactions sent (for EOAs) or contracts created (for contracts)balance: Amount of ETH heldstorageRoot: Hash of the storage contentcodeHash: Hash of the contract code (empty for EOAs)
👉 Learn how to securely manage Ethereum accounts and interact with smart contracts today.
Ether and Its Units
Ether (ETH) is the native cryptocurrency of the Ethereum network. All transaction fees and value transfers are denominated in ETH, though smaller units are used for precision.
The smallest unit is wei, where:
- 1 Kwei (Babbage) = $10^3$ wei
- 1 Mwei (Lovelace) = $10^6$ wei
- 1 Gwei (Shannon) = $10^9$ wei
- 1 Szabo = $10^{12}$ wei
- 1 Finney = $10^{15}$ wei
- 1 Ether = $10^{18}$ wei
Gwei is commonly used when setting gas prices (e.g., “20 Gwei”).
Transactions: The Lifeblood of Ethereum
Every action on Ethereum—transferring funds, deploying contracts, or calling functions—is executed through a transaction. A signed data packet, a transaction includes:
from: Sender’s addressto: Recipient address (empty when creating a contract)value: Amount of ETH to send (in wei)data: Input data (function selector + parameters or contract bytecode)gasPrice: Price per unit of gas (in wei)gasLimit: Maximum gas allowed for executionnonce: Sequential number to prevent replay attacks
Additionally, each transaction includes:
hash: Unique identifierv,r,s: Signature components derived from signing the hash with the sender’s private key
Types of Ethereum Transactions
- Transfer Transaction
Simple ETH transfer between accounts. Thedatafield is empty. - Contract Creation Transaction
Deploys a new smart contract. Thetofield is empty;datacontains compiled bytecode. - Contract Interaction Transaction
Calls a function in an existing contract. Thetofield holds the contract address;datacontains encoded function calls.
Understanding Gas and Fees
Gas measures computational effort. Users pay:
Transaction Fee = gasUsed × gasPriceIf execution exceeds gasLimit, the transaction reverts, but the full gasLimit × gasPrice is charged.
👉 Discover how to optimize gas usage and reduce transaction costs on Ethereum.
Smart Contracts: Code That Runs on Blockchain
Smart contracts are programs deployed on Ethereum that execute automatically when triggered.
Writing and Compiling Contracts
Most contracts are written in Solidity, compiled into EVM-compatible bytecode using tools like Remix or solc. The resulting bytecode consists of:
- Creation Code: Executes during deployment, runs constructor logic, returns runtime code
- Runtime Code: Stored permanently on-chain; executed during function calls
If the constructor is payable, ETH can be sent during deployment via the value field.
Calling Functions in Contracts
Function calls use calldata, structured as:
First 4 bytes: Function selector—the first 4 bytes of
keccak256(functionSignature)- Example:
transfer(address,uint256)→ hash → selector
- Example:
- Remaining bytes: Encoded parameters
When a contract receives a call:
- It checks the selector against known functions
If no match:
- Executes
fallback()if defined - Otherwise reverts
- Executes
This dispatch logic is embedded in the runtime code during compilation.
Accessing Contextual Data in Contracts
Solidity provides global variables for runtime information:
msg.sender: Immediate caller’s addressmsg.value: ETH sent with the callmsg.data: Full calldatamsg.sig: Function selectorblock.timestamp,block.number: Current block detailstx.origin: Original transaction sender (not recommended for access control)
Storage in Ethereum Contracts
Each contract has a 256-bit addressable storage space—like a massive array of 32-byte slots.
Storage Layout Rules
Value Types: Stored right-aligned in slots. Multiple small variables may share one slot if space allows.
contract Example { address a; uint8 b; uint256 c; bytes24 d; }- Slot 0:
[unused][b][a] - Slot 1:
[c] - Slot 2:
[unused][d]
- Slot 0:
- Mappings: Occupy a slot (
p). Value at keykis stored atkeccak256(k . p). - Dynamic Arrays: Slot
pstores length. Data starts atkeccak256(p). - Short Strings/Bytes: Stored left-aligned in one slot. Length encoded in lowest bit × 2.
All storage is public—even private variables can be read via eth_getStorageAt.
Interacting with Ethereum Programmatically
Beyond wallets and IDEs, direct interaction is possible via RPC clients.
Using Geth
Geth is a full Ethereum node implementation. It supports:
- Connecting to mainnet, testnets, or private chains
- Executing commands via HTTP, WebSocket, or IPC
Common in CTF environments where custom RPC endpoints are provided.
Automating with Web3.py
For scripting interactions, web3.py is ideal:
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('RPC_URL'))
private_key = 'your_private_key'
account = w3.eth.account.from_key(private_key)
# Build and sign transaction
txn = {
'to': '0x...',
'value': w3.toWei(0.1, 'ether'),
'gas': 200000,
'gasPrice': w3.toWei('20', 'gwei'),
'nonce': w3.eth.getTransactionCount(account.address),
'chainId': 1
}
signed_txn = account.sign_transaction(txn)
tx_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction)Useful for automated testing, exploit development, or interacting with restricted environments.
Frequently Asked Questions
Q: What’s the difference between an EOA and a contract account?
A: EOAs are user-controlled via private keys and can initiate transactions. Contract accounts hold code and can only act when called by an EOA or another contract.
Q: How is a contract’s address determined?
A: For CREATE, it’s derived from sender address and nonce. For CREATE2, it includes sender, salt, and init code—enabling predictable deployment.
Q: Can I read private variables from a contract?
A: Yes. On Ethereum, all storage is public. Use eth_getStorageAt to read data directly from specific slots.
Q: Why do transactions fail even with enough ETH?
A: Common causes include insufficient gas limit, reverted logic in contracts, or invalid calldata formatting.
Q: Is Remix safe for mainnet deployments?
A: Yes—but always verify settings (network, wallet connection) before deploying. Test thoroughly on testnets first.
Q: How do I estimate gas before sending a transaction?
A: Use w3.eth.estimateGas(txn) in web3.py or MetaMask’s built-in estimator to avoid underpricing.
Final Thoughts
Mastering Ethereum fundamentals opens doors to innovation in DeFi, NFTs, DAOs, and more. From understanding account types to optimizing gas usage and securely managing keys, each concept builds toward robust blockchain development.
👉 Start building on Ethereum with secure tools and real-time market insights.