Skip to content

Instantly share code, notes, and snippets.

@cf
Created December 14, 2023 04:04
Show Gist options
  • Save cf/6433828e85f861eef59f98094c566be9 to your computer and use it in GitHub Desktop.
Save cf/6433828e85f861eef59f98094c566be9 to your computer and use it in GitHub Desktop.
Merkle Proof in TapScript
// root
<0x227c4fdcd6c57bf13f6af315dfeebfab6976e46276f11cc6160bbd0fb5ee22ec>
// sibling_1
<0x8869ff2c22b28cc10510d9853292803328be4fb0e80495e8bb8d271f5b889636>
// sibling_2
<0x848930bd7ba8cac54661072113fb278869e07bb8587f91392933374d017bcbe1>
// sibling_3
<0x7cdd2986268250628d0c10e385c58c6191e6fbe05191bcc04f133f2cea72c1c4>
// sibling_4
<0x619e312724bb6d7c3153ed9de791d764a366b389af13c58bf8a8d90481a46765>
// sibling_5
<0x21352bfecbeddde993839f614c3dac0a3ee37543f9b412b16199dc158e23b544>
// sibling_6
<0x31206fa80a50bb6abe29085058f16212212a60eec8f049fecb92d8c8e0a84bc0>
// sibling_7
<0xe71f0aa83cc32edfbefa9f4d3e0174ca85182eec9f3a09f6a6c0df6377a510d7>
// sibling_8
<0xfeb3c337d7a51a6fbf00b9e34c52e1c9195c969bd4e7a0bfd51d5c5bed9c1167>
// sibling_9
<0x8a8d7fe3af8caa085a7639a832001457dfb9128a8061142ad0335629ff23ff9c>
// sibling_10
<0xcddba7b592e3133393c16194fac7431abf2f5485ed711db282183c819e08ebaa>
// sibling_11
<0xf893e908917775b62bff23294dbbe3a1cd8e6cc1c35b4801887b646a6f81f17f>
// sibling_12
<0x95eec8b2e541cad4e91de38385f2e046619f54496c2382cb6cacd5b98c26f5a4>
// sibling_13
<0x8d0d63c39ebade8509e0ae3c9c3876fb5fa112be18f905ecacfecb92057603ab>
// sibling_14
<0x8fe6b1689256c0d385f42f5bbe2027a22c1996e110ba97c171d3e5948de92beb>
// sibling_15
<0xd49a7502ffcfb0340b1d7885688500ca308161a7f96b62df9d083b71fcc8f2bb>
// sibling_16
<0xb58d900f5e182e3c50ef74969ea16c7726c549757cc23523c369587da7293784>
// sibling_17
<0xd59e50b06c21c7a201a1c469e76a21e7cdc0def5be06d49d0ee43ec964176938>
// sibling_18
<0x345b091a43a4e56c86ff2034f80279c45e6c3417741c446103b4c29b8cd489e6>
// sibling_19
<0xa2944984637a8639a2805bd5efb7f0151895f5be68e6f733cf102b332c1aebe6>
// sibling_20
<0xe480b84964547ef3e9342a9f915ec7144d6bec674030b521d20049066474089b>
// sibling_21
<0xab8c794ff3f0e8c2477f7be9e9660e61218d5ba7be8d6ac8e4ce0568e64b28d8>
// sibling_22
<0x17b14e63a9b0eeb7f40552b99ab3ec349dbfe80ed1497c47c1da17c2fc529054>
// sibling_23
<0xdfe8433c4dc9407812272638647640d138b1cc036d38cdb6adc8a1e5efc03f0d>
// sibling_24
<0xa1a08c07ccce1c6a26bc6f3338543e15c8803c5c9f909c459f3127b7b72da0bf>
// sibling_25
<0xf81ce02ef679e2e29d542d3cdee78fd4d556b78ae03421909651bb6be77e7da9>
// sibling_26
<0x215228fd2afa2869f579093df1525b0e440f43f7145aa988d03438a78e9b72bf>
// sibling_27
<0xe3fe0f607bf194529d798a3c7409a6d0cb5efc19dce375b3c90611bc79f3247d>
// sibling_28
<0x08632de6f4ccaccfb2a3ffbf0e2c00ab21e9c09a5864dc052a5578db200edac5>
// sibling_29
<0xd05ae323ade50eb5b3e2ecfa09a9529bf693fb1a955b1a157f7b71c2cf8d629b>
// sibling_30
<0x8bf7fe31f973206a1084adc625aceba47a07a406bb7af0a4856be80369879f3f>
// value
<0x1337133713371337133713371337133713371337133713371337133713371337>
// index
<999>
// start verify merkle proof
OP_DUP
<536870912>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<536870912>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<268435456>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<268435456>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<134217728>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<134217728>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<67108864>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<67108864>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<33554432>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<33554432>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<16777216>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<16777216>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<8388608>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<8388608>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<4194304>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<4194304>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<2097152>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<2097152>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<1048576>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<1048576>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<524288>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<524288>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<262144>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<262144>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<131072>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<131072>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<65536>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<65536>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<32768>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<32768>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<16384>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<16384>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<8192>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<8192>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<4096>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<4096>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<2048>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<2048>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<1024>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<1024>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<512>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<512>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<256>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<256>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<128>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<128>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<64>
OP_LESSTHAN
OP_IF
OP_0
OP_TOALTSTACK
OP_ELSE
<64>
OP_SUB
OP_1
OP_TOALTSTACK
OP_ENDIF
OP_DUP
<32>
OP_LESSTHAN
O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OP_CAT
OP_SHA256
OP_FROMALTSTACK
OP_NOT
OP_IF
OP_SWAP
OP_ENDIF
OP_CAT
OP_SHA256
OP_FROMALTSTACK
OP_NOT
OP_IF
OP_SWAP
OP_ENDIF
OP_CAT
OP_SHA256
OP_EQUALVERIFY
// end verify merkle proof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment