CKB Pulse
Lessons

What CKB learned

Start here · Glossary · Test yourself · Feed

toastmanAu/openswap

Lessons from toastmanAu/openswap

github.com/toastmanAu/openswap

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

14 lessons found. All lessons

Page 2 of 2

Deriving minimum cell capacity with ccc.CellOutput.from and output dataWorkingReproduced

In CCC, calling ccc.CellOutput.from({lock, type}, outputData) without a capacity fills capacity with the cell's occupied size, so it serves as the minimum capacity check for change or receipt cells. This commit uses it to reject dust change before and after subtracting the fee (via transaction.estimateFee), and to top up a receipt cell whose received CKB is below its occupied capacity.

#Capacity and cell size #Transaction building and fees · Sources (1) · 2026-10-01

Persist the transaction hash before broadcasting itWorkingFrom one fix

A CKB transaction hash covers the raw transaction but not the witnesses, so after fee completion ccc tx.hash() already gives the final hash before signing. Save that hash to a durable journal before broadcasting, and assert that the hash returned by send equals it. Also assert that signing and preparation did not change the hash, so a rerun after a lost RPC reply waits for the recorded transaction instead of building and sending a duplicate.

#Transaction building and fees #Network and RPC reliability · Sources (1) · 2026-09-18

Page 2 of 2

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.