Add test cases to test new bitcoin-tx functionality

This commit add testcases to test the following functions in bitcoin-tx:

- add a pay to non-standard script output
- add a P2SH output
- add a P2WSH output
- add a P2WSH wrapped in a P2SH output
- add a pay to pub key output
- add a P2WPKH output
- add a P2WPKH wrapped in a P2SH output
- add a bare multisig output
- add a multisig in P2SH output
- add a multisig in a P2WSH output
- add a multisig in a P2WSH wrapped in as P2SH output
This commit is contained in:
jnewbery 2016-10-04 15:40:41 -04:00 committed by John Newbery
parent 61a153443e
commit b7e144bb73
23 changed files with 377 additions and 0 deletions

View File

@ -117,6 +117,46 @@
"output_cmp": "txcreate2.json",
"description": "Parses a transation with no inputs and a single output script (output in json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-create", "outscript=0:OP_DROP"],
"output_cmp": "txcreatescript1.hex",
"description": "Create a new transaction with a single output script (OP_DROP)"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-create", "outscript=0:OP_DROP"],
"output_cmp": "txcreatescript1.json",
"description": "Create a new transaction with a single output script (OP_DROP) (output as json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-create", "outscript=0:OP_DROP:S"],
"output_cmp": "txcreatescript2.hex",
"description": "Create a new transaction with a single output script (OP_DROP) in a P2SH"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-create", "outscript=0:OP_DROP:S"],
"output_cmp": "txcreatescript2.json",
"description": "Create a new transaction with a single output script (OP_DROP) in a P2SH (output as json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-create", "outscript=0:OP_DROP:W"],
"output_cmp": "txcreatescript3.hex",
"description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-create", "outscript=0:OP_DROP:W"],
"output_cmp": "txcreatescript3.json",
"description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH (output as json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-create", "outscript=0:OP_DROP:WS"],
"output_cmp": "txcreatescript4.hex",
"description": "Create a new transaction with a single output script (OP_DROP) in a P2WSH, wrapped in a P2SH"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-create", "outscript=0:OP_DROP:WS"],
"output_cmp": "txcreatescript4.json",
"description": "Create a new transaction with a single output script (OP_DROP) in a P2SH, wrapped in a P2SH (output as json)"
},
{ "exec": "./bitcoin-tx",
"args":
["-create", "nversion=1",
@ -151,6 +191,42 @@
"output_cmp": "txcreatesignv2.hex",
"description": "Creates a new transaction with a single input and a single output, and then signs the transaction"
},
{ "exec": "./bitcoin-tx",
"args":
["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397"],
"output_cmp": "txcreateoutpubkey1.hex",
"description": "Creates a new transaction with a single pay-to-pubkey output"
},
{ "exec": "./bitcoin-tx",
"args":
["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397"],
"output_cmp": "txcreateoutpubkey1.json",
"description": "Creates a new transaction with a single pay-to-pubkey output (output as json)"
},
{ "exec": "./bitcoin-tx",
"args":
["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:W"],
"output_cmp": "txcreateoutpubkey2.hex",
"description": "Creates a new transaction with a single pay-to-witness-pubkey output"
},
{ "exec": "./bitcoin-tx",
"args":
["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:W"],
"output_cmp": "txcreateoutpubkey2.json",
"description": "Creates a new transaction with a single pay-to-witness-pubkey output (output as json)"
},
{ "exec": "./bitcoin-tx",
"args":
["-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:WS"],
"output_cmp": "txcreateoutpubkey3.hex",
"description": "Creates a new transaction with a single pay-to-witness-pubkey, wrapped in P2SH output"
},
{ "exec": "./bitcoin-tx",
"args":
["-json", "-create", "outpubkey=0:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:WS"],
"output_cmp": "txcreateoutpubkey3.json",
"description": "Creates a new transaction with a single pay-to-pub-key output, wrapped in P2SH (output as json)"
},
{ "exec": "./bitcoin-tx",
"args":
["-create",
@ -236,5 +312,45 @@
"in=5897de6bd6027a475eadd57019d4e6872c396d0716c4875a5f1a6fcfdf385c1f:0:1"],
"output_cmp": "txcreatedata_seq1.json",
"description": "Adds a new input with sequence number to a transaction (output in json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485"],
"output_cmp": "txcreatemultisig1.hex",
"description": "Creates a new transaction with a single 2-of-3 multisig output"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485"],
"output_cmp": "txcreatemultisig1.json",
"description": "Creates a new transaction with a single 2-of-3 multisig output (output in json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S"],
"output_cmp": "txcreatemultisig2.hex",
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2SH output"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:S"],
"output_cmp": "txcreatemultisig2.json",
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2SH output (output in json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:W"],
"output_cmp": "txcreatemultisig3.hex",
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:W"],
"output_cmp": "txcreatemultisig3.json",
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output (output in json)"
},
{ "exec": "./bitcoin-tx",
"args": ["-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:WS"],
"output_cmp": "txcreatemultisig4.hex",
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output, wrapped in P2SH"
},
{ "exec": "./bitcoin-tx",
"args": ["-json", "-create", "outmultisig=1:2:3:02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397:021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d:02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485:WS"],
"output_cmp": "txcreatemultisig4.json",
"description": "Creates a new transaction with a single 2-of-3 multisig in a P2WSH output, wrapped in P2SH (output in json)"
}
]

