A root with no data behind it
Imagine a sequencer posts a new root but never publishes the transfers behind it. Nobody can replay the batch, nobody can challenge it, and nobody knows their own balance.
A rollup is only as safe as its data is available. Today you see how the main chain makes sure it is, and for how long.
By the end of this lesson
Note
I can work out how many random samples give a target confidence that data was published.
Key words
| Word | What it means | Example |
|---|---|---|
| Data availability | everybody being able to download the data | |
| Erasure coding | adding pieces so that any half rebuilds the data | |
| Sample | one random piece a node asks for | |
| Blob | a block of rollup data the main chain keeps for a while | 131072 bytes |
| Pruning | nodes deleting old data they no longer need to keep |
The cells students fill in are left blank in this preview.
Withheld data breaks every safety check
A fraud proof needs the data to replay. A user leaving the rollup needs it to prove their balance. So the main chain must be sure the data was really published, not only that a root was.
Downloading every byte proves it, but that is what made chains slow. The trick is to check a few random pieces instead.
Erasure coding makes hiding hard
First the data is stretched. k pieces become 2k, chosen so that any k of them rebuild the rest. To hide even one piece, a sequencer must now withhold more than half.
In the lab, four numbers become eight. Any four of the eight give the original four back, and three are not enough.
Stretch four numbers and rebuild them
docker exec jupyter python3 steps/erasure.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Sample for withheld data
docker exec jupyter python3 steps/sampling.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
Worked example: 63 of 128 pieces published
| Samples each | Clients who noticed, of 1000 | Chance one client is fooled |
|---|---|---|
| 1 | 496 | 0.492188 |
| 2 | 737 | 0.242249 |
| 4 | 930 | 0.058684 |
| 8 | 997 | 0.003444 |
| 16 | 1000 | 0.000012 |
The cells students fill in are left blank in this preview.
Try it: how fast the chance falls
chance_present = 63 / 128
for samples in [1, 5, 10, 20]:
fooled = chance_present ** samples
print(samples, "samples: fooled with chance", "%.8f" % fooled)
# Change 63 to 32, so only a quarter is published. How fast does the chance fall now?
Blobs are kept for about 18 days
Since 2024 rollups post their data as blobs, a space of 131072 bytes each set aside for them. The main chain keeps a short commitment to each blob for ever. Nodes keep the blob itself for 4096 epochs, about 18 days, then prune it.
Since late 2025, PeerDAS lets each node keep and check only some columns of the extended blobs. So the chain can carry more blobs.
Watch a blob get pruned
docker exec jupyter python3 steps/expiry.pyShown here, not run. Press Start lab to type it into your own lab’s terminal.
A common mistake
Warning
Many people think the main chain keeps rollup data for ever. Nodes prune a blob after about 18 days and keep only its commitment. So a challenge window must end well before that, and anybody who wants the history keeps their own copy.