CKB Pulse
经验

CKB 学到了什么

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

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

#Since and time locks

找到 18 条经验。 全部经验

第 2 页,共 2 页

Cheque lock sender withdrawal requires exact since 0xA000000000000006实践来自一次修复

The deployed Cheque lock (RFC 0039) accepts a sender withdrawal only when the Cheque input's since is exactly 0xA000000000000006 (relative epoch, 6 epochs after the cell was committed). A since of 0 fails with Cheque error 11 (WithdrawChequeInputSinceError), so the sender cannot reclaim for about 24h after each create or renew.

#Since and time locks #Testing and devnet · 来源(1) · 2026-11-09

Handle None from ckb_sdk Since::extract_metric for invalid since values实践来自一次修复

A raw since u64 can carry the reserved metric flag 0b11 (e.g. 0x6000_0000_0000_0000), for which ckb_sdk::Since::extract_metric() returns None, and a timestamp metric value can exceed what chrono can represent. Code that formats since values received from RPC should handle both cases instead of unwrapping, as ckb-cli now does by printing "invalid since" or "invalid".

#Since and time locks #Data encoding (molecule, hex, bigints) · 来源(1) · 2026-11-09

Relative block number since uses top byte 0x80, not the absolute epoch 0x20实践来自一次修复

Under RFC 0017 since encoding, bit 63 marks relative and bits 61 to 62 select the metric (00 is block number), so a relative block count is RELATIVE_BLOCK_FLAG (0x8000000000000000) OR the count, and 256 blocks becomes 0x8000000000000100. In this commit the type script checks since >> 56 == 0x80, so reusing the absolute epoch form (top byte 0x20) is rejected on chain with an error code that does not name the since as the cause.

#Since and time locks · 来源(2) · 2026-10-02

Verify header_deps against independently fetched headers, not against the tx's own list实践来自一次修复

When checking a transaction that uses header_deps for entropy (for example, headers at fixed offsets from a cell's inclusion block), derive the expected headers yourself: get the creating tx with get_transaction, then get_header on its block_hash, then get_header_by_number for the scheduled heights. Only then compare them to the tx's header_deps. Taking the headers from header_deps makes the check circular, since it only confirms the transaction agrees with itself.

#Since and time locks #Network and RPC reliability · 来源(1) · 2026-10-02

Absolute epoch since needs the 0x20 metric flag实践来自一次修复

An input's since meant as an absolute epoch must have bit 61 set (0x2000000000000000) with bit 63 (relative) and bit 62 clear (RFC 0017). With all three top bits zero the node reads the same number as an absolute block number. The epoch number is in the low 24 bits (raw & 0xffffff), with index and length above it, so check the epoch number inclusively against the required epoch before signing.

since flag bits, not covered

#Since and time locks · 来源(1) · 2026-09-25

Absolute epoch since needs the 0x20 metric flag in the top byte实践来自一次修复

An input since meaning "not before epoch N" must be 0x2000000000000000 | N: top byte 0x20 (absolute, epoch metric) with the epoch number in the low 24 bits. Without the flag the node reads the value as an absolute block number, which for any realistic epoch is already past, so the node enforces no epoch bound. A script that reads since as an epoch must check the metric flag itself, as this project's contract does by refusing a since whose top byte is not 0x20.

Builder side rule for setting the epoch flag.

#Since and time locks · 来源(2) · 2026-09-25

第 2 页,共 2 页

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