Skip to content

BIP362: Output Public Key Exposure Classification - #2294

Open
duncan0k wants to merge 37 commits into
bitcoin:masterfrom
duncan0k:bip-output-pubkey-exposure-classification
Open

duncan0k wants to merge 37 commits into
bitcoin:masterfrom
duncan0k:bip-output-pubkey-exposure-classification

Conversation

@duncan0k

@duncan0k duncan0k commented Sep 18, 2026 •

Copy link
Copy Markdown

This Informational BIP defines four exposure levels for Bitcoin outputs: EXPOSED_AT_REST, EXPOSED_ON_SPEND, NOT_EXPOSED and UNDETERMINED. They assume an adversary who can compute discrete logarithms on secp256k1, for example with a cryptographically relevant quantum computer. The first two apply BIP 360's long and short exposure to single outputs. The BIP specifies what BIP 360's list of output types leaves open: what counts as revealed, which other outputs a disclosure exposes, and what to report when chain data is missing. It also has test vectors and an informative appendix of per-level actions that a wallet team asked for.

It changes no consensus, policy or P2P rule and proposes no freezing or forced migration.

Discussion:

Reference implementation and test vectors (BSD-2-Clause or CC0-1.0): https://github.com/duncan0k/pubkey-exposure-classification

The Changelog section lists the changes in each version.

@murchandamus murchandamus left a comment

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.

I’m on the fence whether it is necessary to document this classification, but I’m open to be convinced by reviewers stating their support for publication of this document.

Either way, this document is needlessly wordy — it reads more like an essay than a technical proposal. Please use shorter sentences, cut unnecessary framing, prefer direct statements, and drop unnecessary narrative. Aim for a concise technical writing style assuming a technically competent audience.

@murchandamus murchandamus added the PR Author action required Needs updates, has unaddressed review comments, or is otherwise waiting for PR author label Sep 23, 2026
…D; drop naming note from Specification (v0.6.0)
@duncan0k

Copy link
Copy Markdown
Author

Thanks for the review. v0.6.0 is pushed (2183bf5):

  • Rewrote the text for length. The prose went from about 4,700 words to 3,000, the Motivation has no narrative left, and each Rationale entry is a few sentences.
  • EXPOSED_ON_SPEND now covers outputs that pay the same script, as you described: the window opens when a spend of any of them is broadcast and closes when the spend of the last one is confirmed. Once a confirmed spend has published the key, the rest are EXPOSED_AT_REST under the derived condition. The Appendix A floor for that level now says to spend every output on the script in one transaction.
  • Removed the naming note from the Specification; the discussion stays in Rationale.

While tightening the text I also cleaned up a few edge cases around spend paths that need no signature. The draft no longer claims that every P2MR leaf needs a secp256k1 signature, it notes that a depth-zero P2MR tree is spendable by anyone once its leaf is revealed, and the aggregate-count floor is only lowered once every spend of the script has been seen. The Changelog lists these. Test vector outcomes are unchanged.

@duncan0k

Copy link
Copy Markdown
Author

@murchandamus v0.6.0 (2183bf5) went up on the 24th with the changes from your review. The text is down to about 3,000 words, EXPOSED_ON_SPEND now covers outputs that share a script, and the naming note is out of the Specification. Could you take another look when you get a chance? If anything else needs changing, let me know. If not, could the "PR Author action required" label be removed?

@l0vvkey

l0vvkey commented Oct 8, 2026

Copy link
Copy Markdown

I work in BD and support at Gem Wallet, not as a developer, so I can't review the technical details.

I suggested on Delving that each level should come with a simple recommended action, and I'm glad that was added. From a support point of view, if wallets start warning users about quantum risk, it would help if they all gave the same basic advice. Otherwise users get confused when two wallets say different things about the same coins. For that reason, I'd support publishing it.

@duncan0k

duncan0k commented Oct 9, 2026

Copy link
Copy Markdown
Author

cc @conduition, since you replied to the first post on the list. Your point about P2TR outputs without an internal key ended up in the holder-provability note. The draft has changed a fair bit since then and could use a few more eyes, if you feel like taking a look. No pressure either way.

@duncan0k

Copy link
Copy Markdown
Author

@murchandamus @jonatack The changes from the Sep 23 review went in with 2183bf5 on Sep 24. If nothing else is needed from my side, could the PR Author action required label come off?

@murchandamus murchandamus left a comment

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.

Sorry, I was out of the office. Thanks for the update, the new text reads much better.

@murchandamus murchandamus removed the PR Author action required Needs updates, has unaddressed review comments, or is otherwise waiting for PR author label Oct 19, 2026
@zeenix

zeenix commented Oct 19, 2026

Copy link
Copy Markdown

@duncan0k Hi, I’ve posted a companion proposal on wallet transaction construction for EXPOSED_ON_SPEND outputs to bitcoin-dev: https://groups.google.com/g/bitcoindev/c/LcczFuBQjsE (I took the liberty of adding you to CC there, I hope you don't mind). If it ends up as a separate document, would you be open to a cross-reference from Appendix A?

