全部经验 · CKB node, RPC and indexer · 从这里开始 · 术语表
Computing a transaction's molecule packed size from RPC JSON进阶来自一次修复
来自一次修复 · 核对结果:正确 · 核对于 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.
为什么重要: 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.
代码模式
return 12 + raw_size + dynamic([4 + len(raw(v)) for v in tx['witnesses']])摘自提交,已缩短。
- 概念
- Data encoding (molecule, hex, bigints), Transaction building and fees
- 证据
- 来自一次修复: 来自一个项目,已对照其提交核对
- 首次出现
- 2026-10-10
- 最近改动
- 2026-10-10
- 最近核对
- 2026-11-19
- 对照提交的核对结果
- 正确:这条经验出自该提交,并且在今天的代码中仍然成立
来源(1)
- 2026-10-10 · Tactus-Labs/tactus-o1 · 这个项目的更多经验
更多关于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
引用这条经验
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.