Requirements
A DA backing must provide all of the following for every committed block:- Availability through maturity. The full block is retrievable from the moment its header is committed until the block is merged.
- Open retrieval. Anyone can retrieve it without permission and without paying the operator.
- Content addressing. The block is retrievable by its header hash, so the content can be checked against what is on L1.
- Timestamping. The backing attests when the block first became retrievable.
- Reconstructibility. The data is enough to rebuild the four tries of the block body and the transaction contents that fraud proofs work on.
How a watcher retrieves a block
1
Read the state queue
Take a node’s header hash and header from L1.
2
Retrieve the block
Fetch it by header hash from the DA backing. Check that the retrieved header hashes to that value and matches the header on L1.
3
Rebuild the tries
Parse the body’s four sorted sets and rebuild the four Merkle Patricia Tries.
4
Compare roots
Check each rebuilt root against the corresponding root in the header.
5
Replay the block
Start from the previous block’s UTXO set, apply withdrawals, transactions and deposits in order, and evaluate the ledger rules.
Serialization
A block is serialized as its header followed by its body. Each of the body’s four sets is written as key-value pairs sorted by key. The sort order is part of the format: it makes the serialized set canonical, so every honest party derives the same trie.
The codec’s schema is
cddl-files/codec.cddl in the monorepo, and its reference implementation is the midgard-ts package.