View File

@ -0,0 +1 @@
01000000000100e1f5050000000069522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae00000000

View File

@ -0,0 +1,26 @@
{
"txid": "0d1d4edfc217d9db3ab6a9298f26a52eae3c52f55a6cb8ccbc14f7c727572894",
"hash": "0d1d4edfc217d9db3ab6a9298f26a52eae3c52f55a6cb8ccbc14f7c727572894",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 1.00,
"n": 0,
"scriptPubKey": {
"asm": "2 02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397 021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d 02df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb485 3 OP_CHECKMULTISIG",
"hex": "522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae",
"reqSigs": 2,
"type": "multisig",
"addresses": [
"1FoG2386FG2tAJS9acMuiDsKy67aGg9MKz",
"1FXtz9KU8JNmQDyHdiEm5HDiALuP3zdHvV",
"14LuavcBbXZYJ6Tsz3cAUQj9SuQoL2xCQX"
]
}
}
],
"hex": "01000000000100e1f5050000000069522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae00000000"
}

View File

@ -0,0 +1 @@
01000000000100e1f5050000000017a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac8700000000

View File

@ -0,0 +1,24 @@
{
"txid": "0d861f278a3b7bce7cb5a88d71e6e6a903336f95ad5a2c29b295b63835b6eee3",
"hash": "0d861f278a3b7bce7cb5a88d71e6e6a903336f95ad5a2c29b295b63835b6eee3",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 1.00,
"n": 0,
"scriptPubKey": {
"asm": "OP_HASH160 1c6fbaf46d64221e80cbae182c33ddf81b9294ac OP_EQUAL",
"hex": "a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac87",
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"34HNh57oBCRKkxNyjTuWAJkTbuGh6jg2Ms"
]
}
}
],
"hex": "01000000000100e1f5050000000017a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac8700000000"
}

View File

@ -0,0 +1 @@
01000000000100e1f50500000000220020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f0500000000

View File

@ -0,0 +1,20 @@
{
"txid": "ccc552220b46a3b5140048b03395987ce4f0fa1ddf8c635bba1fa44e0f8c1d7f",
"hash": "ccc552220b46a3b5140048b03395987ce4f0fa1ddf8c635bba1fa44e0f8c1d7f",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 1.00,
"n": 0,
"scriptPubKey": {
"asm": "0 e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f05",
"hex": "0020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f05",
"type": "witness_v0_scripthash"
}
}
],
"hex": "01000000000100e1f50500000000220020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f0500000000"
}

View File

@ -0,0 +1 @@
01000000000100e1f5050000000017a9146edf12858999f0dae74f9c692e6694ee3621b2ac8700000000

View File

@ -0,0 +1,24 @@
{
"txid": "5e8b1cc73234e208d4b7ca9075f136b908c34101be7a048df4ba9ac758b61567",
"hash": "5e8b1cc73234e208d4b7ca9075f136b908c34101be7a048df4ba9ac758b61567",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 1.00,
"n": 0,
"scriptPubKey": {
"asm": "OP_HASH160 6edf12858999f0dae74f9c692e6694ee3621b2ac OP_EQUAL",
"hex": "a9146edf12858999f0dae74f9c692e6694ee3621b2ac87",
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"3BoFUz1StqcNcgUTZE5cC1eFhuYFzj3fGH"
]
}
}
],
"hex": "01000000000100e1f5050000000017a9146edf12858999f0dae74f9c692e6694ee3621b2ac8700000000"
}

View File

@ -0,0 +1 @@
0100000000010000000000000000232102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac00000000

View File

@ -0,0 +1,24 @@
{
"txid": "f42b38ac12e3fafc96ba1a9ba70cbfe326744aef75df5fb9db5d6e2855ca415f",
"hash": "f42b38ac12e3fafc96ba1a9ba70cbfe326744aef75df5fb9db5d6e2855ca415f",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 0.00,
"n": 0,
"scriptPubKey": {
"asm": "02a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397 OP_CHECKSIG",
"hex": "2102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac",
"reqSigs": 1,
"type": "pubkey",
"addresses": [
"1FoG2386FG2tAJS9acMuiDsKy67aGg9MKz"
]
}
}
],
"hex": "0100000000010000000000000000232102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac00000000"
}

View File

@ -0,0 +1 @@
0100000000010000000000000000160014a2516e770582864a6a56ed21a102044e388c62e300000000

View File

