mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:44:38 +00:00
rpc, wallet: Support BIP322 simple message signing #36809
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36809
Loading…
Reference in a new issue
No description provided.
Delete branch "bip322-segwit"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The message RPCs currently support legacy compact signatures for P2PKH addresses. This adds BIP322 simple proofs for native P2WPKH, P2WSH and P2TR addresses, allowing users to sign and verify messages for these addresses without creating an on-chain transaction.
signmessage uses the wallet’s existing descriptor signing machinery and requires a complete satisfaction. This includes P2WSH multisig and supported Miniscript satisfactions, and Taproot key and script paths. It returns smp followed by the base64-encoded serialized witness stack.
verifymessage uses Core’s script interpreter to check the proof against the address and message. Verification requires no wallet or chain data and accepts both prefixed and older unprefixed simple proofs. Malformed base64 or witness serialization raises an RPC error; invalid proofs, unsupported signature formats and inconclusive results return false.
The RPC names and argument counts are unchanged. P2PKH compact signatures and signmessagewithprivkey retain their existing behavior. Full signatures, proofs of funds and P2SH addresses, including wrapped SegWit, are outside this change. Signing remains limited to satisfactions available to the wallet.
No consensus rules or signing-provider interfaces are changed. Help and release notes describe the supported formats and limitations.
Related earlier work: #24058.
Tests
A shared fixture imports the applicable CC0 vectors from the pinned BIP: eight simple rows containing ten proofs, three hash cases and sixteen error cases. Published proofs are checked independently of locally generated signatures.
Coverage includes:
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.
Conflicts
Reviewers, this pull request conflicts with the following ones:
src/test/fuzzand treat them as errors by hebasto)If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
LLM Linter (✨ experimental)
Possible places where named args for integral literals may be used (e.g.
func(x, /*named_arg=*/0)in C++, andfunc(x, named_arg=0)in Python):src/test/bip322_tests.cpp:SignatureHash(script, txs.to_sign, 0, hash_type, 0, SigVersion::WITNESS_V0)src/test/bip322_tests.cpp:SignatureHashSchnorr(hash, exec, txs.to_sign, 0, hash_type, ...)src/test/bip322_tests.cpp(OrdinaryVerify):data.Init(tx, {txs.to_spend.vout[0]}, true)src/test/bip322_tests.cpp(SignSchnorr):data.Init(txs.to_sign, {txs.to_spend.vout[0]}, true)src/test/bip322_tests.cpp:MakeTapProof(CScript() << OP_1, {}, 0xc2)src/test/bip322_tests.cpp:MakeTapProof(CScript() << OP_CODESEPARATOR, {}, 0xc2)src/wallet/test/bip322_wallet_tests.cpp(musig_nonce_lifetime):data.Init(tx, {txs.to_spend.vout[0]}, true)src/wallet/test/bip322_wallet_tests.cpp(forbidden_script_commitments):data.Init(tx, {txs.to_spend.vout[0]}, true)2026-11-09 16:07:24
🔵 Suggestion · Fully keyed BIP322 failures report missing private keys
An unlocked wallet can receive
Private key not availabledespite holding all needed keys when its only spending path requires an incompatible timelock or a MuSig2 session that one-shot signing cannot complete.Location:
src/wallet/wallet.cpp:2093(head).🔵 Suggestion · GUI messages still describe SegWit signing as unsupported in this version
The unchanged Qt dialog rejects BIP322 proofs produced by the RPC while still describing SegWit message signing as unsupported in this version.
Location:
src/rpc/signmessage.cpp:49(head).🔵 Suggestion · Non-upgrade BIP322 failures repeat signature verification
When the combined pass fails with a non-
DISCOURAGE_*error, the required-only retry repeats the same script execution and uncached signature checks without changing the result.Location:
src/common/signmessage.cpp:238(head).🔵 Suggestion · Message-proof script disclosure is undocumented
Sharing a P2WSH proof or a Taproot proof produced through script fallback reveals script data that the new
signmessagehelp and release notes do not describe.Location:
src/wallet/rpc/signmessage.cpp:25(head).🔵 Suggestion · Opaque Taproot leaves lack a fuzz classification oracle
The new script-derived fuzz branch ignores verification outcomes, so it cannot detect incorrect classification of opaque Taproot leaves even though the generator supplies matching commitments.
Location:
src/test/fuzz/message.cpp:105(head).Review coverage was incomplete.
Reviewed:
48749389577f· Review report · Previous reportspermalink
🚧 At least one of the CI tasks failed.
Task
lint: https://github.com/bitcoin/bitcoin/actions/runs/42548857757/job/128939706261LLM reason (✨ experimental): CI failed because the locale-dependence lint flagged
std::to_stringinsrc/wallet/test/bip322_wallet_tests.cpp.Hints
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
🐙 This pull request conflicts with the target branch and needs rebase.