EIP-4844 � Proto-Danksharding
EIP-4844, implemented in March 2024 (Dencun upgrade), introduced blob transactions � a new transaction type that carries large binary data for rollups at dramatically lower cost than calldata. This reduced rollup operating costs by 10-100x.
Data Blobs for Rollups
- Problem before EIP-4844: Rollups post compressed transaction data to L1 as calldata (4 gas/byte non-zero, 16 gas/byte zero). For a busy rollup, monthly L1 data costs were $1-5M. These costs are ultimately passed to users
- Blob transactions: New transaction type (type 3). Each blob carries 128 KB of data (~4096 32-byte field elements). Up to 6 blobs per block (target: 3). Blob data has its OWN fee market (blob base fee), separate from regular gas
- Temporary storage: Blobs are guaranteed available for ~18 days, then pruned. Full nodes don't need to store blobs forever � only archive nodes. Rollups must store their own long-term data archives
- KZG commitments: Each blob has a KZG Polynomial Commitment � a cryptographic commitment to the blob's content. The L1 block header stores all blob KZG commitments. This enables Data Availability Sampling in future Danksharding
- Cost reduction: Pre-EIP-4844: $0.20-$3.00 per rollup transaction (before compression). Post-EIP-4844: $0.001-$0.10 per rollup transaction. Rollup costs fell 80-99% on the day of activation
Blob Fee Market Simulation
def blob_base_fee_adjustment(
current_fee_wei: int,
blobs_used: int,
target_blobs_per_block: int = 3,
max_blobs_per_block: int = 6,
) -> int:
"""
Blob fee market: similar to EIP-1559 base fee adjustment.
Target 3 blobs per block. Max 6.
"""
MAX_CHANGE_FACTOR = 0.125 # 12.5% max change per block
if blobs_used > target_blobs_per_block:
# More blobs than target: increase fee
excess = blobs_used - target_blobs_per_block
change_factor = 1 + MAX_CHANGE_FACTOR * (excess / target_blobs_per_block)
elif blobs_used < target_blobs_per_block:
# Fewer blobs: decrease fee
shortage = target_blobs_per_block - blobs_used
change_factor = 1 - MAX_CHANGE_FACTOR * (shortage / target_blobs_per_block)
else:
change_factor = 1.0
new_fee = int(current_fee_wei * change_factor)
MIN_BLOB_FEE = 1 # 1 wei minimum
return max(new_fee, MIN_BLOB_FEE)
def rollup_cost_comparison(txs: int, blob_base_fee_wei: int, eth_price_usd: float = 3000) -> dict:
"""Compare pre and post EIP-4844 costs for a rollup batch"""
bytes_per_tx = 12 # Compressed SegWit-like data per tx
total_bytes = txs * bytes_per_tx
# Pre-EIP-4844: calldata cost
calldata_gas = total_bytes * 16 # 16 gas per non-zero byte (pessimistic)
calldata_cost_eth = calldata_gas * 30e-9 # At 30 Gwei base fee
calldata_cost_usd = calldata_cost_eth * eth_price_usd
# Post-EIP-4844: blob cost
blob_size = 128 * 1024 # 128 KB per blob
blobs_needed = max(1, -(-total_bytes // blob_size)) # Ceiling division
blob_cost_eth = blobs_needed * 1 * blob_base_fee_wei / 1e18 # 1 blob * fee
blob_cost_usd = blob_cost_eth * eth_price_usd
return {
"transactions": txs,
"total_bytes_compressed": total_bytes,
"blobs_needed": blobs_needed,
"pre_4844_cost_usd": round(calldata_cost_usd, 4),
"post_4844_cost_usd": round(blob_cost_usd, 4),
"cost_reduction": f"{calldata_cost_usd / max(blob_cost_usd, 0.0001):.0f}x" if blob_cost_usd else "N/A",
"cost_per_tx_cents": round(blob_cost_usd / txs * 100, 4),
}
# 1000-tx batch at post-Dencun blob prices
blob_fee = 10_000_000_000 # 10 Gwei blob base fee (moderate)
result = rollup_cost_comparison(txs=10_000, blob_base_fee_wei=blob_fee)
print("10,000 transaction rollup batch:")
for k, v in result.items():
print(f" {k}: {v}")Common Mistakes
- Thinking blobs store transactions directly on Ethereum indefinitely � blob data is pruned after ~18 days. Ethereum only stores the KZG commitment (a hash) permanently. Rollup operators must maintain their own long-term data archives for historical state reconstruction
- Assuming EIP-4844 is final danksharding � EIP-4844 is 'Proto-Danksharding'. Full Danksharding adds: Data Availability Sampling (light clients verify data availability), distributed blob storage, and 2D erasure coding � allowing many more blobs per block (64+)
Tip
Tip
Practice EIP4844 ProtoDanksharding in small, isolated examples before integrating into larger projects. Breaking concepts into small experiments builds genuine understanding faster than reading alone.
Each block references the previous block's hash, forming an immutable chain
Practice Task
Note
Practice Task — (1) Write a working example of EIP4844 ProtoDanksharding from scratch without looking at notes. (2) Modify it to handle an edge case (empty input, null value, or error state). (3) Share your solution in the Priygop community for feedback.
Quick Quiz
Common Mistake
Warning
A common mistake with EIP4844 ProtoDanksharding is skipping edge case testing — empty inputs, null values, and unexpected data types. Always validate boundary conditions to write robust, production-ready blockchain code.
Key Takeaways
- EIP-4844, implemented in March 2024 (Dencun upgrade), introduced blob transactions � a new transaction type that carries large binary data for rollups at dramatically lower cost than calldata.
- Problem before EIP-4844: Rollups post compressed transaction data to L1 as calldata (4 gas/byte non-zero, 16 gas/byte zero). For a busy rollup, monthly L1 data costs were $1-5M. These costs are ultimately passed to users
- Blob transactions: New transaction type (type 3). Each blob carries 128 KB of data (~4096 32-byte field elements). Up to 6 blobs per block (target: 3). Blob data has its OWN fee market (blob base fee), separate from regular gas
- Temporary storage: Blobs are guaranteed available for ~18 days, then pruned. Full nodes don't need to store blobs forever � only archive nodes. Rollups must store their own long-term data archives