CKB Pulse

All lessons · Wallets and signing · Start here · Glossary

Count only empty, typeless lock cells as spendable balanceWorkingFrom one fix

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

When computing a wallet's spendable balance from indexer cells under a lock, count only cells with empty output data and no type script as available. A cell with data or any type script (UDT, DOB, profile or attachment cells, not just your own type) holds state, so its capacity stays in the total but is reported as reserved, because spending it would destroy that state. In cemp-mobile this is `const hasData = cell.data !== "0x" && cell.data !== ""; const isProtocol = hasData || type !== null;`.

Why it matters: Without it, data-bearing or typed cells under the wallet's lock are counted as free capacity, so the available balance is overstated and spends or capacity checks can pick cells that hold protocol state.

A test changed in the same commit

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

Concepts
Indexer queries and cell collection, Capacity and cell size
Evidence
From one fix: from one project, checked against its commit
First seen
2026-10-31
Last changed
2026-10-31
Last checked
2026-11-19
Check against the commit
partly right: a true core, with a part that is loose or too wide

Sources (1)

More about Wallets and signing

All 23 in this topic

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

Cite this lesson
LusoCryptoLabs, "Count only empty, typeless lock cells as spendable balance", CKB lessons, https://pulse.lusocryptolabs.com/learned/wallets/count-only-empty-typeless-lock-cells-as-spendable-balance, CC BY 4.0, last changed 2026-10-31.

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.