Documentation Index Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
Use this file to discover all available pages before exploring further.
Try it Live Run Transaction examples in the interactive playground
EIP-4844 Transactions
Blob transactions for L2 data availability, introduced in Dencun hard fork.
Overview
EIP-4844 transactions (Type 3) attach large data blobs for L2 rollup data availability. Blobs are pruned after ~18 days but provide cheaper data storage than calldata.
Type Definition
type EIP4844 = {
type : Type . EIP4844 // 0x03
chainId : bigint
nonce : bigint
maxPriorityFeePerGas : bigint
maxFeePerGas : bigint
gasLimit : bigint
to : AddressType // Cannot be null
value : bigint
data : Uint8Array
accessList : AccessList
maxFeePerBlobGas : bigint // Max fee per blob gas
blobVersionedHashes : readonly VersionedHash [] // KZG commitments
yParity : number
r : Uint8Array
s : Uint8Array
}
Source: types.ts:111-130
Creating EIP-4844 Transactions
import * as Transaction from 'tevm/Transaction'
const tx : Transaction . EIP4844 = {
type: Transaction . Type . EIP4844 ,
chainId: 1 n ,
nonce: 0 n ,
maxPriorityFeePerGas: 1000000000 n ,
maxFeePerGas: 20000000000 n ,
gasLimit: 100000 n ,
to: contractAddress , // Cannot be null
value: 0 n ,
data: new Uint8Array (),
accessList: [],
maxFeePerBlobGas: 2000000000 n , // 2 gwei per blob gas
blobVersionedHashes: [ hash1 , hash2 ], // 2 blobs
yParity: 0 ,
r: signatureR ,
s: signatureS ,
}
Blob Basics
Blob Size
Each blob: 128 KB (131,072 bytes)
Maximum: 6 blobs per transaction
Blob data stored separately from transaction
Blob Gas
Fixed: 131,072 gas per blob
Total blob gas = blob_count × 131,072
Versioned Hashes
Blob commitments using KZG (Kate-Zaverucha-Goldberg):
type VersionedHash = HashType // 32 bytes
// Format: version_byte || commitment_hash
// Currently: 0x01 || sha256(kzg_commitment)[1:]
getBlobGasCost
Calculate total blob gas cost.
function getBlobGasCost (
tx : BrandedTransactionEIP4844 ,
blobBaseFee : bigint
) : bigint
Usage
import { EIP4844 } from 'tevm/Transaction'
const tx : Transaction . EIP4844 = {
blobVersionedHashes: [ hash1 , hash2 , hash3 ], // 3 blobs
// ...
}
const blobBaseFee = 1 n // From block header
const blobCost = EIP4844 . getBlobGasCost ( tx , blobBaseFee )
// 3 * 131072 * 1 = 393216
Formula:
blobGasCost = blobCount × 131072 × blobBaseFee
Source: EIP4844/getBlobGasCost.js:13-18
Total Cost
// Execution gas cost
const executionCost = effectiveGasPrice × gasUsed
// Blob gas cost
const blobCost = blobCount × 131072 × blobBaseFee
// Total
const totalCost = executionCost + blobCost + value
Example:
const tx : Transaction . EIP4844 = {
maxFeePerGas: 20 n ,
maxPriorityFeePerGas: 2 n ,
gasLimit: 100000 n ,
maxFeePerBlobGas: 10 n ,
blobVersionedHashes: [ hash1 , hash2 ], // 2 blobs
value: 0 n ,
// ...
}
// Assume
const baseFee = 15 n
const blobBaseFee = 5 n
const gasUsed = 80000 n
// Execution cost
const effectiveGasPrice = 15 n + 2 n // baseFee + priority
const executionCost = 17 n × 80000 n // 1,360,000
// Blob cost
const blobCost = 2 × 131072 n × 5 n // 1,310,720
// Total
const total = 1360000 n + 1310720 n + 0 n // 2,670,720
Blob Base Fee
Blob base fee adjusts independently from execution base fee:
// Separate fee markets
executionBaseFee // For regular gas (EIP-1559)
blobBaseFee // For blob gas (EIP-4844)
// Each adjusts based on its own usage
Target: 3 blobs per block
< 3 blobs: blob base fee decreases
> 3 blobs: blob base fee increases
getEffectiveGasPrice
EIP-4844 uses same execution gas pricing as EIP-1559:
import { EIP4844 } from 'tevm/Transaction'
const executionPrice = EIP4844 . getEffectiveGasPrice ( tx , baseFee )
// Same calculation as EIP1559.getEffectiveGasPrice
Methods
import { EIP4844 } from 'tevm/Transaction'
// Serialization
const bytes = EIP4844 . serialize ( eip4844Tx )
const decoded = EIP4844 . deserialize ( bytes )
// Hashing
const txHash = EIP4844 . hash ( eip4844Tx )
const signingHash = EIP4844 . getSigningHash ( eip4844Tx )
// Signing
const sender = EIP4844 . getSender ( eip4844Tx )
const isValid = EIP4844 . verifySignature ( eip4844Tx )
// Gas calculations
const executionPrice = EIP4844 . getEffectiveGasPrice ( eip4844Tx , baseFee )
const blobCost = EIP4844 . getBlobGasCost ( eip4844Tx , blobBaseFee )
Blob Data
Blob data is NOT included in transaction:
// Transaction contains only commitments
{
type : 0x03 ,
// ...
blobVersionedHashes : [ hash1 , hash2 ], // KZG commitments
// ...
}
// Actual blob data transmitted separately
// Network format: TransactionPayloadBody
// {
// blobs: [blob1, blob2],
// commitments: [commitment1, commitment2],
// proofs: [proof1, proof2]
// }
RLP Encoding
0x03 || rlp([chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gasLimit, to, value, data, accessList, maxFeePerBlobGas, blobVersionedHashes, yParity, r, s])
Blob data transmitted separately in network layer.
Use Cases
L2 Rollups - Post transaction data for data availability
Data availability - Cheaper than calldata
Temporary storage - Data pruned after ~18 days
Limitations
No contract creation - to cannot be null
Pruning - Blobs deleted after ~18 days
Size limit - Maximum 6 blobs (768 KB)
Network support - Requires Dencun hard fork
Cost Comparison
Method Cost (per byte) Persistent Use Case calldata ~16 gas Forever Permanent data Blobs ~1 gas ~18 days L2 rollup data Storage ~20,000 gas Forever Contract state
Blobs are ~16x cheaper than calldata for temporary data.
When to Use
Use EIP-4844 for:
L2 rollup data availability
Temporary large data (< 768 KB)
Cost optimization for data posting
Use calldata for:
Permanent data needed
Data < 10 KB
Pre-Dencun networks
EIP Reference