@ -0,0 +1,20 @@
{
"txid": "70f2a088cde460e677415fa1fb71895e90c231e6ed38ed203a35b6f848e9cc73",
"hash": "70f2a088cde460e677415fa1fb71895e90c231e6ed38ed203a35b6f848e9cc73",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 0.00,
"n": 0,
"scriptPubKey": {
"asm": "0 a2516e770582864a6a56ed21a102044e388c62e3",
"hex": "0014a2516e770582864a6a56ed21a102044e388c62e3",
"type": "witness_v0_keyhash"
}
}
],
"hex": "0100000000010000000000000000160014a2516e770582864a6a56ed21a102044e388c62e300000000"
}

View File

@ -0,0 +1 @@
010000000001000000000000000017a914a5ab14c9804d0d8bf02f1aea4e82780733ad0a838700000000

View File

@ -0,0 +1,24 @@
{
"txid": "bfc7e898ee9f6a9652d7b8cca147e2da134502e2ada0f279ed634fc8cf833f8c",
"hash": "bfc7e898ee9f6a9652d7b8cca147e2da134502e2ada0f279ed634fc8cf833f8c",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 0.00,
"n": 0,
"scriptPubKey": {
"asm": "OP_HASH160 a5ab14c9804d0d8bf02f1aea4e82780733ad0a83 OP_EQUAL",
"hex": "a914a5ab14c9804d0d8bf02f1aea4e82780733ad0a8387",
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"3GnzN8FqgvYGYdhj8NW6UNxxVv3Uj1ApQn"
]
}
}
],
"hex": "010000000001000000000000000017a914a5ab14c9804d0d8bf02f1aea4e82780733ad0a838700000000"
}

View File

@ -0,0 +1 @@
0100000000010000000000000000017500000000

View File

@ -0,0 +1,20 @@
{
"txid": "f0851b68202f736b792649cfc960259c2374badcb644ab20cac726b5f72f61c9",
"hash": "f0851b68202f736b792649cfc960259c2374badcb644ab20cac726b5f72f61c9",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 0.00,
"n": 0,
"scriptPubKey": {
"asm": "OP_DROP",
"hex": "75",
"type": "nonstandard"
}
}
],
"hex": "0100000000010000000000000000017500000000"
}

View File

@ -0,0 +1 @@
010000000001000000000000000017a91471ed53322d470bb96657deb786b94f97dd46fb158700000000

View File

@ -0,0 +1,24 @@
{
"txid": "6e07a7cc075e0703f32ee8c4e5373fe654bfbc315148fda364e1be286ff290d0",
"hash": "6e07a7cc075e0703f32ee8c4e5373fe654bfbc315148fda364e1be286ff290d0",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 0.00,
"n": 0,
"scriptPubKey": {
"asm": "OP_HASH160 71ed53322d470bb96657deb786b94f97dd46fb15 OP_EQUAL",
"hex": "a91471ed53322d470bb96657deb786b94f97dd46fb1587",
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"3C5QarEGh9feKbDJ3QbMf2YNjnMoiPDhNp"
]
}
}
],
"hex": "010000000001000000000000000017a91471ed53322d470bb96657deb786b94f97dd46fb158700000000"
}

View File

@ -0,0 +1 @@
01000000000100000000000000002200200bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad600000000

View File

@ -0,0 +1,20 @@
{
"txid": "8a234037b088e987c877030efc83374a07441c321bf9dc6dd2f206bc26507df8",
"hash": "8a234037b088e987c877030efc83374a07441c321bf9dc6dd2f206bc26507df8",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 0.00,
"n": 0,
"scriptPubKey": {
"asm": "0 0bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad6",
"hex": "00200bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad6",
"type": "witness_v0_scripthash"
}
}
],
"hex": "01000000000100000000000000002200200bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad600000000"
}

View File

@ -0,0 +1 @@
010000000001000000000000000017a9146a2c482f4985f57e702f325816c90e3723ca81ae8700000000

View File

@ -0,0 +1,24 @@
{
"txid": "24225cf5e9391100d6b218134b9f03383ca4c880a1f634ac12990cf28b66adbc",
"hash": "24225cf5e9391100d6b218134b9f03383ca4c880a1f634ac12990cf28b66adbc",
"version": 1,
"locktime": 0,
"vin": [
],
"vout": [
{
"value": 0.00,
"n": 0,
"scriptPubKey": {
"asm": "OP_HASH160 6a2c482f4985f57e702f325816c90e3723ca81ae OP_EQUAL",
"hex": "a9146a2c482f4985f57e702f325816c90e3723ca81ae87",
"reqSigs": 1,
"type": "scripthash",
"addresses": [
"3BNQbeFeJJGMAyDxPwWPuqxPMrjsFLjk3f"
]
}
}
],
"hex": "010000000001000000000000000017a9146a2c482f4985f57e702f325816c90e3723ca81ae8700000000"
}