CKB Pulse

All lessons · Wallets and signing · Start here · Glossary

Proving control of any CKB lock by running the lock on a signed unsent template transactionWorkingFrom one fix

From one fix · Check: right · Checked 2026-11-23

To prove a user controls any CKB lock that signs the transaction hash, have the wallet sign an unsent template transaction whose input carries that lock and whose content binds the login message. That input is a constructed outpoint, so the transaction can never be committed. In CCC this is signer.signOnlyTransaction(await signer.prepareTransaction(tx)). The backend then rebuilds the template from the lock and message, reads the lock's cell deps live from the chain, and runs the lock in CKB-VM with ckb-script. This works for secp256k1, multisig, anyone-can-pay, PW-lock, Nostr and Omnilock EVM, BTC or Dogecoin signers without moving anything on chain.

Why it matters: Checking a signed message per wallet type only covers the signature schemes you hand-code, while running the real lock on a signed template accepts every lock that signs the transaction hash and refuses wrong keys or flipped signatures exactly as the chain would.

The base already has hardening rules for lock based sign in proofs (live deps, empty witness probe, fake inputs), but none teaching the core technique of signing an unsent template transaction and running the lock off chain.

Pattern

Prefer
signer.signOnlyTransaction(await signer.prepareTransaction(ccc.Transaction.from(template)))

Taken from the commit, shortened.

Concepts
Witnesses and signatures, Login and authorization
Evidence
From one fix: from one project, checked against its commit
First seen
2026-11-21
Last changed
2026-11-21
Last checked
2026-11-23
Check against the commit
right: the lesson follows from its commit and still holds in the code today

Sources (1)

More about Wallets and signing

All 24 in this topic

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

Cite this lesson
LusoCryptoLabs, "Proving control of any CKB lock by running the lock on a signed unsent template transaction", CKB lessons, https://pulse.lusocryptolabs.com/learned/wallets/proving-control-of-any-ckb-lock-by-running-the-lock-on-a-sig, CC BY 4.0, last changed 2026-11-21.

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.