CKB Pulse

All lessons · Wallets and signing · Start here · Glossary

Verifying Neuron style signed messages against a secp256k1_blake160 lockWorkingFrom one fix

From one fix · Check: partly right · Checked 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.

Why it matters: 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.

Pattern

Prefer
return ckbHash(NERVOS_MESSAGE_PREFIX, utf8Encode(text));

Taken from the commit, shortened.

A test changed in the same commit

It sits next to the fix. We did not run it.

Concepts
Witnesses and signatures, Data encoding (molecule, hex, bigints)
Evidence
From one fix: from one project, checked against its commit
First seen
2026-10-08
Last changed
2026-10-08
Last checked
2026-11-19
Check against the commit
partly right: a true core, with a part that is loose or too wide

Sources (2)

More about Wallets and signing

All 23 in this topic

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

Cite this lesson
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.

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.