2026-02-11 12:54:26 -08:00
{
"version" : 1 ,
"test_vectors" : [
{
2026-06-26 13:14:27 -06:00
"id" : "p2mr_misuse_v2_witness_version_with_pubkey_error" ,
"objective" : "Tests that P2MR fails with use of internal_pubkey" ,
2026-02-11 12:54:26 -08:00
"given" : {
"internalPubkey" : "d6889cb081036e0faefa3a35157ad71086b123b2b144b649798b494c300a961d" ,
"scriptTree" : null
},
"intermediary" : {
"merkleRoot" : null ,
"tweak" : "b86e7be8f39bab32a6f2c0443abbc210f0edac0e2c53d501b36b64437d9c6c70" ,
"tweakedPubkey" : "53a1f6e454df1aa2776a2814a721372d6258050de330b3c6d10ee8f4e0dda343"
},
"expected" : {
"scriptPubKey" : "522053a1f6e454df1aa2776a2814a721372d6258050de330b3c6d10ee8f4e0dda343" ,
2026-06-26 13:14:27 -06:00
"error" : "P2MR does not support internal pubkeys"
2026-02-11 12:54:26 -08:00
}
},
{
2026-06-28 20:33:31 -06:00
"id" : "p2mr_null_or_missing_script_tree_error" ,
2026-06-26 13:14:27 -06:00
"objective" : "Tests P2MR with null or missing script tree" ,
2026-02-11 12:54:26 -08:00
"given" : {
"script_tree" : ""
},
"intermediary" : {
},
"expected" : {
"error" : "P2MR requires a script tree with at least one leaf"
}
},
{
"id" : "p2mr_single_leaf_script_tree" ,
"objective" : "Tests P2MR with single leaf script tree" ,
"given" : {
"scriptTree" : {
"id" : 0 ,
"script" : "20b617298552a72ade070667e86ca63b8f5789a9fe8731ef91202a91c9f3459007ac" ,
"asm" : "b617298552a72ade070667e86ca63b8f5789a9fe8731ef91202a91c9f3459007 OP_CHECKSIG" ,
"leafVersion" : 192
}
},
"intermediary" : {
"leafHashes" : [
"c525714a7f49c28aedbbba78c005931a81c234b2f6c99a73e4d06082adc8bf2b"
],
"merkleRoot" : "c525714a7f49c28aedbbba78c005931a81c234b2f6c99a73e4d06082adc8bf2b"
},
"expected" : {
"scriptPubKey" : "5220c525714a7f49c28aedbbba78c005931a81c234b2f6c99a73e4d06082adc8bf2b" ,
"bip350Address" : "bc1zc5jhzjnlf8pg4mdmhfuvqpvnr2quyd9j7mye5uly6psg9twghu4ssr0v9k" ,
"scriptPathControlBlocks" : [
"c1"
]
}
},
{
"id" : "p2mr_different_version_leaves" ,
2026-04-22 10:35:07 -06:00
"objective" : "Tests P2MR with two script leaves of different versions. An unknown leaf version should be accepted and the P2MR output constructed successfully." ,
2026-02-11 12:54:26 -08:00
"given" : {
"scriptTree" : [
{
"id" : 0 ,
"script" : "20387671353e273264c495656e27e39ba899ea8fee3bb69fb2a680e22093447d48ac" ,
"asm" : "387671353e273264c495656e27e39ba899ea8fee3bb69fb2a680e22093447d48 OP_CHECKSIG" ,
"leafVersion" : 192
},
{
"id" : 1 ,
"script" : "06424950333431" ,
"asm" : "424950333431" ,
"description" : "just pushes the string 'BIP341' onto the stack" ,
"leafVersion" : 250
}
]
},
"intermediary" : {
"leafHashes" : [
"8ad69ec7cf41c2a4001fd1f738bf1e505ce2277acdcaa63fe4765192497f47a7" ,
"f224a923cd0021ab202ab139cc56802ddb92dcfc172b9212261a539df79a112a"
],
"merkleRoot" : "6c2dc106ab816b73f9d07e3cd1ef2c8c1256f519748e0813e4edd2405d277bef"
},
"expected" : {
"scriptPubKey" : "52206c2dc106ab816b73f9d07e3cd1ef2c8c1256f519748e0813e4edd2405d277bef" ,
"bip350Address" : "bc1zdskuzp4ts94h87ws0c7drmev3sf9dagewj8qsylyahfyqhf800hsam4d6e" ,
"scriptPathControlBlocks" : [
"c1f224a923cd0021ab202ab139cc56802ddb92dcfc172b9212261a539df79a112a" ,
2026-04-30 10:03:53 -06:00
"fb8ad69ec7cf41c2a4001fd1f738bf1e505ce2277acdcaa63fe4765192497f47a7"
2026-02-11 12:54:26 -08:00
]
}
},
{
"id" : "p2mr_simple_lightning_contract" ,
"objective" : "Tests P2MR with two script leaves that simulate a simple lightning network contract. Reference: https://github.com/bitcoin-core/btcdeb/blob/master/doc/tapscript-example-with-tap.md" ,
"given" : {
"scriptTree" : [
{
"id" : 0 ,
"script" : "029000b275209997a497d964fc1a62885b05a51166a65a90df00492c8d7cf61d6accf54803beac" ,
"asm" : "144 OP_CHECKSEQUENCEVERIFY OP_DROP 9997a497d964fc1a62885b05a51166a65a90df00492c8d7cf61d6accf54803be OP_CHECKSIG" ,
"description" : "Alice takes the money after waiting 1 day" ,
"leafVersion" : 192
},
{
"id" : 1 ,
"script" : "a8206c60f404f8167a38fc70eaf8aa17ac351023bef86bcb9d1086a19afe95bd533388204edfcf9dfe6c0b5c83d1ab3f78d1b39a46ebac6798e08e19761f5ed89ec83c10ac" ,
"asm" : "OP_SHA256 6c60f404f8167a38fc70eaf8aa17ac351023bef86bcb9d1086a19afe95bd5333 OP_EQUALVERIFY 4edfcf9dfe6c0b5c83d1ab3f78d1b39a46ebac6798e08e19761f5ed89ec83c10 OP_CHECKSIG" ,
"description" : "Bob takes the money whenever he wishes to by revealing the preimage_hash" ,
"leafVersion" : 192
}
]
},
"intermediary" : {
"leafHashes" : [
"c81451874bd9ebd4b6fd4bba1f84cdfb533c532365d22a0a702205ff658b17c9" ,
"632c8632b4f29c6291416e23135cf78ecb82e525788ea5ed6483e3c6ce943b42"
],
"merkleRoot" : "41646f8c1fe2a96ddad7f5471bc4fee7da98794ef8c45a4f4fc6a559d60c9f6b"
},
"expected" : {
"scriptPubKey" : "522041646f8c1fe2a96ddad7f5471bc4fee7da98794ef8c45a4f4fc6a559d60c9f6b" ,
"bip350Address" : "bc1zg9jxlrqlu25kmkkh74r3h387uldfs72wlrz95n60c6j4n4svna4s4lhfhe" ,
"scriptPathControlBlocks" : [
2026-04-03 18:38:43 -06:00
"c1632c8632b4f29c6291416e23135cf78ecb82e525788ea5ed6483e3c6ce943b42" ,
"c1c81451874bd9ebd4b6fd4bba1f84cdfb533c532365d22a0a702205ff658b17c9"
2026-02-11 12:54:26 -08:00
]
}
},
{
"id" : "p2mr_two_leaf_same_version" ,
"objective" : "Tests P2MR with two script leaves of same version" ,
"given" : {
"scriptTree" : [
{
"id" : 0 ,
"script" : "2044b178d64c32c4a05cc4f4d1407268f764c940d20ce97abfd44db5c3592b72fdac" ,
"asm" : "44b178d64c32c4a05cc4f4d1407268f764c940d20ce97abfd44db5c3592b72fd OP_CHECKSIG" ,
"leafVersion" : 192
},
{
"id" : 1 ,
"script" : "07546170726f6f74" ,
"asm" : "546170726f6f74" ,
"description" : "pushes the string 'Taproot' onto the stack" ,
"leafVersion" : 192
}
]
},
"intermediary" : {
"leafHashes" : [
"64512fecdb5afa04f98839b50e6f0cb7b1e539bf6f205f67934083cdcc3c8d89" ,
"2cb2b90daa543b544161530c925f285b06196940d6085ca9474d41dc3822c5cb"
],
"merkleRoot" : "ab179431c28d3b68fb798957faf5497d69c883c6fb1e1cd9f81483d87bac90cc"
},
"expected" : {
"scriptPubKey" : "5220ab179431c28d3b68fb798957faf5497d69c883c6fb1e1cd9f81483d87bac90cc" ,
"bip350Address" : "bc1z4vtegvwz35ak37me39tl4a2f045u3q7xlv0pek0czjpas7avjrxqz20g2y" ,
"scriptPathControlBlocks" : [
"c12cb2b90daa543b544161530c925f285b06196940d6085ca9474d41dc3822c5cb" ,
"c164512fecdb5afa04f98839b50e6f0cb7b1e539bf6f205f67934083cdcc3c8d89"
]
}
},
{
"id" : "p2mr_three_leaf_complex" ,
"objective" : "Tests P2MR with a complex three-leaf script tree structure, demonstrating nested script paths and multiple verification options" ,
"given" : {
"scriptTree" : [
{
"id" : 0 ,
"script" : "2072ea6adcf1d371dea8fba1035a09f3d24ed5a059799bae114084130ee5898e69ac" ,
"asm" : "72ea6adcf1d371dea8fba1035a09f3d24ed5a059799bae114084130ee5898e69 OP_CHECKSIG" ,
"leafVersion" : 192
},
[
{
"id" : 1 ,
"script" : "202352d137f2f3ab38d1eaa976758873377fa5ebb817372c71e2c542313d4abda8ac" ,
"asm" : "2352d137f2f3ab38d1eaa976758873377fa5ebb817372c71e2c542313d4abda8 OP_CHECKSIG" ,
"leafVersion" : 192
},
{
"id" : 2 ,
"script" : "207337c0dd4253cb86f2c43a2351aadd82cccb12a172cd120452b9bb8324f2186aac" ,
"asm" : " 7337 c 0 dd 4253 cb 86 f 2 c 43 a 2351 aadd 82 cccb 12 a 172 cd 120452 b 9 bb 8324 f 2186 a OP_CHECKSIG ",
" leafVersion ": 192
}
]
]
},
" intermediary ": {
" leafHashes ": [
" 2645 a 0 2e0 aac 1 fe 69 d 69755733 a 9 b 7621 b 694 bb 5 b 5 cde 2 bbfc 94066 ed 62 b 9817 ",
" ba 982 a 91 d 4 fc 552163 cb 1 c 0 da 03676102 d 5 b 7 a 014304 c 01 f 0 c 77 b 2 b 8e888 de 1 c ",
" 9e31407 bffa 15 fefbf 5090 b 149 d 53959 ecdf 3 f 62 b 1246780238 c 24501 d 5 ceaf 6 "
],
" merkleRoot ": " ccbd 66 c 6 f 7e8 fdab 47 b 3 a 486 f 59 d 28262 be 857 f 30 d 4773 f 2 d 5 ea 47 f 7761 ce 0e2 "
},
" expected ": {
" scriptPubKey ": " 5220 ccbd 66 c 6 f 7e8 fdab 47 b 3 a 486 f 59 d 28262 be 857 f 30 d 4773 f 2 d 5 ea 47 f 7761 ce 0e2 ",
" bip 350 Address ": " bc 1 zej 7 kd 3 hhar 76 k 3 an 5 jr 0 t 8 fgyc 47 s 4 lnp 4 rh 8 uk 4 afrlwasuur 3 qzgewqq ",
" scriptPathControlBlocks ": [
" c 1 ffe 578e9 ea 769027e4 f 5 a 3 de 40732 f 75 a 88 a 6353 a 09 d 767 ddeb 66 accef 85e553 ",
2026-04-03 18:38:43 -06:00
" c 19e31407 bffa 15 fefbf 5090 b 149 d 53959 ecdf 3 f 62 b 1246780238 c 24501 d 5 ceaf 62645 a 0 2e0 aac 1 fe 69 d 69755733 a 9 b 7621 b 694 bb 5 b 5 cde 2 bbfc 94066 ed 62 b 9817 ",
" c 1 ba 982 a 91 d 4 fc 552163 cb 1 c 0 da 03676102 d 5 b 7 a 014304 c 01 f 0 c 77 b 2 b 8e888 de 1 c 2645 a 0 2e0 aac 1 fe 69 d 69755733 a 9 b 7621 b 694 bb 5 b 5 cde 2 bbfc 94066 ed 62 b 9817 "
2026-02-11 12:54:26 -08:00
]
}
},
{
" id ": " p 2 mr_three_leaf_alternative ",
" objective ": " Tests another variant of P 2 MR with three leaves arranged in a different tree structure , showing alternative script path spending options ",
" given ": {
" scriptTree ": [
{
" id ": 0,
" script ": " 2071981521 ad 9 fc 9036687364118 fb 6 ccd 2035 b 96 a 423 c 59 c 5430e98310 a 11 abe 2 ac ",
" asm ": " 71981521 ad 9 fc 9036687364118 fb 6 ccd 2035 b 96 a 423 c 59 c 5430e98310 a 11 abe 2 OP_CHECKSIG ",
" leafVersion ": 192
},
[
{
" id ": 1,
" script ": " 20 d 5094 d 2 dbe 9 b 76e2 c 245 a 2 b 89 b 6006888952e2 faa 6 a 149 ae 318 d 69e520617748 ac ",
" asm ": " d 5094 d 2 dbe 9 b 76e2 c 245 a 2 b 89 b 6006888952e2 faa 6 a 149 ae 318 d 69e520617748 OP_CHECKSIG ",
" leafVersion ": 192
},
{
" id ": 2,
" script ": " 20 c 440 b 462 ad 48 c 7 a 77 f 94 cd 4532 d 8 f 2119 dcebbd 7 c 9764557e62726419 b 08 ad 4 cac ",
" asm ": " c 440 b 462 ad 48 c 7 a 77 f 94 cd 4532 d 8 f 2119 dcebbd 7 c 9764557e62726419 b 08 ad 4 c OP_CHECKSIG ",
" leafVersion ": 192
}
]
]
},
" intermediary ": {
" leafHashes ": [
" f 154e8 e 8e17 c 31 d 3462 d 7132589 ed 29353 c 6 fafdb 884 c 5 a 6e04 ea 938834 f 0 d 9 d ",
" 737 ed 1 fe 30 bc 42 b 8022 d 717 b 44 f 0 d 93516617 af 64 a 64753 b 7 a 06 bf 16 b 26 cd 711 ",
" d 7485025 fceb 78 b 9 ed 667 db 36 ed 8 b 8 dc 7 b 1 f 0 b 307 ac 167 fa 516 fe 4352 b 9 f 4 ef 7 "
],
" merkleRoot ": " 2 f 6 b 2 c 5397 b 6 d 68 ca 18e09 a 3 f 05161668 ffe 93 a 988582 d 55 c 6 f 07 bd 5 b 3329 def "
},
" expected ": {
" scriptPubKey ": " 52202 f 6 b 2 c 5397 b 6 d 68 ca 18e09 a 3 f 05161668 ffe 93 a 988582 d 55 c 6 f 07 bd 5 b 3329 def ",
" bip 350 Address ": " bc 1 z 9 a 4 jc 5 uhkmtgegvwpx 3 lq 5 tpv 68 layaf 3 pvz 64 wx 7 paatvejnhhsv 52 lcv ",
" scriptPathControlBlocks ": [
" c 13 cd 369 a 528 b 326 bc 9 d 2133 cbd 2 ac 21451 acb 31681 a 410434672 c 8e34 fe 757e91 ",
2026-04-03 18:38:43 -06:00
" c 1 d 7485025 fceb 78 b 9 ed 667 db 36 ed 8 b 8 dc 7 b 1 f 0 b 307 ac 167 fa 516 fe 4352 b 9 f 4 ef 7 f 154e8 e 8e17 c 31 d 3462 d 7132589 ed 29353 c 6 fafdb 884 c 5 a 6e04 ea 938834 f 0 d 9 d ",
" c 1737 ed 1 fe 30 bc 42 b 8022 d 717 b 44 f 0 d 93516617 af 64 a 64753 b 7 a 06 bf 16 b 26 cd 711 f 154e8 e 8e17 c 31 d 3462 d 7132589 ed 29353 c 6 fafdb 884 c 5 a 6e04 ea 938834 f 0 d 9 d "
2026-02-11 12:54:26 -08:00
]
}
2026-06-27 01:12:47 +00:00
},
{
" id ": " p 2 mr_duplicate_leaves ",
" objective ": " Ensure P 2 MR control blocks can be constructed correctly even when duplicate script leaves coexist in the same tree. ",
" given ": {
" scriptTree ": [
{
" id ": 0,
" script ": " 2071981521 ad 9 fc 9036687364118 fb 6 ccd 2035 b 96 a 423 c 59 c 5430e98310 a 11 abe 2 ac ",
" asm ": " 71981521 ad 9 fc 9036687364118 fb 6 ccd 2035 b 96 a 423 c 59 c 5430e98310 a 11 abe 2 OP_CHECKSIG ",
" leafVersion ": 192
},
[
{
" id ": 1,
" script ": " 20 d 5094 d 2 dbe 9 b 76e2 c 245 a 2 b 89 b 6006888952e2 faa 6 a 149 ae 318 d 69e520617748 ac ",
" asm ": " d 5094 d 2 dbe 9 b 76e2 c 245 a 2 b 89 b 6006888952e2 faa 6 a 149 ae 318 d 69e520617748 OP_CHECKSIG ",
" leafVersion ": 192
},
{
" id ": 2,
" script ": " 2071981521 ad 9 fc 9036687364118 fb 6 ccd 2035 b 96 a 423 c 59 c 5430e98310 a 11 abe 2 ac ",
" asm ": " 71981521 ad 9 fc 9036687364118 fb 6 ccd 2035 b 96 a 423 c 59 c 5430e98310 a 11 abe 2 OP_CHECKSIG ",
" leafVersion ": 192
}
]
]
},
" intermediary ": {
" leafHashes ": [
" f 154e8 e 8e17 c 31 d 3462 d 7132589 ed 29353 c 6 fafdb 884 c 5 a 6e04 ea 938834 f 0 d 9 d ",
" 737 ed 1 fe 30 bc 42 b 8022 d 717 b 44 f 0 d 93516617 af 64 a 64753 b 7 a 06 bf 16 b 26 cd 711 ",
" f 154e8 e 8e17 c 31 d 3462 d 7132589 ed 29353 c 6 fafdb 884 c 5 a 6e04 ea 938834 f 0 d 9 d "
],
" merkleRoot ": " 3 ab 4 f 80153012398 a 7 df 2 df 273 b 0 bd 3 cdb 839883320 ff 06 d 62e8 cc 1 ecb 351 ba 7 "
},
" expected ": {
" scriptPubKey ": " 52203 ab 4 f 80153012398 a 7 df 2 df 273 b 0 bd 3 cdb 839883320 ff 06 d 62e8 cc 1 ecb 351 ba 7 ",
" bip 350 Address ": " bc 1 z 8260 sq 2 nqy 3e3 f 7 l 9 he 88 v 9 a 8 ndc 8 xyrxg 8 lqmtzarxpaje 4 rwnsxxww 7 h ",
" scriptPathControlBlocks ": [
" c 13 a 9 adbb 72 f 00022 f 76909e0 f 4 bbab 37 dacafadb 59618 a 4 a 13 a 123e13 cb 6 f 3019 ",
" c 1 f 154e8 e 8e17 c 31 d 3462 d 7132589 ed 29353 c 6 fafdb 884 c 5 a 6e04 ea 938834 f 0 d 9 df 154e8 e 8e17 c 31 d 3462 d 7132589 ed 29353 c 6 fafdb 884 c 5 a 6e04 ea 938834 f 0 d 9 d ",
" c 1737 ed 1 fe 30 bc 42 b 8022 d 717 b 44 f 0 d 93516617 af 64 a 64753 b 7 a 06 bf 16 b 26 cd 711 f 154e8 e 8e17 c 31 d 3462 d 7132589 ed 29353 c 6 fafdb 884 c 5 a 6e04 ea 938834 f 0 d 9 d"
]
}
2026-02-11 12:54:26 -08:00
}
]
}