CKB Pulse

Todas as lições · CKB node, RPC and indexer · Começa aqui · Glossário

Reading total occupied capacity (U) from the header DAO fieldPráticoDe uma correção

De uma correção · Verificação: certa · Verificada em 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.

Porque importa: 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.

Padrão

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

Tirado do commit, encurtado.

Conceitos
Capacity and cell size, Data encoding (molecule, hex, bigints)
Evidência
De uma correção: de um projeto, verificada contra o commit
Vista pela primeira vez
2026-10-30
Última mudança
2026-10-30
Última verificação
2026-11-19
Verificação contra o commit
certa: a lição sai do commit e continua a valer no código de hoje

Fontes (1)

Mais sobre CKB node, RPC and indexer

Ver as 45 deste tema

Manténs um projeto de onde esta lição veio? Confirma ou corrige

Citar esta lição
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.

Tiradas de commits públicos e verificadas contra o commit de onde cada uma veio e o código de hoje do projeto. Lê a fonte antes de confiar numa. Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. Queres que uma lição seja mudada ou retirada? Abre um issue.