Browse Source

Merge #8883: Add all standard TXO types to bitcoin-tx

0c50909 testcases: explicitly specify transaction version 1 (John Newbery)
b7e144b Add test cases to test new bitcoin-tx functionality (jnewbery)
61a1534 Add all transaction output types to bitcoin-tx. (jnewbery)
1814b08 add p2sh and segwit options to bitcoin-tx outscript command (Stanislas Marion)
0.14
Wladimir J. van der Laan 8 years ago
parent
commit
d5d4ad87af
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 195
      src/bitcoin-tx.cpp
  2. 116
      src/test/data/bitcoin-util-test.json
  3. 1
      src/test/data/txcreatemultisig1.hex
  4. 26
      src/test/data/txcreatemultisig1.json
  5. 1
      src/test/data/txcreatemultisig2.hex
  6. 24
      src/test/data/txcreatemultisig2.json
  7. 1
      src/test/data/txcreatemultisig3.hex
  8. 20
      src/test/data/txcreatemultisig3.json
  9. 1
      src/test/data/txcreatemultisig4.hex
  10. 24
      src/test/data/txcreatemultisig4.json
  11. 1
      src/test/data/txcreateoutpubkey1.hex
  12. 24
      src/test/data/txcreateoutpubkey1.json
  13. 1
      src/test/data/txcreateoutpubkey2.hex
  14. 20
      src/test/data/txcreateoutpubkey2.json
  15. 1
      src/test/data/txcreateoutpubkey3.hex
  16. 24
      src/test/data/txcreateoutpubkey3.json
  17. 1
      src/test/data/txcreatescript1.hex
  18. 20
      src/test/data/txcreatescript1.json
  19. 1
      src/test/data/txcreatescript2.hex
  20. 24
      src/test/data/txcreatescript2.json
  21. 1
      src/test/data/txcreatescript3.hex
  22. 20
      src/test/data/txcreatescript3.json
  23. 1
      src/test/data/txcreatescript4.hex
  24. 24
      src/test/data/txcreatescript4.json

195
src/bitcoin-tx.cpp

