CKB Pulse

Todas as lições · Wallets and signing · Começa aqui · Glossário

Proving control of any CKB lock by running the lock on a signed unsent template transactionPráticoDe uma correção

De uma correção · Verificação: certa · Verificada em 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.

Porque importa: 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.

Padrão

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

Tirado do commit, encurtado.

Conceitos
Witnesses and signatures, Login and authorization
Evidência
De uma correção: de um projeto, verificada contra o commit
Vista pela primeira vez
2026-11-21
Última mudança
2026-11-21
Última verificação
2026-11-23
Verificação contra o commit
certa: a lição sai do commit e continua a valer no código de hoje

Fontes (1)

Mais sobre Wallets and signing

Ver as 24 deste tema

Manténs um projeto de onde esta lição veio? Confirma ou corrige

Citar esta lição
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.

Tiradas de commits públicos e verificadas contra o commit de onde cada uma veio e o código de hoje do projeto. Lê a fonte antes de confiar numa. Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. Queres que uma lição seja mudada ou retirada? Abre um issue.