Quick reference for Ethereum concepts used in tests. For detailed explanations, see Ethereum.org Developer Documentation.
Ethereum uses different denominations for expressing amounts:
| Unit | Value in Wei | Common Use |
|---|---|---|
| Wei | 1 wei | Smallest unit (10^-18 ETH) |
| Gwei | 1,000,000,000 wei | Gas prices (10^-9 ETH) |
| ETH | 1,000,000,000,000,000,000 wei | Main currency (1 ETH) |
Conversion formulas:
- 1 ETH = 10^18 wei
- 1 Gwei = 10^9 wei
- 1 ETH = 10^9 Gwei
π More on Ether units
- Recipient address (contract or account)
- For contract interactions, this is the contract address
- Amount of ETH to send with the transaction (in wei)
- Can be 0 for contract calls that don't require payment
- Arbitrary data payload (in bytes)
- For contract interactions: encoded function call (selector + parameters)
- For simple transfers: usually empty
- Transaction sequence number for the sending account
- Prevents replay attacks
- Must be sequential (0, 1, 2, 3, ...)
- Each account maintains its own nonce counter
π More on transactions
Gas is a unit of measurement that represents the computational effort required to execute operations on the Ethereum network.
Why Gas Exists:
- Metering computation: Every operation (addition, storage write, etc.) costs a specific amount of gas
- Preventing abuse: Limits infinite loops and spam by making computation costly
- Resource allocation: Ensures fair distribution of network resources
- Incentivizing validators: Compensates validators for executing transactions
Key Concept - Gas vs Ether:
Gas is NOT a currency. Think of it like this:
- Gas = Units of computational work (like liters/gallons for fuel)
- Gas Price = Cost per unit of gas (in wei or gwei)
- Transaction Fee = Gas Used Γ Gas Price (paid in ETH)
Example:
A simple ETH transfer costs: 21,000 gas
A complex smart contract call: 100,000+ gas
If gas price = 50 gwei:
- Simple transfer fee = 21,000 Γ 50 gwei = 0.00105 ETH
- Complex call fee = 100,000 Γ 50 gwei = 0.005 ETH
Common Operations and Their Gas Costs:
| Operation | Approximate Gas Cost |
|---|---|
| ETH transfer | 21,000 |
| ERC-20 transfer | ~65,000 |
| Uniswap swap | ~100,000-150,000 |
| NFT mint | ~50,000-100,000 |
| Smart contract creation | 200,000+ |
- Maximum number of gas units the transaction is allowed to consume
- Acts as a safety cap to prevent overspending
- If actual gas used exceeds this limit, transaction reverts (but you still pay for gas used until failure)
- If transaction uses less than limit, unused gas is refunded
- Measured in gas units (not wei or gwei)
Example:
You set Gas Limit = 100,000
Actual usage = 65,000 gas
β Transaction succeeds, 35,000 gas refunded
You set Gas Limit = 50,000
Actual usage would be 65,000 gas
β Transaction fails at 50,000, you pay for 50,000 gas used
Legacy Gas Model (Type 0 transactions):
- Price per gas unit in wei
- Total cost = Gas Used Γ Gas Price
- Set by user, higher price = faster inclusion
EIP-1559 Gas Model (Type 2 transactions):
- Maximum total price per gas unit you're willing to pay (in wei or gwei)
- Includes base fee + priority fee
- Actual fee may be lower
- Tip to validators/miners (in wei or gwei)
- Also called "priority fee" or "tip"
- Incentivizes transaction inclusion
How EIP-1559 works:
Actual fee = Base Fee + Priority Fee
Base Fee = Set by protocol (burned)
Priority Fee = Min(Max Priority Fee, Max Fee - Base Fee)
π More on gas and fees
π EIP-1559 specification
- Unique identifier for each Ethereum network
- Common chain IDs:
1- Ethereum Mainnet5- Goerli Testnet11155111- Sepolia Testnet137- Polygon42161- Arbitrum One
- Prevents replay attacks across different networks
π Chainlist.org - Complete list of chain IDs
- Hierarchical deterministic wallet path
- Format:
m/purpose'/coin_type'/account'/change/address_index - Example:
m/44'/60'/0'/0/044'- BIP44 purpose (hardened)60'- Ethereum coin type (hardened)0'- First account (hardened)0- External chain (non-hardened)0- First address (non-hardened)
- The
'mark indicates hardened derivation
π BIP32 specification
π BIP44 specification
- Elliptic curve used for Ethereum account keys
- Same curve as Bitcoin
- Provides 128-bit security level
- Elliptic curve used for Ethereum 2.0 validator keys
- Supports signature aggregation
- Used in beacon chain consensus
π More on Ethereum accounts
- First 4 bytes of the keccak256 hash of the function signature
- Example:
balanceOf(address)β0x70a08231 - Used to identify which function to call in contract data
- Standard for encoding/decoding contract function calls
- Defines function signatures, parameter types, return types
- Tests use ABI encoding for contract interactions
π More on smart contracts
π Contract ABI specification
- Contracts that delegate calls to implementation contracts
- Allows contract upgrades without changing address
- Common patterns: Transparent proxy, UUPS proxy
- Tests verify app can handle proxy interactions
- Standard for fungible tokens
- Common functions:
transfer(),approve(),balanceOf() - Examples: USDC, DAI, USDT
π EIP-20 specification
- Standard for non-fungible tokens (NFTs)
- Each token has unique identifier
- Examples: CryptoPunks, Bored Ape Yacht Club
- Multi-token standard (fungible + non-fungible)
- Efficient batch operations
- Examples: OpenSea Shared Storefront
- Standard for signing arbitrary messages
- Format:
\x19Ethereum Signed Message:\n{length}{message} - Used by MetaMask and other wallets
- Prevents message from being valid transaction
- Standard for signing typed structured data
- Type-safe, human-readable signing
- Used for permits, orders, votes, etc.
- Includes domain separator for context
- Entity that participates in Ethereum consensus
- Requires 32 ETH deposit
- Uses BLS12-381 keys (different from account keys)
- Ethereum's proof-of-stake consensus layer
- Coordinates validators
- Separate from execution layer (where transactions happen)
- Address:
0x00000000219ab540356cBB839Cbe05303d7705Fa - Receives validator deposits (32 ETH)
- Bridge between execution and consensus layers
- Signing transactions/messages without full parsing
- Used when app doesn't recognize contract or function
- Requires user acknowledgment of risk
- Off-chain analysis of transaction effects
- Detects potential threats (scams, phishing)
- Displays warnings or blocks dangerous transactions
- Framework for parsing any smart contract interaction
- Uses external descriptors to format display
- Allows clear signing without app updates
- Third-party security information about contracts
- Displayed to users during signing
- Provides additional context and warnings
- Human-readable names for addresses
- Examples: ENS names, token tickers
- Verified through challenge-response protocol
- Ethereum.org Developer Docs
- Ethereum Yellow Paper (Technical specification)
- EIPs (Ethereum Improvement Proposals)
- Solidity Documentation
- Web3.py Documentation (Used in tests)