EIP-4844 · Final · Core · 2022-02-25
EIP-4844: Shard Blob Transactions
Proto-danksharding: adds blob-carrying transactions with their own cheap fee market, giving rollups temporary data space and cutting L2 fees sharply.
What problem does it solve?
Rollups post their transaction data to Ethereum so anyone can reconstruct L2 state. Before this EIP that data went into calldata, which is stored forever by every node and priced like any other execution resource. Data posting was most of what users paid on L2s.
EIP-4844 (shipped in the Dencun upgrade, March 2024) gives rollups a dedicated, cheaper place for that data: blobs. Blobs are not accessible to the EVM and are pruned after a few weeks, which is enough for anyone to download and check them. It is the first step toward full danksharding, and keeps the same transaction format that later data-availability sampling will use.
How it works
- Blob transactions are a new EIP-2718 type,
0x03. They have the EIP-1559 fee fields plusmax_fee_per_blob_gasandblob_versioned_hashes.tomust be set, so they cannot create contracts. - A blob is 4096 field elements × 32 bytes = 128 KiB. Each is committed to with a KZG commitment; the transaction only carries
versioned_hash = 0x01 || sha256(commitment)[1:]. - Sidecars. Blobs travel next to the beacon block, not inside the execution payload. The consensus layer keeps them for
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS= 4096 epochs (about 18 days). In the mempool a blob tx is gossiped as[tx, blobs, commitments, proofs]and only announced, never pushed. - Separate fee market. Each blob costs
GAS_PER_BLOB= 131072 blob gas. Headers gainblob_gas_usedandexcess_blob_gas, and the blob base fee isfake_exponential(1, excess_blob_gas, 3338477): it rises exponentially while usage stays above target and falls when below. The blob fee is burned and not refunded if the transaction fails. - Original limits: target 393216 / max 786432 blob gas per block, i.e. 3 / 6 blobs. These were later raised (see below).
- EVM access:
BLOBHASH(0x49, 3 gas) returns the versioned hash at an index; the point evaluation precompile at0x0A(50000 gas) verifies a KZG proof that the blob evaluates toyat pointz. This is how fraud or validity proofs reference blob contents.
Sample code
A rollup inbox contract recording the blobs attached to the current transaction (Solidity ≥ 0.8.24 exposes blobhash and block.blobbasefee):
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
contract BlobInbox {
event BatchPosted(uint256 indexed index, bytes32 versionedHash, uint256 blobBaseFee);
function postBatch(uint256 numBlobs) external {
for (uint256 i = 0; i < numBlobs; i++) {
bytes32 h = blobhash(i); // BLOBHASH opcode
require(h != bytes32(0), "missing blob");
emit BatchPosted(i, h, block.blobbasefee);
}
}
}
The blob base fee update from the spec:
def calc_excess_blob_gas(parent):
total = parent.excess_blob_gas + parent.blob_gas_used
return max(0, total - TARGET_BLOB_GAS_PER_BLOCK)
base_fee_per_blob_gas = fake_exponential(1, excess_blob_gas, 3338477)
Things to know
- Status: Final, live on mainnet since Dencun.
- Blob capacity has since been raised by EIP-7691, and the
BLOBBASEFEEopcode (EIP-7516) lets contracts read the blob price. Check current parameters rather than relying on the original 3/6 numbers. - Blobs are temporary. Anyone who needs the data long-term (rollup nodes, indexers, explorers) must archive it within the retention window.
- Contracts can never read blob bytes, only their versioned hash and KZG-proven evaluations.
- Sending blob transactions needs a KZG library to compute commitments and proofs; most teams use their rollup stack's batcher or a client library rather than doing it by hand.