Reference for Ethereum development covering gas mechanics, transaction types, storage layout, ABI encoding, and EVM execution model. Useful when building on Ethereum or EVM-compatible chains.
Ships in eth-concepts. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Foundational reference for Ethereum and EVM-compatible chain development. Covers the mental models that every other skill assumes you know — gas, transactions, storage, ABI encoding, and the execution environment. This is not a tool skill; it is the conceptual substrate beneath all EVM tooling.
LLMs confidently generate Ethereum code with fundamental misconceptions. These are the ones that cause real bugs.
gasUsed * effectiveGasPrice in wei. Confusing gas units with ether amounts is the most common mental model failure.msg.value is in wei, not ETH — 1 ether in Solidity is 1e18 wei. Passing 1 as msg.value sends 1 wei (0.000000000000000001 ETH), not 1 ETH.CREATE uses keccak256(rlp(sender, nonce)). CREATE2 uses keccak256(0xff ++ sender ++ salt ++ keccak256(initCode)). Same inputs always produce the same address, even before deployment.address(0) is not a burn address by design — It is the zero address. Tokens sent there are irrecoverable, but it has no special EVM semantics. Some protocols use it as a mint/burn signal by convention.block.timestamp is set by the block proposer — It must be greater than the parent timestamp and within ~15 seconds of real time. Do not use it for tight time comparisons or as entropy.Since the London hard fork, Ethereum uses a dual-fee model:
| Term | Definition |
|---|---|
| Base fee | Protocol-set fee per gas unit. Burns on use. Adjusts up/down 12.5% per block based on target utilization (15M gas target, 30M limit). |
| Priority fee (tip) | User-set fee per gas unit paid to the block proposer. Incentivizes inclusion. |
| Max fee | User-set ceiling on total fee per gas unit. Must be >= baseFee + priorityFee. |
| Effective gas price | min(maxFee, baseFee + priorityFee). Overpayment of maxFee is refunded. |
| Gas limit | Maximum gas units the transaction is allowed to consume. Unused gas is refunded. |
| Gas used | Actual gas units consumed during execution. |
The total cost in wei:
cost = gasUsed * effectiveGasPrice
cost = gasUsed * min(maxFeePerGas, baseFeePerGas + maxPriorityFeePerGas)
| Operation | Gas Cost | Notes |
|---|---|---|
| ETH transfer | 21,000 | Base cost for any transaction |
| SSTORE (zero to non-zero) | 20,000 | Most expensive common opcode |
| SSTORE (non-zero to non-zero) | 5,000 | Cheaper update |
| SSTORE (non-zero to zero) | 5,000 + 4,800 refund | Net cost ~200 gas |
| SLOAD (cold) | 2,100 | First access in transaction |
| SLOAD (warm) | 100 | Already accessed this transaction |
| CALL (cold account) | 2,600 | First call to an address |
| CALL (warm account) | 100 | Already accessed this transaction |
| Memory expansion | Quadratic | Cost grows with memory_size^2 / 512 |
| Calldata (zero byte) | 4 | Per zero byte in tx data |
| Calldata (non-zero byte) | 16 | Per non-zero byte in tx data |
| LOG0 | 375 | Base event cost |
| LOG per topic | +375 | Per indexed parameter |
| LOG per data byte | +8 | Event data cost |
Type 3 transactions (Dencun, March 2024) carry blob data for L2 data availability:
| Field | Type 0 (Legacy) | Type 1 (Access List) | Type 2 (EIP-1559) | Type 3 (Blob) |
|---|---|---|---|---|
| EIP | Pre-EIP-2718 | EIP-2930 | EIP-1559 | EIP-4844 |
gasPrice | Yes | Yes | No | No |
maxFeePerGas | No | No | Yes | Yes |
maxPriorityFeePerGas | No | No | Yes | Yes |
accessList | No | Yes | Yes | Yes |
maxFeePerBlobGas | No | No | No | Yes |
blobVersionedHashes | No | No | No | Yes |
| Fee mechanism | Single price | Single price | Base + priority | Base + priority + blob |
Original transaction format. Single gasPrice field. Still valid on all EVM chains.
{nonce, gasPrice, gasLimit, to, value, data, v, r, s}
Adds accessList to pre-declare storage slots and addresses. Reduces cold access costs from 2,600 to 2,400 gas for addresses and 2,100 to 1,900 for storage slots. Useful for contracts accessing many storage slots.
0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, v, r, s])
Default since London. Separates fee into maxFeePerGas and maxPriorityFeePerGas. The base fee portion burns.
0x02 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, v, r, s])
Carries sidecar blob data for L2 rollup data availability. The to field is mandatory (no contract creation). Includes maxFeePerBlobGas for the separate blob fee market.
0x03 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList,
maxFeePerBlobGas, blobVersionedHashes, v, r, s])
The EVM provides 2^256 storage slots per contract, each 32 bytes wide. State variables are allocated sequentially starting at slot 0.
contract Layout {
uint256 a; // slot 0 (full 32 bytes)
uint256 b; // slot 1
uint128 c; // slot 2 (16 bytes, left-aligned)
uint128 d; // slot 2 (packed into remaining 16 bytes)
uint256 e; // slot 3 (c+d filled slot 2)
}
mapping and dynamic array values never share a slot with other variablesThe length is stored at the declared slot p. Elements start at keccak256(p):
array.length → slot p
array[0] → slot keccak256(p)
array[1] → slot keccak256(p) + 1
array[n] → slot keccak256(p) + n
Mappings store nothing at their declared slot p. Each value is at:
mapping[key] → slot keccak256(key . p)
Where . is concatenation and both key and p are left-padded to 32 bytes. Nested mappings compose:
mapping[k1][k2] → slot keccak256(k2 . keccak256(k1 . p))
Short strings/bytes (31 bytes or less) store data and length in the same slot. The lowest-order byte stores length * 2. Long strings/bytes (32+ bytes) store length * 2 + 1 at slot p, and data starts at keccak256(p).
# Read slot 0 of a contract
cast storage 0xContractAddress 0
# Read a mapping value (e.g., balanceOf at slot 3, for address 0xUser)
cast index address 0xUserAddress 3 | xargs cast storage 0xContractAddress
The first 4 bytes of calldata identify the function:
selector = keccak256("functionName(type1,type2)")[:4]
No parameter names, no spaces, canonical types (uint256 not uint). Structs are expanded as tuples.
# Compute a selector
cast sig "transfer(address,uint256)"
# Output: 0xa9059cbb
After the 4-byte selector, arguments are ABI-encoded in 32-byte words:
[4-byte selector][32-byte arg0][32-byte arg1]...
Static types (uint256, address, bool, bytesN) are padded to 32 bytes in place. Dynamic types (bytes, string, arrays) are encoded as a 32-byte offset pointer, with the actual data appended at the end of the calldata.
| Static | Dynamic |
|---|---|
uint<N>, int<N> | bytes |
address | string |
bool | T[] (dynamic array) |
bytes<N> (1-32) | (T1, T2) if any Ti is dynamic |
T[N] (fixed array of static T) |
// abi.encode: standard ABI encoding with 32-byte padding
abi.encode(uint8(1), uint8(2))
// → 0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002
// abi.encodePacked: tight packing, no padding
abi.encodePacked(uint8(1), uint8(2))
// → 0x0102
abi.encodePacked is ambiguous for dynamic types — two different inputs can produce the same output. Never use it for hashing multiple dynamic-length values (hash collision vulnerability). Use abi.encode when computing hashes for signatures or storage keys.
The EVM is a stack-based virtual machine:
RETURNDATASIZE and RETURNDATACOPY.| Property | Storage | Memory | Calldata |
|---|---|---|---|
| Persistence | Permanent | Call duration | Call duration |
| Cost | High (5k-20k gas) | Low (3 gas + expansion) | Very low (read-only) |
| Access | SLOAD/SSTORE | MLOAD/MSTORE | CALLDATALOAD/CALLDATACOPY |
| Mutability | Read/write | Read/write | Read-only |
| Size | 2^256 slots | Linear (grows) | Fixed per call |
| Opcode | msg.sender | address(this) | Storage context | Can send ETH |
|---|---|---|---|---|
CALL | Caller contract | Called contract | Called contract | Yes |
DELEGATECALL | Original msg.sender | Caller contract | Caller contract | No (inherits value) |
STATICCALL | Caller contract | Called contract | Called contract (read-only) | No |
CALLCODE | Caller contract | Caller contract | Caller contract | Yes (deprecated) |
DELEGATECALL executes the target's code in the caller's context. This is how proxies work — the proxy's storage is modified by the implementation's logic. Storage layout between proxy and implementation must match exactly.
STATICCALL reverts if the called code attempts any state modification (SSTORE, LOG, CREATE, SELFDESTRUCT, or calls with value). Used by view/pure external calls.
When a call reverts, the return data contains the error:
// Solidity require/revert with string
0x08c379a0 + abi.encode(string) // Error(string) selector
// Custom error
bytes4(keccak256("InsufficientBalance(uint256,uint256)")) + abi.encode(args)
// Panic codes (assert failures, overflow, division by zero)
0x4e487b71 + abi.encode(uint256 code)
Common panic codes: 0x01 (assert), 0x11 (overflow), 0x12 (divide by zero), 0x21 (invalid enum), 0x31 (empty array pop), 0x32 (array out of bounds).
keccak256(publicKey)[12:]keccak256(deployedBytecode). Empty accounts have keccak256("")# EOA
address = keccak256(publicKey)[12:]
# CREATE (contract deployment)
address = keccak256(rlp([sender, nonce]))[12:]
# CREATE2 (deterministic deployment)
address = keccak256(0xff ++ sender ++ salt ++ keccak256(initCode))[12:]
CREATE2 enables counterfactual addresses — you can compute the address before deployment and even send funds to it. The address depends only on the deployer, salt, and init code.
EIP-6780 (Dencun, March 2024) neutered SELFDESTRUCT. It now only sends the contract's ETH balance to the target — it no longer deletes code or storage unless called in the same transaction as contract creation. Do not rely on SELFDESTRUCT for any logic.
| Unit | Wei | Decimal |
|---|---|---|
| wei | 1 | 10^0 |
| kwei (babbage) | 1,000 | 10^3 |
| mwei (lovelace) | 1,000,000 | 10^6 |
| gwei (shannon) | 1,000,000,000 | 10^9 |
| microether (szabo) | 1,000,000,000,000 | 10^12 |
| milliether (finney) | 1,000,000,000,000,000 | 10^15 |
| ether | 1,000,000,000,000,000,000 | 10^18 |
In practice, only three matter: wei (base unit), gwei (gas prices), ether (human-readable amounts).
| Token | Decimals | 1 Token in Base Unit |
|---|---|---|
| ETH / WETH | 18 | 1e18 |
| USDC | 6 | 1e6 |
| USDT | 6 | 1e6 |
| WBTC | 8 | 1e8 |
| DAI | 18 | 1e18 |
| LINK | 18 | 1e18 |
Never assume 18 decimals. Always read decimals() from the token contract. Arithmetic with mismatched decimals silently produces wrong results by orders of magnitude.
1 wei == 1;
1 gwei == 1e9;
1 ether == 1e18;
1 seconds == 1;
1 minutes == 60;
1 hours == 3600;
1 days == 86400;
1 weeks == 604800;
These are compile-time constants, not runtime calls. 1 ether is syntactic sugar for the literal 1000000000000000000.
The Prague-Electra (Pectra) upgrade combined execution and consensus layer changes:
EIP-7702 — EOA Delegation: EOAs can temporarily delegate to smart contract code within a transaction. Type 0x04 transactions include an authorizationList — signed tuples of (chainId, address, nonce) that set the EOA's code to point at a delegation target. This enables batch transactions, gas sponsorship, and smart account features for existing EOAs without migration.
EIP-2537 — BLS12-381 Precompile: Native BLS signature operations at addresses 0x0b-0x13. Enables efficient BLS signature verification onchain — critical for bridges, zero-knowledge proofs, and cross-chain messaging that rely on BLS aggregate signatures. Previously required expensive Solidity implementations (~100k+ gas vs ~45k with precompile).
EIP-2935 — Historical Block Hashes in State: The BLOCKHASH opcode previously only accessed the last 256 blocks. EIP-2935 stores block hashes in a system contract at 0x0000...0025 (ring buffer of 8191 slots), enabling smart contracts to verify historical state up to ~27 hours back. Useful for trustless bridges and optimistic rollup proofs.
EIP-7685 — Execution Layer Requests: General-purpose framework for the execution layer to trigger consensus layer actions. Replaces ad-hoc mechanisms with a unified request type system. Used by EIP-6110 (validator deposits) and EIP-7002 (execution-triggered withdrawals).
Blob Target Increase: Blob target increased from 3 to 6 per block, doubling L2 data availability capacity. Max blobs increased from 6 to 9. Reduced L2 transaction costs further.
// EIP-7702: Check if EOA has delegated code
// After delegation, EOA's code returns the delegation target
function isDelegated(address account) external view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0; // EOAs normally have size 0
}
The Fusaka upgrade focused on scaling and efficiency:
EIP-7594 — PeerDAS (Peer Data Availability Sampling): Nodes only download a subset of blob data columns and reconstruct the rest via erasure coding. Reduces bandwidth requirements for validators while maintaining data availability guarantees. Enables future blob count increases without proportional bandwidth growth.
EIP-7935 — Gas Limit 60M: Block gas limit raised from 36M to 60M, increasing L1 throughput by ~67%. Combined with EIP-4844 blob improvements, this nearly doubled effective L1 capacity compared to pre-Pectra levels.
EIP-7825 — Transaction Gas Cap: Individual transaction gas limit capped at 16.78M (2^24 - 2^14). Prevents single transactions from consuming more than ~28% of block gas, improving block production reliability and reducing worst-case execution times.
EIP-7951 — secp256r1 Precompile (Passkey Support): Native verification of P-256 (secp256r1) signatures at a precompile address. WebAuthn/passkey authentication can now be verified cheaply onchain (~3,450 gas vs ~300k+ in Solidity). Enables hardware security key and biometric-based wallet authentication without account abstraction overhead.
Post-Dencun blob transactions fundamentally changed Ethereum's fee landscape:
| Period | Avg Base Fee | Cause |
|---|---|---|
| Early 2024 | 30-72 gwei | Pre-blob, L2 data on calldata |
| Late 2024 | 3-10 gwei | Blobs absorb L2 data, reduced calldata demand |
| 2025-2026 | 0.05-0.3 gwei | Increased blob capacity, activity shift to L2s |
L1 is cheap again for simple operations. A basic ETH transfer costs $0.01-0.05. However, this reduced ETH burn rate significantly — issuance now exceeds burn, making ETH net inflationary since mid-2024.
// Gas cost estimation in the sub-gwei era
const gasPrice = await client.getGasPrice(); // ~0.1 gwei
const ethTransferCost = gasPrice * 21000n; // ~2,100 gwei = 0.0000021 ETH
// At $3,500 ETH: ~$0.007 per transfer
Flashbots BuilderNet (launched Dec 2024): Decentralized block building network using TEEs (Trusted Execution Environments). Builders run in secure enclaves, preventing them from frontrunning or censoring transactions. Aims to replace the centralized builder oligopoly.
MEV-Share: Redistribution protocol where searchers share MEV revenue with users whose transactions create the MEV opportunity. Users submit transactions to MEV-Share's matchmaker, receive a portion of backrun profits.
Flashbots Protect RPC: Drop-in RPC endpoint (https://rpc.flashbots.net) that prevents frontrunning by sending transactions directly to Flashbots builders, bypassing the public mempool. Supports fast mode (shared with all builders) and privacy mode (Flashbots builder only).
Block Builder Ecosystem: ~90% of Ethereum blocks are built by specialized builders via MEV-Boost. Top builders (Flashbots, beaverbuild, Titan) compete on bundle inclusion and gas price optimization. Proposer-Builder Separation (PBS) is de facto standard.
Current validator landscape (early 2026):
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/eth-concepts:eth-conceptsfrom eth-concepts
npx claudepluginhub andresdefi/cryptoskills --plugin eth-concepts2 plugins ship this exact skill · first indexed Jul 19, 2026