@duncan0k

Copy link
Copy Markdown
Author

@zeenix Sure. Once it has its own document and a stable link, I'm happy to point to it from Appendix A. The floor there is meant to stay minimal and yours covers the full construction rule, so keeping them separate sounds right to me.

@cryptoquick

cryptoquick commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

This is cool

We planned to do work like this before everything fell apart

Helpful messages to users in their wallets about the state of their exposure

I'm supportive of this work but I'm not sure how much heart I have anymore for it

@duncan0k

duncan0k commented Nov 2, 2026

Copy link
Copy Markdown
Author

@jonatack nice to see exposure classification come up on #2340. Is there anything else this one needs before it can get a number? Happy to do another pass if so.

@jonatack jonatack left a comment •

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.

Assigned 362. Please update and add a README entry.

@jonatack jonatack changed the title BIP Draft: Output Public Key Exposure Classification BIP362: Output Public Key Exposure Classification Nov 2, 2026
@duncan0k

duncan0k commented Nov 3, 2026

Copy link
Copy Markdown
Author

Thanks, I'll take that over another pass. Done in fdcc9cb: the file is bip-0362.md now and the README entry is in.

@murchandamus murchandamus left a comment

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.

Thanks for the quick turn-around. Recent changes look good to me, optional nit regarding Changelog.

Comment thread bip-0362.md Outdated
Comment on lines +405 to +411
* 0.6.1 — `NOT_EXPOSED` now requires a post-quantum signature on every spending path, so a hybrid
scheme qualifies, and it takes precedence over `EXPOSED_AT_REST` (review by murch on the pull
request). Shortened the 0.6.0 entry.
* 0.6.0 — Condensed the text; test vector outcomes are unchanged. `EXPOSED_ON_SPEND` now covers
outputs that pay the same script, and its Appendix A floor says to spend them in one transaction.
Removed the naming note from Specification. Review by murch on the pull request. Also clarified
disclosure, the aggregate-count floor and two cases where anyone can spend the output.

@murchandamus murchandamus Nov 3, 2026 •

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: The purpose of the Changelog section is to give readers a quick overview of changes compared to a prior version they implemented or were familiar with. It should focus on changes to the specification or other updates that implementers should be aware of. Who reviewed the document is out of place here, and phrasing improvements that didn’t change the meaning are of peripheral importance. E.g., pruning the most recent two entries, I would suggest the following:

Suggested change
* 0.6.1 — `NOT_EXPOSED` now requires a post-quantum signature on every spending path, so a hybrid
scheme qualifies, and it takes precedence over `EXPOSED_AT_REST` (review by murch on the pull
request). Shortened the 0.6.0 entry.
* 0.6.0 — Condensed the text; test vector outcomes are unchanged. `EXPOSED_ON_SPEND` now covers
outputs that pay the same script, and its Appendix A floor says to spend them in one transaction.
Removed the naming note from Specification. Review by murch on the pull request. Also clarified
disclosure, the aggregate-count floor and two cases where anyone can spend the output.
* 0.6.1 — `NOT_EXPOSED` now requires a post-quantum signature on every spending path. Hybrid
schemes qualify as `NOT_EXPOSED`.
* 0.6.0 — `EXPOSED_ON_SPEND` now covers
outputs that pay the same script, and its Appendix A floor recommends to spend them in one transaction. Clarified
disclosure, the aggregate-count floor, and how to report on anyone-can-spend outputs. Condensed text.

The other entries could be similarly reduced, although much of the Changelog doesn’t seem useful before the document is even published in Draft status.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fair, it was starting to read like closing credits. Trimmed these and the older entries in aaf470e, keeping the precedence over EXPOSED_AT_REST in 0.6.1 since it can change the reported level.

duncan0k and others added 27 commits November 7, 2026 01:05
The derived condition no longer asks whether published keys are 'sufficient to spend' an
output. It matches the hashes an output commits to against the scripts and keys that
confirmed spends revealed. Nothing is rebuilt from keys, so a script that was never
revealed does not match even when all of its keys are published. 'Earlier' is gone: the
order of transactions does not matter. The unused term 'spending key set' is removed, and
the Rationale records the spent-address-only alternative.

Review: bitcoin#2294 (comment)
A published key is matched through the six encodings of the two points with its
x-coordinate, so a key seen uncompressed matches the P2PKH of its compressed form and an
x-only key matches both points. P2WPKH and P2SH-P2WPKH stay in scope alongside P2PKH.

Review: bitcoin#2294 (comment)
No execution trace is needed: a revealed leaf and Merkle path that produce the root match,
whatever the leaf requires. BIP 360 defines no post-quantum opcode, so this cannot
over-report today; the text says it will once a leaf can require one.

Review: bitcoin#2294 (comment)
Such a script is anyone-can-spend once revealed, as murch noted in the thread. The
partial-history exception for it is removed, and the depth-zero P2MR case follows the
same rule.

