All lessons · CKB node, RPC and indexer · Start here · Glossary
Reading total occupied capacity (U) from the header DAO fieldWorkingFrom one fix
From one fix · Check: right · Checked 2026-11-19
The block header `dao` field packs four little endian u64 values (C, AR, S, U), and U at byte offset 24 is the total occupied capacity of all live cells in shannons. This commit reads it from `get_tip_header` to show chain state size, and for a genesis that holds the 8.4 billion CKB cell (mainnet and offckb devnet) it subtracts 5.04 billion CKB counted as occupied because it is due to be burnt, as the CKB Explorer does.
Why it matters: Without decoding U from the DAO field you cannot cheaply show the chain's total occupied state. Without subtracting the genesis cell's 60% occupied share, a mainnet or offckb devnet figure is inflated by 5.04 billion CKB and will not match the CKB Explorer.
Pattern
Buffer.from(header.dao.slice(2), "hex").readBigUInt64LE(24) - this.burntTaken from the commit, shortened.
- Concepts
- Capacity and cell size, Data encoding (molecule, hex, bigints)
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-10-30
- Last changed
- 2026-10-30
- Last checked
- 2026-11-19
- Check against the commit
- right: the lesson follows from its commit and still holds in the code today
Sources (1)
- 2026-10-30 · wildanrhmn/ckb-devnet-explorer · more from this project
More about CKB node, RPC and indexer
- Nervos DAO compensation from the header's accumulated rate (AR)
- Decoding the packed epoch field (number, index, length)
- Nervos DAO phase 1 withdrawing cells keep the DAO type; count deposits by 8 zero bytes of data
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Reading total occupied capacity (U) from the header DAO field", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/reading-total-occupied-capacity-u-from-the-header-dao-field, CC BY 4.0, last changed 2026-10-30.