@ -78,8 +78,16 @@ static int AppInitRawTx(int argc, char* argv[]) @@ -78,8 +78,16 @@ static int AppInitRawTx(int argc, char* argv[])
strUsage += HelpMessageOpt("locktime=N", _("Set TX lock time to N"));
strUsage += HelpMessageOpt("nversion=N", _("Set TX version to N"));
strUsage += HelpMessageOpt("outaddr=VALUE:ADDRESS", _("Add address-based output to TX"));
strUsage += HelpMessageOpt("outpubkey=VALUE:PUBKEY[:FLAGS]", _("Add pay-to-pubkey output to TX") + ". " +
_("Optionally add the \"W\" flag to produce a pay-to-witness-pubkey-hash output") + ". " +
_("Optionally add the \"S\" flag to wrap the output in a pay-to-script-hash."));
strUsage += HelpMessageOpt("outdata=[VALUE:]DATA", _("Add data-based output to TX"));
strUsage += HelpMessageOpt("outscript=VALUE:SCRIPT", _("Add raw script output to TX"));
strUsage += HelpMessageOpt("outscript=VALUE:SCRIPT[:FLAGS]", _("Add raw script output to TX") + ". " +
_("Optionally add the \"W\" flag to produce a pay-to-witness-script-hash output") + ". " +
_("Optionally add the \"S\" flag to wrap the output in a pay-to-script-hash."));
strUsage += HelpMessageOpt("outmultisig=VALUE:REQUIRED:PUBKEYS:PUBKEY1:PUBKEY2:....[:FLAGS]", _("Add Pay To n-of-m Multi-sig output to TX. n = REQUIRED, m = PUBKEYS") + ". " +
_("Optionally add the \"W\" flag to produce a pay-to-witness-script-hash output") + ". " +
_("Optionally add the \"S\" flag to wrap the output in a pay-to-script-hash."));
strUsage += HelpMessageOpt("sign=SIGHASH-FLAGS", _("Add zero or more signatures to transaction") + ". " +
_("This command requires JSON registers:") +
_("prevtxs=JSON object") + ", " +
@ -168,6 +176,14 @@ static void RegisterLoad(const std::string& strInput) @@ -168,6 +176,14 @@ static void RegisterLoad(const std::string& strInput)
RegisterSetJson(key, valStr);
}
static CAmount ExtractAndValidateValue(const std::string& strValue)
{
CAmount value;
if (!ParseMoney(strValue, value))
throw std::runtime_error("invalid TX output value");
return value;
}
static void MutateTxVersion(CMutableTransaction& tx, const std::string& cmdVal)
{
int64_t newVersion = atoi64(cmdVal);
@ -222,25 +238,18 @@ static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInpu @@ -222,25 +238,18 @@ static void MutateTxAddInput(CMutableTransaction& tx, const std::string& strInpu
static void MutateTxAddOutAddr(CMutableTransaction& tx, const std::string& strInput)
{
// separate VALUE:ADDRESS in string
size_t pos = strInput.find(':');
if ((pos == std::string::npos) ||
(pos == 0) ||
(pos == (strInput.size() - 1)))
throw std::runtime_error("TX output missing separator");
// Separate into VALUE:ADDRESS
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
// extract and validate VALUE
std::string strValue = strInput.substr(0, pos);
CAmount value;
if (!ParseMoney(strValue, value))
throw std::runtime_error("invalid TX output value");
// Extract and validate VALUE
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
// extract and validate ADDRESS
std::string strAddr = strInput.substr(pos + 1, std::string::npos);
std::string strAddr = vStrInputParts[1];
CBitcoinAddress addr(strAddr);
if (!addr.IsValid())
throw std::runtime_error("invalid TX output address");
// build standard output script via GetScriptForDestination()
CScript scriptPubKey = GetScriptForDestination(addr.Get());
@ -249,6 +258,114 @@ static void MutateTxAddOutAddr(CMutableTransaction& tx, const std::string& strIn @@ -249,6 +258,114 @@ static void MutateTxAddOutAddr(CMutableTransaction& tx, const std::string& strIn
tx.vout.push_back(txout);
}
static void MutateTxAddOutPubKey(CMutableTransaction& tx, const std::string& strInput)
{
// Separate into VALUE:PUBKEY[:FLAGS]
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
// Extract and validate VALUE
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
// Extract and validate PUBKEY
CPubKey pubkey(ParseHex(vStrInputParts[1]));
if (!pubkey.IsFullyValid())
throw std::runtime_error("invalid TX output pubkey");
CScript scriptPubKey = GetScriptForRawPubKey(pubkey);
CBitcoinAddress addr(scriptPubKey);
// Extract and validate FLAGS
bool bSegWit = false;
bool bScriptHash = false;
if (vStrInputParts.size() == 3) {
std::string flags = vStrInputParts[2];
bSegWit = (flags.find("W") != std::string::npos);
bScriptHash = (flags.find("S") != std::string::npos);
}
if (bSegWit) {
// Call GetScriptForWitness() to build a P2WSH scriptPubKey
scriptPubKey = GetScriptForWitness(scriptPubKey);
}
if (bScriptHash) {
// Get the address for the redeem script, then call
// GetScriptForDestination() to construct a P2SH scriptPubKey.
CBitcoinAddress redeemScriptAddr(scriptPubKey);
scriptPubKey = GetScriptForDestination(redeemScriptAddr.Get());
}
// construct TxOut, append to transaction output list
CTxOut txout(value, scriptPubKey);
tx.vout.push_back(txout);
}
static void MutateTxAddOutMultiSig(CMutableTransaction& tx, const std::string& strInput)
{
// Separate into VALUE:REQUIRED:NUMKEYS:PUBKEY1:PUBKEY2:....[:FLAGS]
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
// Check that there are enough parameters
if (vStrInputParts.size()<3)
throw std::runtime_error("Not enough multisig parameters");
// Extract and validate VALUE
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
// Extract REQUIRED
uint32_t required = stoul(vStrInputParts[1]);
// Extract NUMKEYS
uint32_t numkeys = stoul(vStrInputParts[2]);
// Validate there are the correct number of pubkeys
if (vStrInputParts.size() < numkeys + 3)
throw std::runtime_error("incorrect number of multisig pubkeys");
if (required < 1 || required > 20 || numkeys < 1 || numkeys > 20 || numkeys < required)
throw std::runtime_error("multisig parameter mismatch. Required " \
+ std::to_string(required) + " of " + std::to_string(numkeys) + "signatures.");
// extract and validate PUBKEYs
std::vector<CPubKey> pubkeys;
for(int pos = 1; pos <= int(numkeys); pos++) {
CPubKey pubkey(ParseHex(vStrInputParts[pos + 2]));
if (!pubkey.IsFullyValid())
throw std::runtime_error("invalid TX output pubkey");
pubkeys.push_back(pubkey);
}
// Extract FLAGS
bool bSegWit = false;
bool bScriptHash = false;
if (vStrInputParts.size() == numkeys + 4) {
std::string flags = vStrInputParts.back();
bSegWit = (flags.find("W") != std::string::npos);
bScriptHash = (flags.find("S") != std::string::npos);
}
else if (vStrInputParts.size() > numkeys + 4) {
// Validate that there were no more parameters passed
throw std::runtime_error("Too many parameters");
}
CScript scriptPubKey = GetScriptForMultisig(required, pubkeys);
if (bSegWit) {
// Call GetScriptForWitness() to build a P2WSH scriptPubKey
scriptPubKey = GetScriptForWitness(scriptPubKey);
}
if (bScriptHash) {
// Get the address for the redeem script, then call
// GetScriptForDestination() to construct a P2SH scriptPubKey.
CBitcoinAddress addr(scriptPubKey);
scriptPubKey = GetScriptForDestination(addr.Get());
}
// construct TxOut, append to transaction output list
CTxOut txout(value, scriptPubKey);
tx.vout.push_back(txout);
}
static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strInput)
{
CAmount value = 0;
@ -260,10 +377,8 @@ static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strIn @@ -260,10 +377,8 @@ static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strIn
throw std::runtime_error("TX output value not specified");
if (pos != std::string::npos) {
// extract and validate VALUE
std::string strValue = strInput.substr(0, pos);
if (!ParseMoney(strValue, value))
throw std::runtime_error("invalid TX output value");
// Extract and validate VALUE
value = ExtractAndValidateValue(strInput.substr(0, pos));
}
// extract and validate DATA
@ -280,21 +395,35 @@ static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strIn @@ -280,21 +395,35 @@ static void MutateTxAddOutData(CMutableTransaction& tx, const std::string& strIn
static void MutateTxAddOutScript(CMutableTransaction& tx, const std::string& strInput)
{
// separate VALUE:SCRIPT in string
size_t pos = strInput.find(':');
if ((pos == std::string::npos) ||
(pos == 0))
// separate VALUE:SCRIPT[:FLAGS]
std::vector<std::string> vStrInputParts;
boost::split(vStrInputParts, strInput, boost::is_any_of(":"));
if (vStrInputParts.size() < 2)
throw std::runtime_error("TX output missing separator");
// extract and validate VALUE
std::string strValue = strInput.substr(0, pos);
CAmount value;
if (!ParseMoney(strValue, value))
throw std::runtime_error("invalid TX output value");
// Extract and validate VALUE
CAmount value = ExtractAndValidateValue(vStrInputParts[0]);
// extract and validate script
std::string strScript = strInput.substr(pos + 1, std::string::npos);
CScript scriptPubKey = ParseScript(strScript); // throws on err
std::string strScript = vStrInputParts[1];
CScript scriptPubKey = ParseScript(strScript);
// Extract FLAGS
bool bSegWit = false;
bool bScriptHash = false;
if (vStrInputParts.size() == 3) {
std::string flags = vStrInputParts.back();
bSegWit = (flags.find("W") != std::string::npos);
bScriptHash = (flags.find("S") != std::string::npos);
}
if (bSegWit) {
scriptPubKey = GetScriptForWitness(scriptPubKey);
}
if (bScriptHash) {
CBitcoinAddress addr(scriptPubKey);
scriptPubKey = GetScriptForDestination(addr.Get());
}
// construct TxOut, append to transaction output list
CTxOut txout(value, scriptPubKey);
@ -538,10 +667,14 @@ static void MutateTx(CMutableTransaction& tx, const std::string& command, @@ -538,10 +667,14 @@ static void MutateTx(CMutableTransaction& tx, const std::string& command,
MutateTxDelOutput(tx, commandVal);
else if (command == "outaddr")
MutateTxAddOutAddr(tx, commandVal);
else if (command == "outdata")
MutateTxAddOutData(tx, commandVal);
else if (command == "outpubkey")
MutateTxAddOutPubKey(tx, commandVal);
else if (command == "outmultisig")
MutateTxAddOutMultiSig(tx, commandVal);
else if (command == "outscript")
MutateTxAddOutScript(tx, commandVal);
else if (command == "outdata")
MutateTxAddOutData(tx, commandVal);
else if (command == "sign") {
if (!ecc) { ecc.reset(new Secp256k1Init()); }

116
src/test/data/bitcoin-util-test.json

@ -117,6 +117,46 @@ @@ -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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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 @@ @@ -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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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 @@ @@ -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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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", "nversion=1"],
"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)"
}
]

1
src/test/data/txcreatemultisig1.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
01000000000100e1f5050000000069522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae00000000

26
src/test/data/txcreatemultisig1.json

@ -0,0 +1,26 @@ @@ -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"
}

1
src/test/data/txcreatemultisig2.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
01000000000100e1f5050000000017a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac8700000000

24
src/test/data/txcreatemultisig2.json

@ -0,0 +1,24 @@ @@ -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"
}

1
src/test/data/txcreatemultisig3.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
01000000000100e1f50500000000220020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f0500000000

20
src/test/data/txcreatemultisig3.json

@ -0,0 +1,20 @@ @@ -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"
}

1
src/test/data/txcreatemultisig4.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
01000000000100e1f5050000000017a9146edf12858999f0dae74f9c692e6694ee3621b2ac8700000000

24
src/test/data/txcreatemultisig4.json

@ -0,0 +1,24 @@ @@ -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"
}

1
src/test/data/txcreateoutpubkey1.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
0100000000010000000000000000232102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac00000000

24
src/test/data/txcreateoutpubkey1.json

@ -0,0 +1,24 @@ @@ -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"
}

1
src/test/data/txcreateoutpubkey2.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
0100000000010000000000000000160014a2516e770582864a6a56ed21a102044e388c62e300000000

20
src/test/data/txcreateoutpubkey2.json

@ -0,0 +1,20 @@ @@ -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"
}

1
src/test/data/txcreateoutpubkey3.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
010000000001000000000000000017a914a5ab14c9804d0d8bf02f1aea4e82780733ad0a838700000000

24
src/test/data/txcreateoutpubkey3.json

@ -0,0 +1,24 @@ @@ -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"
}

1
src/test/data/txcreatescript1.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
0100000000010000000000000000017500000000

20
src/test/data/txcreatescript1.json

@ -0,0 +1,20 @@ @@ -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"
}

1
src/test/data/txcreatescript2.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
010000000001000000000000000017a91471ed53322d470bb96657deb786b94f97dd46fb158700000000

24
src/test/data/txcreatescript2.json

@ -0,0 +1,24 @@ @@ -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"
}

1
src/test/data/txcreatescript3.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
01000000000100000000000000002200200bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad600000000

20
src/test/data/txcreatescript3.json

@ -0,0 +1,20 @@ @@ -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"
}

1
src/test/data/txcreatescript4.hex

@ -0,0 +1 @@ @@ -0,0 +1 @@
010000000001000000000000000017a9146a2c482f4985f57e702f325816c90e3723ca81ae8700000000

24
src/test/data/txcreatescript4.json

@ -0,0 +1,24 @@ @@ -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"
}
Loading…
Cancel
Save