feat: add P2MR fixed-script wallet integration#247
Open
lcovar wants to merge 1 commit intoBTC-3241-bip360-p2mr-supportfrom
Open
feat: add P2MR fixed-script wallet integration#247lcovar wants to merge 1 commit intoBTC-3241-bip360-p2mr-supportfrom
lcovar wants to merge 1 commit intoBTC-3241-bip360-p2mr-supportfrom
Conversation
Add P2MR as a new script type in the fixed-script wallet system, mirroring the P2TR legacy pattern but without internal key or tweak. Wallet script generation: - ScriptP2mr: 3-leaf tree (user+bitgo, user+backup, backup+bitgo) using same 2-of-2 checksigverify leaf scripts as P2TR - OutputScriptType::P2mr with chain values 50/51 - Reuses existing build_p2tr_ns_script for leaf scripts and crate::p2mr::build_p2mr_tree for tree construction PSBT/signing stubs: - P2MR input signing returns "not yet supported" error - P2MR outputs need no extra PSBT metadata (no tap_internal_key) - BIP-322 P2MR returns "not yet supported" error Dimensions: - P2MR witness size calculation (1 + 32*depth control blocks, no 32-byte internal key unlike P2TR) - Primary spend at depth 1, recovery paths at depth 2 Fixture tests verify merkle root, output script, and control blocks for 2 pubkey triples with different key orderings. BTC-3241
8ed1ed5 to
1698651
Compare
OttoAllmendinger
requested changes
Apr 8, 2026
| OutputScriptType::P2wsh => 20, | ||
| OutputScriptType::P2trLegacy => 30, | ||
| OutputScriptType::P2trMusig2 => 40, | ||
| OutputScriptType::P2mr => 50, |
Contributor
There was a problem hiding this comment.
Suggested change
| OutputScriptType::P2mr => 50, | |
| OutputScriptType::P2mr => 360, |
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.
Stacked on #246
Add P2MR as a new script type in the fixed-script wallet system,
mirroring P2TR legacy but without internal key or tweak.
OutputScriptType::P2mrwith chain values 50/51ScriptP2mr: 3-leaf tree (user+bitgo, user+backup, backup+bitgo)using same 2-of-2 checksigverify scripts as P2TR
control blocks, depth assertions, chain value round-trips)
BTC-3241