Abstract
Essential Ethereum knowledge for tackling ETH-related challenges, covering accounts, transactions, smart contracts, and storage mechanisms.
Core Components
1. Development Environment
- Remix IDE: Primary Ethereum smart contract development environment
- MetaMask: Browser-based Ethereum wallet
- Etherscan: Blockchain explorer for transaction verification
- Geth: Command-line interface for Ethereum interaction
Account Types in Ethereum
Ethereum utilizes two distinct account classifications:
External Owned Accounts (EOA)
- User-controlled wallets storing Ether
Features:
- 256-bit private key (32 bytes)
- Derived public key via ECDSA (64 bytes)
- 20-byte address (Keccak256 hash of public key)
Capabilities:
- Initiate transactions
- Hold Ether balances
Contract Accounts
- Programmable accounts containing smart contract code
Characteristics:
- Created via transactions from EOAs
Address generation methods:
CREATE: Based on creator address and transaction nonceCREATE2: Uses creator address, salt, and bytecode
- Cannot initiate transactions autonomously
- Can receive/send Ether and execute code when triggered
All accounts maintain:
- Nonce (transaction counter)
- Ether balance
- StorageRoot (for contracts)
- CodeHash (for contracts)
Ether Denominations
Base unit: wei
Common conversions:
- 1 Gwei = 10⁹ wei
- 1 Ether = 10¹⁸ wei
Transaction Mechanics
Signed data packets enabling:
- Value transfers
- Contract creation
- Function calls
Transaction Components
| Field | Purpose |
|---|---|
| from | Sender address |
| to | Recipient address (null for contract creation) |
| value | Transferred Ether (wei) |
| data | Bytecode or encoded function calls |
| gasPrice | Fee per gas unit |
| gasLimit | Maximum gas allocation |
| nonce | Transaction sequence number |
Transaction Types
Value Transfer
- Requires: from, to, value
- Empty data field
Contract Creation
- Requires: from, contract bytecode
- Null to field
Contract Interaction
- Requires: from, to, encoded function data
Smart Contract Essentials
Development Workflow
- Write in Solidity/Yul
- Compile to EVM bytecode
- Deploy via transaction
👉 Smart contract deployment guide
Contract Anatomy
- Creation Code: Constructor logic
- Runtime Code: Deployed contract logic
Function Calls
Call Data Structure:
- First 4 bytes: Function selector (Keccak256 hash of signature)
- Remaining bytes: Encoded parameters
Storage Architecture
- 2²⁵⁶ slot array (32 bytes per slot)
Storage patterns:
- Static variables: Sequential packing
- Mappings:
keccak256(key + slot) - Dynamic arrays: Length at slot p, data at
keccak256(p) - Strings: Length-dependent storage scheme
Interaction Methods
Web3.py Scripting
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('RPC_ENDPOINT'))
def send_txn(sender, target, data):
txn = {
'chainId': w3.eth.chainId,
'from': sender,
'to': target,
'gasPrice': w3.toWei(1.1, 'gwei'),
'nonce': w3.eth.getTransactionCount(sender),
'data': data
}
signed = w3.eth.account.signTransaction(txn, PRIVATE_KEY)
return w3.eth.sendRawTransaction(signed.rawTransaction)FAQ
Q: How are contract addresses determined?
A: Through either CREATE (nonce-dependent) or CREATE2 (deterministic) opcodes
Q: What happens if a transaction exceeds gasLimit?
A: The transaction reverts but gas costs up to the limit are still charged
Q: Can contracts initiate transactions?
A: No, they can only respond to external calls
Q: How is private data stored?
A: All contract storage is publicly visible on-chain
Q: What's the smallest Ether unit?
A: wei (1 Ether = 10¹⁸ wei)
Key optimizations:
1. Removed year reference from title
2. Structured content with clear hierarchy
3. Added SEO-friendly tables and lists
4. Incorporated 7 core keywords naturally
5. Included interactive elements and FAQs