Skip to main content
TLDR:
  • Walks you through crafting and broadcasting blob (type-3) transactions on Ethereum, including creating 128 KB blobs and verifying the KZG commitment and blob versioned hash.
  • Explains how blob data is stored on the consensus layer for 18 days, while the blob versioned hash lives on the execution layer.
  • Dives into EIP-4788 & EIP-4844, detailing how to map execution-layer blocks to consensus-layer slots to fetch and verify blob data.
  • Provides full Python scripts for a “bare bones” approach to building, sending, and verifying blob transactions from start to finish.

Main article

Or almost the hard way as we are going to use a bit of Python. The focus of this guide is on keeping the Dencun and EIP-4844 talk to a minimum and to give you hands-on exposure to blob transactions, which is a good way to supplement the prior general knowledge on the topic.
The protocol requires blob data to stay available for at least 4096 epochs, about 18 days, so a node can return no blobs for an older slot. Since the Fulu upgrade, only supernodes, which keep all blob data, are required to return full blobs. The examples in this guide work on Chainstack Ethereum Global Nodes.Start for free and get your app to production levels immediately. No credit card required. You can sign up with your GitHub, X, Google, or Microsoft account.

Introduction

EIPS involved

The two EIPs for this guide are:
  • EIP-4788 — each block on the execution layer now contains the parent beacon’s block root.
  • EIP-4844 — the compressed transaction data from rollups is now stored on the consensus layer for 18 days.
There’s more to each of these EIPs, but we focus on what we need to know for this guide.

Problem

A quick reminder on the problem that the blob transactions solve. With the increased activity on the Ethereum mainnet, the limited throughput leads up to the increased transaction fees (and costs as ETH appreciates in value). To solve this, a new chain is launched. The new chain has faster block times and a centralized unit (the sequencer) processing the transactions and blocks. To have some of the Ethereum network security & decentralization, the new chain takes all of its transactions as complete transaction data, compresses them (or rolls them up, hence rollups) and posts the data in batches to the Ethereum network as smart contract call data. Posting as call data is costly, but you now have the costs split between all the transactions on the rollup chain that were compressed and posted as one transaction to the Ethereum network. As an example, have a look at the Arbitrum batch 517392 — there are 809 transactions in the batch; these transactions were paid for in ETH on the Arbitrum mainnet. The ETH from the transactions in the batch was used to fund one transaction on the Ethereum mainnet where it posted the entire compressed data from the 809 transactions as call data to a contract. In a simplified way, now you have the cost of this one Ethereum transaction split between the actors of the 809 Arbitrum transactions. This makes each of the 809 transactions cheaper. The two problems with this are:
  • The EVM was never designed for this use case and posting compressed transaction data in batches as call data to smart contracts is expensive.
  • The call data is unnecessary and expensive to merely store data.

Solution

Enter blob transactions — the simple and sane solution. Blob data is moved to be stored on the consensus layer. Blob data is no longer processed by the EVM, which means it can be much bigger in size and there is no associated EVM processing gas costs. Table credits: Consensys . A few quick things on blob transactions:
  • Blob transactions are type-3 transactions on the execution layer.
  • When submitted on the execution layer, blob transactions go through the usual lifecycle (node > mempool > block) but the actual blob data is separately gossiped to the consensus layer.
  • Blob data is not validated in the rollup chain context by the Ethereum chain.
  • 18 days is theoretically sufficient for all the network participants to agree on the rollup chain state.
  • It is ultimately the job of the respective rollup chain mechanisms to store the blob data beyond 18 days and ensure its availability (aka Data Availability).
  • Even though the blob data is stored for 18 days, the KZG commitment for each blob — which is basically a fancy hash of blob data — is stored forever. This means that if you recover a blob that’s been lost, you can prove it’s the same blob through the respective KZG commitment.

Transaction types

As mentioned, blob transactions are type-3 transactions. The Pectra upgrade later added type-4 transactions (EIP-7702).
  • Type-0 aka Legacy — original Ethereum transactions with the parameters nonce, gasPrice, gasLimit, to, value, data, v, r, s.
  • Type-1 aka Access list — adds the accessList parameter to the original set. Introduced by EIP-2930.
  • Type-2 aka EIP-1559 — introduces priority fees by adding maxPriorityFeePerGas and maxFeePerGas.
  • Type-3 aka Blobs — adds two new parameters:
    • maxFeePerBlobGas — max fee per blob gas to store the blob
    • blobVersionedHashes — a blob pointer, which is a hash of the blob’s KZG commitment
As you see, Ethereum transactions add more parameters with each new type.

Walkthrough

