#1969: signing/verifying a message and explorer parser typo#2036
Open
Maxnflaxl wants to merge 5 commits into
Open
#1969: signing/verifying a message and explorer parser typo#2036Maxnflaxl wants to merge 5 commits into
Maxnflaxl wants to merge 5 commits into
Conversation
core/version.h is generated into the build dir by CMake (core/version.h.in); the committed copy is an in-source build artifact (it hardcodes a stale version) and no translation unit references it. make_all.sh / make_shader.sh are shader build helpers that don't belong in this PR.
The address-based sign_message / verify_message digest is now
H("beam.signed.message" | pubkey | len | message) instead of
H("beam.signed.message" | len | message). Folding the WalletID public key
into the hash makes the Schnorr challenge key-dependent (as in BIP-340 and
Monero), binding each signature to exactly one address and preventing
related-key signature malleability; the fixed-width framing also removes the
ambiguous decimal length.
The legacy key_material path and verify_signature keep the previous
key-independent digest for backward compatibility.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds message signing & verification (#1969): a wallet can sign an arbitrary
message with one of its own addresses to prove ownership, and anyone can verify
that signature against the address. Exposed on both the wallet CLI and the
wallet API (v7.4). Also fixes an explorer parser typo.
Wallet CLI
sign_message --message "<msg>" [--address <addr|*>]<msg>with one of your own addresses (--addressdefaults to*, the wallet's default address). Reads the signing key from the wallet, so it needs the wallet DB — but no node. PrintsSignature:(hex) andAddress:(the SBBS WalletID) to hand to the verifier.verify_message --address <WalletID> --message "<msg>" --signature <hex>Good signature from …/Invalid signature from …and sets the exit code.Wallet API (v7.4)
sign_message— reworked to sign with an own address: paramaddress(preferred) instead of raw key material. The old
key_materialparam is stillaccepted for backward compatibility (deprecated); if neither is given, the
default address is used. Returns
{ "signature": "<hex>" }.verify_message(new) — paramsaddress(WalletID),message,signature; returns{ "is_valid": <bool> }.verify_signature— unchanged; verifies against a rawpublic_key,returns
{ "result": <bool> }.Protocol
CLI and API produce identical signatures, so a signature made by one verifies with the other.
hv = H("beam.signed.message" | pubkey | len | message)—His Beam's SHA-256Hash::Processor,pubkeyis the signer's 32-byte x-only WalletID key, andlenis a width-independent varint. The fixed-width tag and key plus the explicit length make the encoding unambiguous.get_SbbsPeerID) — the key behind the WalletID — so a valid signature proves control of that address.ECC::Signature) overhv, with a hedged nonce (secret key + message + fresh randomness).address.m_Pk.CheckSignature(hv, sig)— pure crypto; needs neither the wallet DB nor a node.Binding the public key into the digest ties each signature to exactly one address — as in Bitcoin's address-recovery check and Monero's key-prefixed challenge — which prevents related-key signature malleability. Messages carry no replay/context binding, so anything using these signatures for authentication should embed a fresh challenge or context string in the message.
The legacy
key_materialform ofsign_messageand its counterpartverify_signaturekeep the original key-independent digest for backward compatibility.Explorer fix
Corrected the AMM/DEX pool table header
Rate 2:2→Rate 2:1in the richparser and rebuilt
Parser.wasm.Docs
Wallet API v7.4 reference: https://github.com/BeamMW/beam/wiki/Beam-wallet-protocol-API-v7.4