Review: bitcoin#2294 (comment)
Truncated history with no confirmed spend is UNDETERMINED, as the partial-history rule
already implied. The rule is now stated once: a level other than UNDETERMINED needs its
condition established; a positive count of confirmed spends establishes EXPOSED_AT_REST;
EXPOSED_ON_SPEND needs the derived condition checked against every confirmed transaction,
since the key or script may be published under another scriptPubKey. An address-indexed
source can therefore establish EXPOSED_AT_REST but not EXPOSED_ON_SPEND. The Abstract,
the fail-closed rule, the UNDETERMINED definition and the history vectors follow.

Review: bitcoin#2294 (comment)
The level follows from the leaf and Merkle path a confirmed spend revealed, whatever the
leaf requires and however the spend executed. A second row covers a leaf revealed by a
P2TR spend of the same tree.

Review: bitcoin#2294 (comment)
Each row gives the level of the output in its first column. A published leaf key does not
disclose the P2MR output, since spending it also needs the leaf and path; a key revealed
in a leaf discloses the P2PKH output paying its hash.

Review: bitcoin#2294 (comment)
Both are listed under Out-of-Band Disclosure, where implementations may report them
separately. The Rationale records the reason: a level built on them could not be
reproduced later, and an implementation with less data assigns UNDETERMINED rather than
a different definite level.

Review: bitcoin#2294 (comment)
The advice was already that of EXPOSED_AT_REST; a separate key gained nothing.
TREAT_AS_MIGRATE is removed.

Review: bitcoin#2294 (comment)
P2MR is not deployed and does not affect current estimates. The type table now says that
its row applies where BIP 360 is active.

Review: bitcoin#2294 (comment)
It is normative text, not a quotation.

Review: bitcoin#2294 (comment)
The word meant a level that retrieved transactions cannot lower. The text now says that
directly, in the EXPOSED_AT_REST definition, the partial-history section and the
reference implementation note.

Review: bitcoin#2294 (comment)
A level of EXPOSED_ON_SPEND or NOT_EXPOSED is not evidence that no disclosure has
occurred, and implementations must not report it as such.

Review: bitcoin#2294 (comment)
Drops 'unbounded' and 'floor', and says how the count keeps a truncated scan from
under-reporting: a positive count establishes EXPOSED_AT_REST by itself.

Review: bitcoin#2294 (comment)
"The table above" did not say which table. The paragraph now links to Classification by
Output Type, which starts from the list in BIP 360.

Review: bitcoin#2294 (comment)
'Expose the key' collided with the document's own use of both words. The sentence now uses
the table's term, action key, and says that wallets give the same baseline advice.

Review: bitcoin#2294 (comment)
The column gives the minimum advice for each level and is now named for it. The sentences
that referred to the floor now refer to the table or to the advice.

Review: bitcoin#2294 (comment)
Outputs paid to the script after its first confirmed spend are EXPOSED_AT_REST, so a wallet
should stop handing out the address. The row now says so before the advice for spending.

Review: bitcoin#2294 (comment)
Uses the wording suggested in review, without the clause on hash puzzle scripts: outputs
committing to a revealed script that needs no signature are EXPOSED_AT_REST, so those
scripts have a level. The closing sentence on UNDETERMINED is kept.

Review: bitcoin#2294 (comment)

Co-authored-by: conduition <130806907+conduition@users.noreply.github.com>
It discussed alternative names and how reviewers had read this one. Review threads are the
place for that discussion.

Review: bitcoin#2294 (comment)
Uses the wording suggested in review, unchanged. The paragraph is now titled 'Focus on
attacker capability' and leaves recovery protocols out of scope.

Suggested in review: bitcoin#2294 (comment)

Co-authored-by: conduition <130806907+conduition@users.noreply.github.com>
Uses the wording suggested in review, unchanged. It drops the claims that balance and
dormancy are not observable on-chain and that standardizing makes results comparable.

Suggested in review: bitcoin#2294 (comment)

Co-authored-by: conduition <130806907+conduition@users.noreply.github.com>
Uses the wording suggested in review, without its stray 'the'. It keeps the SHOULD NOT on
describing a destination as NOT_EXPOSED, since no deployed type qualifies.

Review: bitcoin#2294 (comment)

Co-authored-by: conduition <130806907+conduition@users.noreply.github.com>
The claim that adopting software changes only in the conservative direction needed a named
taxonomy to compare against. The claim and its three cases are removed.

Review: bitcoin#2294 (comment)
Each comment from the review of 2026-11-04 now has its own commit. One Changelog entry
summarizes the changes since 0.6.1.
@duncan0k

duncan0k commented Nov 9, 2026

Copy link
Copy Markdown
Author

Each thread from the 2026-11-04 review now has its own commit, and the reply in the thread names it. 9a9def2 sets the version to 0.7.0, replacing the version withdrawn on 2026-11-07, with one Changelog entry covering the changes since 0.6.1. The branch is 30 commits on top of 0.6.1 (aaf470e). I'll update the reference implementation once the text settles.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants