CKB Pulse

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

Prefer
Buffer.from(header.dao.slice(2), "hex").readBigUInt64LE(24) - this.burnt

Taken 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)

More about CKB node, RPC and indexer

All 45 in this topic

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.

Drawn from public commits and checked against the commit each one came from and the project's code today. Read the source before you rely on one. Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. Want a lesson changed or removed? Open an issue.