Now let’s have a hands-on walkthrough. In Python. Here’s what we are going to do:
  • Create our own blob data
  • Send a type-3 transaction with our blob data on Sepolia
  • Retrieve our blob data from the network
  • Compute the KZG commitment for our blob data and verify it’s the same as the on-chain one
  • Compute the blob versioned hash from the KZG commitment and verify it’s the same as the one in our transaction
  • Find all type-3 transactions in a block
  • Put it all together and run a script that:
    • Collects the blob versioned hashes of all type-3 transactions in a block
    • Finds the consensus layer slot of the block and checks it with EIP-4788
    • Retrieves the blobs in the slot from the consensus layer
    • Locally computes the KZG commitment and the blob versioned hash of each blob
    • Checks that each blob versioned hash in the transactions matches a locally computed one

Prerequisites

  1. Log in to your Chainstack account and get a reliable Ethereum RPC endpoint for Sepolia. You can get by with a full node for this exercise.
  2. Install eth-abi.
  3. Install or update web3.py. Note that it’s important you have the latest version as it includes support for the type-3 transactions.
  4. Install or update eth-account. Same here — it’s important you have the latest version as it includes support for the type-3 transactions.
  5. Install ckzg — this computes the KZG commitments.
  6. Install python-dotenv and requests.
  7. Fund your account with SepoliaETH. You can do this through the Chainstack faucet.
  8. Create a .env file with the following variables:
GitHub repository for all the scripts.

Create blob data

Each blob is always a fixed 128 KB in size. You are always paying for a 128 KB slot space. For our hands-on exercise, this means that if our blob data is less than 128 KB, we need to pad it to 128 KB. We are sending a blob that says Chainstack, so we pad it to the fixed size.
For convenience, redirect the output to a file as it’s going to be huge:
What you have now is your blob data. As a reminder, it’s completely arbitrary what we put into it — it can be 2837 transactions rolled into one object or it can be the string Chainstack in hex and padded to 128 KB (as in our case).

Send a type-3 transaction

Now that we know what blob data is and how to create one, let’s actually put it on-chain. Let’s first run the script and then have a look at the transaction committed to the chain.
The script sets the fee caps from the current network fees. Before accepting a blob transaction, the node checks that the account balance covers gas × maxFeePerGas + blob gas × maxFeePerBlobGas, where each blob uses 131,072 blob gas, so caps far above the network fees require a larger balance. The gas value is fixed at 21,000 because the transaction has no calldata. The script doesn’t estimate gas: EIP-4844 requires a type-3 transaction to carry at least one blob versioned hash, and the transaction gets its blob versioned hash only when eth-account signs it with the blob. When signing, eth-account computes the KZG commitment and the proofs for the blob and attaches them to the transaction. Running this will print the transaction hash and receipt. Here’s an example of this transaction on the Sepolia etherscan: 0x5a74bd72aeeb99e874e58b927f9a5c96665278a36b61bed69a4b09597b02edce On etherscan when viewing the transaction, hit Blobs. You will see:
  • Commitment — the KZG commitment of the blob data. We are going to touch on this later in this article.
  • Blob Versioned Hash — basically a hash of the blob, serving as pointer on the execution layer to the blob on the consensus layer.
Clicking the Blob Versioned Hash value will show the blob data. You can check if it’s the same as the one we created previously and saved as blob.txt. It should be the same. Etherscan, being a great explorer, is providing you the data both from the consensus layer and the execution layer. What you need to remember here is:
  • Blob data — only stored on the consensus layer.
  • KZG commitment — only stored on the consensus layer.
  • Blob Versioned Hash — only stored on the execution layer.
Here’s the same blob transaction from our example as Index 0 in the Sepolia Beacon chain explorer. A look at the actual cycle of our type-3 transaction:
  1. We create the blob data and submit it as a type-3 transaction to a node. The to address of the transaction doesn’t really matter as our goal is to put the blob data on the consensus layer.
  2. The node receives our transaction with the blob data, the KZG commitment, and the proofs that eth-account attached. It checks that the commitment matches the blob and that the blob versioned hash in the transaction is derived from the commitment.
  3. The transaction and its blob propagate through the execution layer mempool.
  4. The transaction gets picked up from the mempool as usual and committed in a block on the execution layer. The blob data is distributed and stored on the consensus layer. The blob versioned hash on the execution layer is acting as pointer to the blob on the consensus layer.
Now we have the type-3 transaction with the blob versioned hash forever living on the execution layer and the actual blob data stored for at least 18 days on the consensus layer.

Retrieve blob data from the network

