CKB Pulse

All lessons · Rust scripts and ckb-std · Start here · Glossary

Relative block number since uses top byte 0x80, not the absolute epoch 0x20WorkingFrom one fix

From one fix · Check: partly right · Checked 2026-11-19

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.

Why it matters: If the absolute epoch flag 0x20 is reused where the script expects a relative block number, the transaction is refused on chain with a generic script error that does not point at the since.

Pattern

Prefer
return RELATIVE_BLOCK_FLAG | n;

Taken from the commit, shortened.

A test changed in the same commit

It sits next to the fix. We did not run it.

Concepts
Since and time locks
Evidence
From one fix: from one project, checked against its commit
First seen
2026-10-02
Last changed
2026-10-02
Last checked
2026-11-19
Check against the commit
partly right: a true core, with a part that is loose or too wide

Sources (2)

More about Rust scripts and ckb-std

All 35 in this topic

Do you maintain a project this lesson came from? Confirm or correct it

Cite this lesson
LusoCryptoLabs, "Relative block number since uses top byte 0x80, not the absolute epoch 0x20", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/relative-block-number-since-uses-top-byte-0x80-not-the-absol, CC BY 4.0, last changed 2026-10-02.

Drawn from public commits and checked against the commit each one came from and the project's code today. Read the source before you rely on one. Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. Want a lesson changed or removed? Open an issue.