Todas as lições · CKB node, RPC and indexer · Começa aqui · Glossário
Computing a transaction's molecule packed size from RPC JSONAvançadoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-19
A CKB Transaction's packed size (the length of get_transaction with verbosity 0) can be computed from its RPC JSON without serializing it. It is 12 (table header) + RawTransaction + witnesses. RawTransaction is 28 (table header) + 4 (version) + cell_deps (4 + 37 each) + header_deps (4 + 32 each) + inputs (4 + 44 each) + outputs + outputs_data. Each CellOutput is 16 + 8 + lock size, plus the type script size only when a type is present. Each Script is 53 + len(args). A dynvec costs 4 + 4 * count + the sum of its item sizes, and every Bytes item in outputs_data and witnesses costs 4 + len.
Porque importa: Without the exact molecule layout, a tool cannot confirm the node's reported packed transaction size from RPC JSON. The cross-check against the measured node wire bytes would then fail or be skipped.
Padrão
return 12 + raw_size + dynamic([4 + len(raw(v)) for v in tx['witnesses']])Tirado do commit, encurtado.
- Conceitos
- Data encoding (molecule, hex, bigints), Transaction building and fees
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-10-10
- Última mudança
- 2026-10-10
- Ú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)
- 2026-10-10 · Tactus-Labs/tactus-o1 · mais deste projeto
Mais sobre CKB node, RPC and indexer
- Decoding the packed epoch field (number, index, length)
- Nervos DAO compensation from the header's accumulated rate (AR)
- Nervos DAO phase 1 withdrawing cells keep the DAO type; count deposits by 8 zero bytes of data
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Computing a transaction's molecule packed size from RPC JSON", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/computing-a-transaction-s-molecule-packed-size-from-rpc-json, CC BY 4.0, last changed 2026-10-10.