All lessons · Apps and UI · Start here · Glossary
Occupied capacity depends on the actual lock's args lengthWorkingFrom one fix
From one fix · Check: right · Checked 2026-11-19
When quoting the capacity for cells locked to a user's wallet, compute the occupied size from the connected lock script (8 capacity bytes + 32 code_hash + 1 hash_type + args length + type + data), not a hardcoded value. In this commit a JoyID lock with 22 byte args gives a 222 CKB claim cell and a secp256k1 lock with 20 byte args gives 220 CKB. The script's molecule serialization header does not count toward occupied capacity.
Why it matters: A hardcoded lock size misquotes the capacity for any wallet whose lock args differ in length. In this commit that is 2 CKB per claim cell between JoyID (22 bytes) and secp256k1 (20 bytes), so the quoted total the user agrees to would not match what the transaction needs.
Distinct from the pre-sign checker lesson: this is about sizing by the connected lock's real args length.
Pattern
const lockScriptSize = (lockScript) => 32n + 1n + argsLength(lockScript);Taken from the commit, shortened.
A test changed in the same commit
It sits next to the fix. We did not run it.
- toastmanAu/daowow:
apps/web/test/quote.test.js,crates/daowow-core/tests/gen_vectors.rs
- Concepts
- Capacity and cell size
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-09-23
- Last changed
- 2026-09-23
- Last checked
- 2026-11-19
- Check against the commit
- right: the lesson follows from its commit and still holds in the code today
Sources (1)
- 2026-09-23 · toastmanAu/daowow · more from this project
More about Apps and UI
- Exact CKB-to-shannon conversion with BigInt
- Pre-sign checkers must mirror every on-chain comparison
- Witness data in input_type and folding sub-minimum change
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Occupied capacity depends on the actual lock's args length", CKB lessons, https://pulse.lusocryptolabs.com/learned/apps/occupied-capacity-depends-on-the-actual-lock-s-args-length, CC BY 4.0, last changed 2026-09-23.