H4: Use BIP-341 NUMS point as unspendable Taproot internal key for V3+#914
Merged
Conversation
Add CreateUnspendableInternalKeyV2() using the well-known BIP-341 NUMS point (0x50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0) which is provably unspendable because no one knows its discrete log. BuildTaprootSpendInfo now accepts a projectVersion parameter: - V3+: uses the NUMS point (cryptographically guaranteed unspendable) - V1/V2: uses the legacy derived internal key (backward compatible) This prevents any possibility of spending via the key path in Taproot outputs, ensuring funds can only be spent via the script path as intended.
dangershony
approved these changes
Jul 4, 2026
dangershony
approved these changes
Jul 7, 2026
dangershony
left a comment
Member
There was a problem hiding this comment.
We need to make sure the version is used in later upgrade right?
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
Use the well-known BIP-341 NUMS (Nothing Up My Sleeve) point as the Taproot internal key for V3+ projects, making the key path provably unspendable.
Problem
The current implementation derives the internal key from project data. While it was intended to be unspendable, there's no cryptographic guarantee — a flaw in the derivation logic or a future refactor could accidentally make it spendable, allowing funds to bypass the script path.
Solution
For V3+ projects, use the standard NUMS point from BIP-341:
0x50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0This point is the SHA-256 hash of the Generator point G interpreted as a public key. No one can know its discrete logarithm, so the key path is cryptographically guaranteed to be unspendable.
Changes
CreateUnspendableInternalKeyV2()returning the NUMSTaprootInternalPubKeyBuildTaprootSpendInfonow acceptsprojectVersionparameterTesting
All 154 shared tests pass.