Skip to content

BIP-0322: clarify motivation/purpose, add prefix, clarify Proof of Funds format, describe PSBT based signing#2141

Merged
jonatack merged 12 commits into
bitcoin:masterfrom
guggero:bip-0322-finalization
May 8, 2026
Merged

BIP-0322: clarify motivation/purpose, add prefix, clarify Proof of Funds format, describe PSBT based signing#2141
jonatack merged 12 commits into
bitcoin:masterfrom
guggero:bip-0322-finalization

Conversation

@guggero
Copy link
Copy Markdown
Contributor

@guggero guggero commented Apr 14, 2026

This PR is an attempt to push this PR forward, hopefully closer to a Complete state.

If it helps the process and @kallewoof agrees, I'm volunteering to be named as a deputy for this BIP.

The PR addresses the following discussion items:

TODO (will follow up with these items soon):

@murchandamus I went through the different discussions you linked and also both Bitcoin Core PRs and tried to extract all discussion items that I felt were not yet addressed.
If anyone feels like a previous discussion item is missing here and not yet addressed by my changes, please comment below!

@jonatack jonatack added Proposed BIP modification PR by non-owner to update BIP content Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified labels Apr 14, 2026
@jonatack
Copy link
Copy Markdown
Member

jonatack commented Apr 14, 2026

Thank you @guggero for picking this up.

If it helps the process and @kallewoof agrees, I'm volunteering to be named as a deputy for this BIP.

@kallewoof thoughts? (If helpful, see BIP3 here for details about the Deputy role.)

Comment thread bip-0322.mediawiki Outdated
Copy link
Copy Markdown
Member

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review of the first three commits.

Comment thread bip-0322.mediawiki Outdated
Comment thread bip-0322.mediawiki Outdated
Comment thread bip-0322.mediawiki Outdated
@kallewoof
Copy link
Copy Markdown
Contributor

Thank you @guggero for picking this up.

If it helps the process and @kallewoof agrees, I'm volunteering to be named as a deputy for this BIP.

@kallewoof thoughts? (If helpful, see BIP3 here for details about the Deputy role.)

Sounds good to me!

@guggero guggero force-pushed the bip-0322-finalization branch 2 times, most recently from f3ffd34 to 7809e72 Compare April 15, 2026 04:47
@guggero
Copy link
Copy Markdown
Contributor Author

guggero commented Apr 15, 2026

I updated the prefixes to be fixed-size (smp, ful, pof) and removed the colon to make copy/paste errors by users less likely.

@murchandamus I don't really understand the failing CI check... Am I supposed to change the background color of the row in the README?

@guggero
Copy link
Copy Markdown
Contributor Author

guggero commented Apr 15, 2026

I've implemented the proposed changes (prefix, Proof of Funds format) in the btcd PR and updated the test vectors here. With that, all (current) TODOs are addressed and I think this PR is ready for a closer look by anyone interested.

Copy link
Copy Markdown
Member

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finished my first pass. I think it’s great that you want to pick up this proposal and bring it up to speed. Strong concept ACK. You also seem to have buy-in from @kallewoof, which is great.
Given the age of the proposal and the breaking change, I would heartily recommend that you write to the mailing list about the changes you are proposing in this PR.

Comment thread bip-0322.mediawiki
Comment thread bip-0322.mediawiki Outdated
Comment thread README.mediawiki
Comment thread bip-0174/type-registry.mediawiki Outdated
Comment thread bip-0322.mediawiki
Copy link
Copy Markdown
Member

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh one more observation:

Comment thread bip-0322.mediawiki
@murchandamus murchandamus added PR Author action required Needs updates, has unaddressed review comments, or is otherwise waiting for PR author BIP Update by Owner PR by Author or Deputy to modify their own BIP and removed Proposed BIP modification PR by non-owner to update BIP content Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified labels Apr 15, 2026
guggero added 7 commits April 20, 2026 09:43
This re-formats the document for easier editing and diff viewing.
Wiki syntax is weird for lists and line wraps break them. Simple lists
were changed to <ul> or <ol> tags but complex lists remain as they are
to not bloat the diff too much.
This fixes small inconsistencies or incomplete definitions based on
previous, already merged changes.
This addresses two discussion items:
 - The list of UTXOs should not be interpreted as a "proof that no other
   UTXOs for an address exist".
 - The BIP only addresses "signer receives funds with the address" and
   not "signer sent a previous transaction" use case.
Since the term "signature" can be pretty overloaded dependin on the
context, we clarify what it actually means in this BIP.
This commit proposes a fix for the problem that an offline verifier
previously was not able to even verify the witness stack of additional
inputs. By providing the full finalized PSBT, a verifier has all the
input data necessary to run the script through the validation engine.

We require the PSBT to be finalized to make sure it contains the final
script witness or final script sig but no extra potentially
privacy-sensitive fields. The Non-Witness and Witness UTXO fields are
explicitly allowed for finalized PSBTs, which makes the format perfect
for the use case.
@guggero guggero force-pushed the bip-0322-finalization branch 2 times, most recently from 78c96cf to 3300b28 Compare April 20, 2026 07:51
@guggero
Copy link
Copy Markdown
Contributor Author

guggero commented Apr 20, 2026

Thank you all for your inputs and reviews so far! As you might already have received in your respective inboxes, my message to the mailing list has been published: https://groups.google.com/g/bitcoindev/c/qd6BNz9gxCk

Comment thread bip-0322.mediawiki Outdated
@murchandamus
Copy link
Copy Markdown
Member

Okay great, let’s revisit in a week or so, on April 28th or later.

@guggero
Copy link
Copy Markdown
Contributor Author

guggero commented Apr 29, 2026

I've updated the PR to define a new PSBT_GLOBAL_GENERIC_SIGNED_MESSAGE = 0x09 field (as suggested by Tomas on the mailing list thread) instead of a per-input one. I also added an UTF-8 message to the test vectors and applied previous fixup commits.

IMO this is good to go now, though more review would still be nice.

@murchandamus
Copy link
Copy Markdown
Member

Thanks for the update. I’m putting this on my queue to read again.
Especially because it is being advanced to Complete, more review would certainly not hurt. I’ll check in with you after reviewing it before merging the PR.

Copy link
Copy Markdown
Member

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. Looks good to me. If you are not currently expecting more review and are finished with your planned work, I would suggest that we publish this update whenever you greenlight that.

Comment thread bip-0322.mediawiki Outdated
guggero added 5 commits May 6, 2026 12:20
This commit proposes a new PSBT input field type for transporting the
message to be signed to different signers in a multisig signing use
case.
This commit updates the test vectors to reflect all the changes in the
previous commits and also introduces new test vectors for the Proof of
Funds variant.
As described in BIP-0003, the comments section is no longer required.
Instead we add all relevant discussions.
@guggero guggero force-pushed the bip-0322-finalization branch from a1f4350 to 40dc3e1 Compare May 6, 2026 10:20
@guggero
Copy link
Copy Markdown
Contributor Author

guggero commented May 6, 2026

ACK. Looks good to me. If you are not currently expecting more review and are finished with your planned work, I would suggest that we publish this update whenever you greenlight that.

Thank you for the re-review! Sounds good to me. I don't have any more work planned and all current review comments are addressed. I'm not aware of any in-progress review.
Still feels weird to merge without @kallewoof's direct approval though. But I leave the decision to you, the BIP maintainers/editors.

@kallewoof
Copy link
Copy Markdown
Contributor

Still feels weird to merge without @kallewoof's direct approval though. But I leave the decision to you, the BIP maintainers/editors.

I've been following the discussion even if I haven't commented. And I personally don't think I have any rights to any of this at this point, seeing as I failed to get this pushed through to adoption myself. I will comment if something looks off to me, of course, but silence is implicit approval.

Copy link
Copy Markdown
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's good that you addressed backward compatibility, as IIUC software already implementing the draft version of BIP322 could break when encountering the new 1-byte prefix. I don't know the current state of existing implementations.

A couple nits follow; they along with a minor grammar round-up could be done in a follow-up.

(If @kallewoof agrees, I think it would make sense @guggero for you to be co-author of BIP322 for your work.)

What is the easiest way for implementers to run the test vectors? By running btcutil/bip322/test_vectors_test.go in btcsuite/btcd#2521?

Comment thread bip-0322.mediawiki
Comment thread bip-0322.mediawiki
resembles a Bitcoin transaction (except that it contains an invalid input, so it cannot be spent on
any real network).

The Proof of Funds variant allows demonstrating control of a set of UTXOs.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is the first mention of the Proof of Funds variant, perhaps introduce it in some way, and/or link to where it is defined below for more details.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly adjusted the wording and linked to the section that explains the variant (in the follow-up PR).

Comment thread bip-0322.mediawiki
|}

<sup>1</sup>: Possible on a technical level but should NOT be used anymore in the context of this BIP.<br/>
<sup>1</sup>: Possible on a technical level but should NOT be used anymore in the context of this
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, might be helpful to briefly describe why

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, to be honest, I'm not 100% sure why this was defined the way it is in the Legacy section, which was already present before my changes. So I just linked to that section to make the footnote more clear in that it refers to that rule.

@jonatack jonatack merged commit 9fce983 into bitcoin:master May 8, 2026
4 checks passed
@kallewoof
Copy link
Copy Markdown
Contributor

(If @kallewoof agrees, I think it would make sense @guggero for you to be co-author of BIP322 for your work.)

Sounds good to me.

@guggero guggero deleted the bip-0322-finalization branch May 8, 2026 06:55
@guggero
Copy link
Copy Markdown
Contributor Author

guggero commented May 8, 2026

@jonatack thanks for the review! I've created the follow-up PR here: #2155

along with a minor grammar round-up

Anything specific you noticed or should I just do a general grammar pass?

What is the easiest way for implementers to run the test vectors?

Yes, checking out and running cd btcutil/bip322; go test -test.run 'Test.*Vectors' ./... is one option.
Another option is to run the tests in btcutil-js that executes the same test vectors using the same Golang code but through a WASM binary.

@jonatack
Copy link
Copy Markdown
Member

jonatack commented May 8, 2026

Yes, checking out and running cd btcutil/bip322; go test -test.run 'Test.*Vectors' ./... is one option.
Another option is to run the tests in btcutil-js that executes the same test vectors using the same Golang code but through a WASM binary.

Thanks, will test!

Anything specific you noticed or should I just do a general grammar pass?

I'll comment on your new PR #2155 with a link to a diff.

Comment thread bip-0322.mediawiki
** Mark Complete
** Breaking change: Add human-readable prefix to encoded signature
** Breaking change: format of "Proof of Funds" signatures to be base64-encoded finalized PSBT
** Add new PSBT input field for PSBT-based signing
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
** Add new PSBT input field for PSBT-based signing
** Add new PSBT global field for PSBT-based signing

Noting here that this entry wasn't updated with the change during PR discussion to PSBT_GLOBAL_GENERIC_SIGNED_MESSAGE; fixed in #2162.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BIP Update by Owner PR by Author or Deputy to modify their own BIP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants