CKB Pulse
Lessons

What CKB learned

Start here · Glossary · Test yourself · Feed

salmansarwarr/Kirea-finance

Lessons from salmansarwarr/Kirea-finance

github.com/salmansarwarr/Kirea-finance

Do you maintain this project? Confirm its lessons in one issue

3 lessons found. All lessons

Address balance via get_cells_capacity with snake_case lock scriptWorkingFrom one fix

To show a CKB address balance, convert the address to a lock script (ckb-sdk-utils addressToScript returns camelCase codeHash/hashType) and pass it to the indexer RPC get_cells_capacity with snake_case fields (code_hash, hash_type, args) and script_type "lock". The returned capacity is a hex shannon string, so parse it with BigInt and divide by 10^8 for CKB.

#Indexer queries and cell collection #Data encoding (molecule, hex, bigints) · Sources (1) · 2026-10-15

Matching a Script code_hash to its code Cell by hash_typeWorkingSeen again

To check that a Script points at a given deployed code Cell, compare its code_hash with ckb blake2b256 of the Cell's output data when hash_type is data, data1 or data2 (0, 2, 4), and with the hash of that Cell's Type Script when hash_type is type (1). A type selection needs the code Cell to actually carry a Type Script, and other hash_type values are rejected.

#Cell deps and script lookup #Data encoding (molecule, hex, bigints) · Sources (2) · 2026-10-09

Reserve co-signer witness space before completeFeeBy in multi-signer CCC transactionsWorkingReproduced

When a CCC transaction has inputs locked by several secp256k1 signers but the fee is paid by one, call tx.prepareSighashAllWitness(coSignerLock, 65, client) for each co-signer before tx.completeFeeBy(payer, feeRate). Otherwise the fee is estimated without their signature witnesses and may come out short. Each co-signer must own at least one input to have a script group to sign.

#Transaction building and fees #Witnesses and signatures · Sources (1) · 2026-10-06

Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. JSON · Want a lesson changed or removed? Open an issue.