Skip to content

Sign a Taproot commit and its reveal as one bundle - #8

Merged
droplister merged 1 commit into
masterfrom
commit-and-reveal
Sep 30, 2026
Merged

droplister merged 1 commit into
masterfrom
commit-and-reveal

Conversation

@droplister

Copy link
Copy Markdown
Member

Client support for XCP Wallet 0.14.1's commit-and-reveal bundle.

  • src/provider/commit-reveal.ts: commitAndRevealRequest(params) builds xcp_signPsbts [{ requests: [commit, reveal] }] (same envelope signPsbts uses). Commit: signInputs: { [source]: every input }, ALL per input (or DEFAULT from a P2TR source), intent = caller's marketplace intent or { standard: 'counterparty-reveal', version: 1, action: 'fund_commit' }. Reveal: signInputs: { [source]: [0] }, [0x00] (default) or [0x01], intent exactly sign_reveal. Refuses early (invalid_argument) a non-P2WPKH/P2TR source, a reveal that is not one input spending commit output 0 with one tapleaf, a missing CNTRPRTY marker, or out-of-contract sighashes. PSBT bytes are sent as given, not re-serialized.
  • XcpWallet.signCommitAndReveal, WalletSession.signCommitAndReveal, useWallet().signCommitAndReveal: capability-gated on marketplaceBundles including commit-and-reveal (capability/unsupported otherwise, including wallets with no report); returns { commit, reveal } signed PSBT hexes, each bound to its request (transaction_mismatch).
  • finalizeCommitAndReveal: finalizes the commit and writes the reveal witness [sig, leaf, control block] (btc-signer cannot finalize an envelope leaf), checking the signature's leaf hash and that the reveal spends the commit.
  • assertProviderCanSignPsbts recognizes the pair (second intent sign_reveal): commit under the batch contract, reveal by its own rule, so a SegWit source's DEFAULT reveal is not refused by the batch sighash list.
  • docs/commit-and-reveal.md, README, CHANGELOG.

Tests (mocked provider, real PSBTs built with btc-signer): exact wire request, marketplace intent and sighash options, capability refusals, local refusals with no wallet call, answer binding, signPsbts path, finalization of a really signed pair.

Local gates: check (tsc + biome, pre-existing warnings only), 345 tests passed, build ok.

Core 11.5 returns an unsigned reveal the source key must sign. XCP Wallet
0.14.1 signs both halves in one xcp_signPsbts approval as a
commit-and-reveal bundle. signCommitAndReveal sends that pair only to a
wallet that lists the kind, refuses early what the wallet would refuse,
binds the signed PSBTs to the request, and finalizeCommitAndReveal builds
the reveal's script-path witness.
@droplister
droplister merged commit 7f1130e into master Sep 30, 2026
@droplister
droplister deleted the commit-and-reveal branch September 30, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant