Try it Live
Run Blob examples in the interactive playground
Conceptual Guide - For API reference and method documentation, see Blob API.
What Are Blobs?
Blobs are fixed-size data containers (exactly 131,072 bytes = 128 KB) attached to transactions. Unlike calldata:- Temporary - Stored for ~18 days (~4096 epochs), then pruned
- Cheaper - Use separate blob gas market with lower base fees
- Not executable - EVM cannot directly access blob data
- Verified - Use KZG commitments to prove data integrity
Key Properties
Why Blobs Exist (EIP-4844)
Before EIP-4844, L2 rollups posted transaction data as calldata:- Expensive - 16 gas per byte (~2M gas for 128 KB)
- Permanent - Stored forever in blockchain state
- Inefficient - Paying for permanent storage when temporary availability suffices
- Cheaper - Separate blob gas market (~0.5M gas for 128 KB)
- Temporary - Pruned after ~18 days
- Sufficient - L2s only need data available long enough for fraud/validity proofs
Blob Structure
A blob contains 4,096 field elements, each 32 bytes, organized for BLS12-381 scalar field operations:Creating Blobs
- From Data (Standard)
- From Raw Bytes
- Bytes 0-7: Data length (8-byte little-endian uint64)
- Bytes 8+: Actual data
- Remaining: Zero padding
KZG Commitments
KZG (Kate-Zaverucha-Goldberg) commitments prove blob data integrity without revealing contents. Each blob has:- Commitment (48 bytes) - Cryptographic binding to blob data
- Proof (48 bytes) - Proves commitment matches blob
- Versioned Hash (32 bytes) - Transaction reference (version byte + SHA256 of commitment)
Computing Commitments
- TypeScript
Versioned Hashes
Transactions reference blobs using versioned hashes, not raw commitments:0x01 (KZG version) + SHA256(commitment)[1:32]
Complete Example: L2 Data Posting
L2 rollup posting batch data to Ethereum:- TypeScript
- Verification
Handling Multiple Blobs
Large data requires multiple blobs (max 6 per transaction):- TypeScript
Blob Gas Market
Blobs use a separate gas market from regular transactions:Gas Pricing
Fee Market Dynamics
Blob base fee adjusts based on usage:- Target: 3 blobs per block (393,216 blob gas)
- Max: 6 blobs per block (786,432 blob gas)
- Adjustment: Exponential (similar to EIP-1559)
Field Element Constraints
Each 32-byte field element must be < BLS12-381 scalar field modulus:fromData():
Data Availability Window
Blobs are temporary (~18 days = 4096 epochs):Security Considerations
Commitment Binding
KZG commitments cryptographically bind blob data:Trusted Setup
KZG requires trusted setup ceremony:- Powers of Tau - 4096 participants contributed randomness
- Security - Safe if at least 1 participant honest
- Transparency - All contributions public and verifiable
Common Patterns
Single Blob Transaction
Multi-Blob Transaction
Gas Estimation
Resources
- EIP-4844 - Proto-danksharding specification
- KZG Ceremony - Trusted setup details
- Danksharding Roadmap - Ethereum scaling plan
- c-kzg-4844 - Reference KZG implementation
- Blob Transaction Format - EIP-4844 transaction structure
Next Steps
- Overview - Type definition and API reference
- EIP-4844 - Detailed specification coverage
- KZG - KZG commitment scheme deep dive
- Usage Patterns - Real-world examples

