=== SIGHASH ALL ===
The following is an unsigned transaction:
02000000025f6092ec9bb430830dfc344260dd5a03cf355186e774be49b2fe5c362f56cb8d00000000000000000061431892d76aa28b5ed1e3da8800fa0d7190c4b4f22be5f416d2d07e573b32e10100000000000000000100ca9a3b000000001976a914682dfdbc97ab5c31300f36d3c12c6fd854b1b35a88ac00000000
The first input comes from a P2WPKH:
scriptPubKey : 0014196a5bea745288a7f947993c28e3a0f2108d2e0a
value : 5.0
private key : 6b3973ee2ce444ada0147716925f6f77569350804835498593dd3be95163d558
public key : 0271be339aeae9ed2c6a5a7f8ac5f49638da387612be881c7ed2fb3848b0ef8a6c
The second input comes from a P2TR:
scriptPubKey : 512029d942d0408906b359397b6f87c5145814a9aefc8c396dd05efa8b5b73576bf2
value : 6.0
private key : cf3780a32ef3b2d70366f0124ee40195a251044e82a13146106be75ee049ac02
To sign it with a nHashType SIGHASH_ALL:
shaPrevouts:
SHA256(5f6092ec9bb430830dfc344260dd5a03cf355186e774be49b2fe5c362f56cb8d0000000061431892d76aa28b5ed1e3da8800fa0d7190c4b4f22be5f416d2d07e573b32e101000000)
= 32553b113292dfa8216546e721388a6c19c76626ca65dc187e0348d6ed445f81
shaAmounts:
SHA256(0065cd1d000000000046c32300000000)
= 5733468db74734c00efa0b466bca091d8f1aab074af2538f36bd0a734a5940c5
shaScriptpubkeys:
SHA256(160014196a5bea745288a7f947993c28e3a0f2108d2e0a22512029d942d0408906b359397b6f87c5145814a9aefc8c396dd05efa8b5b73576bf2)
= 423cd73484fc5e3e0a623442846c279c2216f25a2f32d161fea6c5821a1adde7
shaSequences:
SHA256(0000000000000000)
= af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc
shaOutputs:
SHA256(00ca9a3b000000001976a914682dfdbc97ab5c31300f36d3c12c6fd854b1b35a88ac)
= 8cdee56004a241f9c79cc55b7d79eaed04909d84660502a2d4e9c357c2047cf5
hash preimage: 0000020000000000000032553b113292dfa8216546e721388a6c19c76626ca65dc187e0348d6ed445f815733468db74734c00efa0b466bca091d8f1aab074af2538f36bd0a734a5940c5423cd73484fc5e3e0a623442846c279c2216f25a2f32d161fea6c5821a1adde7af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc8cdee56004a241f9c79cc55b7d79eaed04909d84660502a2d4e9c357c2047cf50001000000
sigHash: 07333acfe6dce8196f1ad62b2e039a3d9f0b6627bf955be767c519c0f8789ff4
signature = 8608a76e87a5be42162284e8d7efc6cf71470351b36e07914fd0cfcb7beae98378fd9f664e274c9c2a2744197da522fdf1e3aba999b318e2587be098d90d4533
The serialized signed transaction is: 020000000001025f6092ec9bb430830dfc344260dd5a03cf355186e774be49b2fe5c362f56cb8d00000000000000000061431892d76aa28b5ed1e3da8800fa0d7190c4b4f22be5f416d2d07e573b32e10100000000000000000100ca9a3b000000001976a914682dfdbc97ab5c31300f36d3c12c6fd854b1b35a88ac0247304402203120452eed289de04e17740232b5f97fac0bc91e4cbb7750bb3d9f4f3c09477b02207e4e363c8d7914f707ff3ddf84e3201f9e402a7dccd02be5d7739d91b0f91adf01210271be339aeae9ed2c6a5a7f8ac5f49638da387612be881c7ed2fb3848b0ef8a6c01408608a76e87a5be42162284e8d7efc6cf71470351b36e07914fd0cfcb7beae98378fd9f664e274c9c2a2744197da522fdf1e3aba999b318e2587be098d90d453300000000
=== SIGHASH ANYONECANPAY ===
The following is an unsigned transaction:
02000000015c82840e7a0e5283c5516e742352566408de5c40d45ab0a2f872b37f188976c200000000000000000002003b5808000000001600141192fac5233e4eefa18859396b74851de18f8f4700e1f5050000000022512032c22a6e048b9d4183f612bc1b73a58fc0d4e7f548fd71b732063645d43f420200000000
The input comes from a P2TR:
scriptPubKey : 5120fe7633a26b281a80ee75d344b07ec97e738d4038de288b6caf7d38e06a6c3ee1
value : 2.5
private key : 3c1d300faf1d8706fd07137e1cc1d59967ccc0efa6212fc03b2ac7c382fa9133
To sign it with a nHashType SIGHASH_ANYONECANPAY:
shaOutputs:
SHA256(003b5808000000001600141192fac5233e4eefa18859396b74851de18f8f4700e1f5050000000022512032c22a6e048b9d4183f612bc1b73a58fc0d4e7f548fd71b732063645d43f4202)
= d070f96ca70c4dea1042a92e6abf04883e75bd3ad7dd4dcdf18153cda431cbd8
hash preimage: 00810200000000000000d070f96ca70c4dea1042a92e6abf04883e75bd3ad7dd4dcdf18153cda431cbd8005c82840e7a0e5283c5516e742352566408de5c40d45ab0a2f872b37f188976c20000000080b2e60e00000000225120fe7633a26b281a80ee75d344b07ec97e738d4038de288b6caf7d38e06a6c3ee100000000
sigHash: 11998278e8f4fe9ec6e360642a91536a5498a30cf711712ed3d9c25dfede876b
signature = 53fd82ff31642b92ae43cf0010e2aac2c51a781cb2ce8c72f80477a4900d2f3a4bb1eb986bc000bd5b055c62872ac8c426eb69186b3f2e46656189d1ba97a30781
The serialized signed transaction is: 020000000001015c82840e7a0e5283c5516e742352566408de5c40d45ab0a2f872b37f188976c200000000000000000002003b5808000000001600141192fac5233e4eefa18859396b74851de18f8f4700e1f5050000000022512032c22a6e048b9d4183f612bc1b73a58fc0d4e7f548fd71b732063645d43f4202014153fd82ff31642b92ae43cf0010e2aac2c51a781cb2ce8c72f80477a4900d2f3a4bb1eb986bc000bd5b055c62872ac8c426eb69186b3f2e46656189d1ba97a3078100000000
=== SIGHASH SINGLE ===
The following is an unsigned transaction:
0200000002f4d49508b20d94df7d19b5ce7f7d713140cdad392c23a5ab3c996c19284d5f7b0100000000000000006912ceb41a4e62b77a3b7bec7cd777fbd5c8188821ecb2e1fd0a6e56ed3315920000000000000000000200c2eb0b000000001976a9143bfe0f94eb78a2227664c6ebcf81719467c0106f88ac00a3e11100000000220020f1dca6047a919edc31378db3c5fcd1e93eea73f9c7fd8632ab47f18c8b8165f400000000
The first input comes from a P2TR:
scriptPubKey : 512088782d9105c8774f5f2f2857aec1519bf83aa53371bd44d3a0735e9841b73c28
value : 1.0
private key : eb54ef369f599d3da9ecfeab0529160dfc76c92f1e32ade4ba33abd8408a23b8
The second input comes from a P2PKH:
scriptPubKey : 76a914a589246bf9c64679b6d186608c2a2bee949f23e088ac
value : 5.0
private key : 5dd3e4e9cd6073da94108e26e8c5c3ccbd510197ab12bd787b19b0e88181da9c
public key : 1da42d0fb59c4aa380bb7c9775d6d2da16f01eda6b3921d227faaa999de16021
To sign it with a nHashType SIGHASH_SINGLE:
shaPrevouts:
SHA256(f4d49508b20d94df7d19b5ce7f7d713140cdad392c23a5ab3c996c19284d5f7b010000006912ceb41a4e62b77a3b7bec7cd777fbd5c8188821ecb2e1fd0a6e56ed33159200000000)
= c637b7e49b49272269dd8b409682f66cf28191d62028216cb200239ff5e2f8dd
shaAmounts:
SHA256(00e1f505000000000065cd1d00000000)
= 4a3c35ddd52f7ffa12848588e82193156f84a476894a095352892c8f274fc863
shaScriptpubkeys:
SHA256(22512088782d9105c8774f5f2f2857aec1519bf83aa53371bd44d3a0735e9841b73c281976a914a589246bf9c64679b6d186608c2a2bee949f23e088ac)
= 480fb749c75701a17230706caddbfce6f422151d9722386e82bfcd3f4fdc2704
shaSequences:
SHA256(0000000000000000)
= af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc
hash preimage: 00030200000000000000c637b7e49b49272269dd8b409682f66cf28191d62028216cb200239ff5e2f8dd4a3c35ddd52f7ffa12848588e82193156f84a476894a095352892c8f274fc863480fb749c75701a17230706caddbfce6f422151d9722386e82bfcd3f4fdc2704af5570f5a1810b7af78caf4bc70a660f0df51e42baf91d4de5b2328de0e83dfc00000000007b1b0fd12e11d0c5792199a8cd4f4de1e823635e6947909f10d09a3e84cce760
sigHash: 278ba0eea80c753d166879a844b51f290770609ec171a21fdfb6c0232d25c2e0
signature = 3045022100cc57364c2fc8ec973a038a0d859ccfbec969165bd4a1b5cbf91cfa4cd1170b0102206460814f1093b241fc8afd04b61741d5d5ae90fd404e3e7a2500d298d4e8c73503
The serialized signed transaction is: 02000000000102f4d49508b20d94df7d19b5ce7f7d713140cdad392c23a5ab3c996c19284d5f7b010000006a483045022100cc57364c2fc8ec973a038a0d859ccfbec969165bd4a1b5cbf91cfa4cd1170b0102206460814f1093b241fc8afd04b61741d5d5ae90fd404e3e7a2500d298d4e8c73503201da42d0fb59c4aa380bb7c9775d6d2da16f01eda6b3921d227faaa999de16021000000006912ceb41a4e62b77a3b7bec7cd777fbd5c8188821ecb2e1fd0a6e56ed3315920000000000000000000200c2eb0b000000001976a9143bfe0f94eb78a2227664c6ebcf81719467c0106f88ac00a3e11100000000220020f1dca6047a919edc31378db3c5fcd1e93eea73f9c7fd8632ab47f18c8b8165f40141346f28fec0d31fafde1a1aa30634d6962d59e118a79456671347060697937424fd77d679deb1c7652ae15b5d932fe3bbace65b07d6cf6639b638e21688b485c0030000000000
Test vector for taproot SigMsg
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.