CKB Pulse
经验

CKB 学到了什么

从这里开始 · 术语表 · 自测 · 订阅

经验用英文撰写,请用英文搜索。

Tactus-Labs/tactus-o1

来自 Tactus-Labs/tactus-o1 的经验

github.com/Tactus-Labs/tactus-o1

你维护这个项目吗? 在一个 issue 中确认它的经验

找到 8 条经验。 全部经验

get_live_cell may return "unknown" rather than "dead" for a spent output实践再次出现

On CKB node 0.210.0 devnet, get_live_cell for an output already consumed by a committed transaction returned status "unknown" instead of "dead", so a check requiring "dead" fails. Accept "dead" or "unknown" and prove consumption by calling get_transaction on the creating and consuming transactions, confirming both are committed and that the consumer's inputs reference the out point exactly once.

#Indexer queries and cell collection #Network and RPC reliability · 来源(3) · 2026-10-30

Computing a transaction's molecule packed size from RPC JSON进阶来自一次修复

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.

#Data encoding (molecule, hex, bigints) #Transaction building and fees · 来源(1) · 2026-10-10

Conflict an orphaned transaction's input on the winning branch when testing a reorg rollback进阶来自一次修复

In a CKB devnet reorg test, transactions from detached blocks can return to the txpool and be committed again on the winning branch, which hides the rollback you want to observe. Have the winning branch spend one input of the orphaned transaction, such as its fee input, before the branches reconnect. Resubmitting the old transaction is then rejected with TransactionFailedToResolve (-301), and you must rebuild it with fresh funding.

#Testing and devnet #Indexer queries and cell collection · 来源(1) · 2026-10-10

Simulating a real CKB reorg with two devnet nodes over P2P进阶来自一次修复

To exercise genuine fork choice on a Dummy devnet, partition two nodes with set_network_active(false) plus remove_node, wait until get_peers is empty on both, then mine a longer competing branch on one node with generate_block. Reconnect with set_network_active(true) and add_node(node_id, /ip4/.../tcp/port), and wait until both nodes report the same get_tip_header hash and the same tx_pool_info tip_hash before checking reorg recovery.

#Testing and devnet #Network and RPC reliability · 来源(2) · 2026-10-10

Creation witness for an output type script goes in WitnessArgs.output_type实践来自一次修复

A type script that checks a newly created output can read its proof from WitnessArgs.output_type, but the script decides which witness to read: tactus-o1's state proof script loads absolute witness 0 (Source::Input, index 0), not a witness matched to the output index. If that witness is also the first witness of the secp lock group, put the proof in its output_type field next to the 65 byte lock placeholder, and it is covered by the lock signature because the sighash keeps the other WitnessArgs fields and zeroes only the lock.

#Witnesses and signatures · 来源(1) · 2026-10-10

Forcing a real CKB devnet reorg via P2P partition RPCs进阶来自一次修复

To force a real reorg between two Dummy devnet nodes without truncate or submit_block, call set_network_active(false) and remove_node on both, let the main node commit its transactions, then on the peer spend one input that those transactions consume and mine a longer branch with generate_block. Reconnect with set_network_active(true) on both and add_node, and treat convergence as reached only when get_tip_header and tx_pool_info.tip_hash both equal the winning hash on both nodes. Because the peer branch spent that input, the orphan transactions stay out of the chain and the pool, and replaying one of them fails with TransactionFailedToResolve (code -301).

#Testing and devnet · 来源(1) · 2026-10-10

Molecule table encoding of absent optional fields实践来自一次修复

A molecule table or dynvec (Script, CellOutput, WitnessArgs) is serialized as a u32 total size, then one u32 offset per field, then the fields. There is no separate count; readers derive it from the first offset. An absent Opt field takes zero bytes, so its offset equals the next offset, or the total size if it is last. A hand-rolled encoder that inserts a u32 count after the total size, as this commit's dyn_collection does, produces malformed molecule.

#Data encoding (molecule, hex, bigints) #Witnesses and signatures · 来源(1) · 2026-10-09

CKB blake160 is the first 20 bytes of the 32 byte ckbhash基础来自一次修复

CKB blake160, used for lock args and pubkey hashes, is the first 20 bytes of the 32 byte blake2b digest personalized with "ckb-default-hash". A blake2b hasher configured with a 20 byte output length gives a different value, because the digest length is part of blake2b's parameter block. Always hash to 32 bytes and then truncate.

#Data encoding (molecule, hex, bigints) #Witnesses and signatures · 来源(1) · 2026-10-09

文本采用 CC BY 4.0:请署名 LusoCryptoLabs, CKB lessons,并附上经验的链接。 JSON · 想修改或撤下某条经验?请提交 issue。