Let’s retrieve the blob data from the network. Since we are working with the consensus layer now, make sure you now use the consensus client endpoint from your Chainstack node details. Our example transaction is included in block 6090748 on the execution layer. The call we are going to use is Retrieve blobs by block ID. To provide a specific pointer for the blob data on the consensus layer, we can use one of the following: head, genesis, finalized, a slot number, or a block root as a hex string with the 0x prefix. See the Beacon API spec. Note that the call does not support the execution layer block number, you can only provide the respective slot number on the consensus layer. Programmatically, we’ll deal with this later. For now, we’ll just pick the respective slot number from the Sepolia Beacon chain explorer: slot 5203463. Here’s our call
This will retrieve all the four blobs referenced by the four type-3 transactions in block 6090748 on the execution layer. One of them is our blob data. If your node returns no blobs for this slot, use a slot from the last 18 days. The endpoint returns the blob data only, ordered the same as the KZG commitments in the block. To request specific blobs, add the versioned_hashes query parameter with the blob versioned hashes from the transactions.

Compute the KZG commitment

Let’s compute the KZG commitment for our blob data and make sure it’s the same as the on-chain one. The blobs call in the previous section returned the four blobs in the slot. The endpoint doesn’t return the KZG commitments, so let’s compute the commitment of our own blob data independently and then match it to our transaction through the blob versioned hash.

What is a KZG commitment

But first — what is a KZG commitment? In simple words, this is a fancy (and extremely secure) way of creating a hash of a blob. You might have been one of the 141,416 contributors who were a part of the KZG ceremony by providing your input. What was created as a result of this ceremony was the file trusted_setup.txt that the KZG commitment takes as one of the inputs. Examples: The last one is the KZG implementation that we are actually going to use.

Compute the KZG commitment

The Python library for c-kzg-4844 is ckzg. We are going to use the library, take our blob data that we created with create_blob_data.py earlier and saved as blob.txt, and take the trusted_setup.txt file.
This will print the KZG commitment for our blob. For our example, it should be 9493a713dd89eb7fe295efd62545bb93bca395a84d18ecfa2c6c650cddc844ad4c1935cbe7d6830967df9d33c5a2e230 If you look up the KZG commitment of our transaction on the Blobs tab in Etherscan, you will see that our independently computed KZG commitment for our independently created blob data matches the on-chain one.

Compute blob versioned hash from the KZG commitment

This one is less fancy, let’s do the hash of our KZG commitment and see if it matches the versioned hash from the transaction on the execution layer.
Remember that the blob versioned hash is stored on the execution layer. To retrieve it, you can do a simple eth_getTransactionByHash. Example for our transaction on Sepolia:
Check if the retrieved one matches the locally computed one. It should match.

Find all type-3 transactions in a block

This one is simple with the latest version of web3py. Make sure you have it updated.

Putting it all together

As the final step, let’s put all parts together and have a script that does the following:
  • Collects the blob versioned hashes of all type-3 transactions in a block
  • Finds the consensus layer slot of the block and checks it with EIP-4788
  • Retrieves the blobs in the slot from the consensus layer
  • Locally computes the KZG commitment and the blob versioned hash of each blob
  • Checks that each blob versioned hash in the transactions matches a locally computed one
There’s no direct association of the block number on the execution layer with the respective slot number on the consensus layer. We do need the slot number, however, to retrieve the blobs of the type-3 transactions that we detect on the execution layer. Each slot is 12 seconds, so the slot of an execution layer block follows from its timestamp: (timestamp - genesis_time) // 12, where genesis_time comes from the /eth/v1/beacon/genesis call on the consensus layer. EIP-4788 lets us check this. The EIP gave the execution layer access to the consensus layer: each block on the execution layer stores the root of the parent beacon block as parentBeaconBlockRoot. The beacon block in our slot must have this root as its parent_root. Taking the slot of the parent beacon block and adding 1 doesn’t always work, because slots can be missed. Since a slot can hold several blob transactions and a transaction can carry several blobs, the script matches blobs to transactions by blob versioned hash rather than by position.
Make sure you have trusted_setup.txt in the same directory with the script. This will print, for each type-3 transaction, its blob versioned hashes, the locally computed KZG commitment of each blob, and whether they match. Example for our block:

Conclusion

This hands-on the hard way guide walked you through creating, detecting, and verifying the type-3 transactions (aka blob transactions). It also showed you some of the pitfalls and how to navigate them like getting slot number associated with the execution layer blob transaction, being able to retrieve the blobs through the consensus layer client, blob data being stored for at least 18 days, and so on.

About the author

Ake

Ake Director of Developer Experience @ Chainstack
Talk to me all things Web3
20 years in technology | 8+ years in Web3 full time years experience
Last modified on November 13, 2026