Todas as lições · Wallets and signing · Começa aqui · Glossário
Verifying Neuron style signed messages against a secp256k1_blake160 lockPráticoDe uma correção
De uma correção · Verificação: em parte certa · Verificada em 2026-11-19
To verify a Neuron "Sign Message" signature, hash with CKB Blake2b over UTF-8("Nervos Message:" followed by the text), recover the compressed public key from the 65 byte r||s||v signature (v is 0 or 1, not 27/28), and accept the owner only if the lock has the exact code_hash and hash_type of the secp256k1_blake160 template and its args equal blake160 of the recovered key (comparing args alone is not enough). Neuron signs low-s; if you choose to also accept high-s, normalise s to n minus s and flip v before recovery, because some verify helpers (CCC's) reject high-s.
Porque importa: Without the prefix and CKB Blake2b, recovery returns the wrong key, and comparing args alone lets a matching key claim a lock with a different code_hash or hash_type.
Padrão
return ckbHash(NERVOS_MESSAGE_PREFIX, utf8Encode(text));Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- poshboytl/omavote:
verifier-ts/test/adapter.test.ts,verifier-ts/test/builder.ts,verifier-ts/test/carrier.test.ts,verifier-ts/test/cli.test.ts,verifier-ts/test/input.test.ts - poshboytl/omavote:
crates/omavote-core/tests/scenarios.rs
- Conceitos
- Witnesses and signatures, Data encoding (molecule, hex, bigints)
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-10-08
- Última mudança
- 2026-10-08
- Última verificação
- 2026-11-19
- Verificação contra o commit
- em parte certa: um núcleo verdadeiro, com uma parte solta ou demasiado larga
Fontes (2)
- 2026-10-08 · poshboytl/omavote · mais deste projeto
- 2026-10-08 · poshboytl/omavote · mais deste projeto
Mais sobre Wallets and signing
- Do not detect DER signatures by a leading 0x30 byte
- Omnilock owner signing needs an 85 byte zeroed witness lock placeholder
- JoyID sub key membership is checked through the CoTA aggregator
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Verifying Neuron style signed messages against a secp256k1_blake160 lock", CKB lessons, https://pulse.lusocryptolabs.com/learned/wallets/verifying-neuron-style-signed-messages-against-a-secp256k1-b, CC BY 4.0, last changed 2026-10-08.