CKB Pulse

全部经验 · Wallets and signing · 从这里开始 · 术语表

Proving control of any CKB lock by running the lock on a signed unsent template transaction实践来自一次修复

来自一次修复 · 核对结果:正确 · 核对于 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.

为什么重要: 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.

代码模式

推荐
signer.signOnlyTransaction(await signer.prepareTransaction(ccc.Transaction.from(template)))

摘自提交,已缩短。

概念
Witnesses and signatures, Login and authorization
证据
来自一次修复: 来自一个项目,已对照其提交核对
首次出现
2026-11-21
最近改动
2026-11-21
最近核对
2026-11-23
对照提交的核对结果
正确:这条经验出自该提交,并且在今天的代码中仍然成立

来源(1)

更多关于Wallets and signing

查看此主题的全部 24 条

你维护这条经验的来源项目吗?请确认或纠正

引用这条经验
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.

取自公开提交,并对照每条经验的来源提交和项目当前代码做了核对。使用前请先读来源。 文本采用 CC BY 4.0:请署名 LusoCryptoLabs, CKB lessons,并附上经验的链接。 想修改或撤下某条经验?请提交 issue。