Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
{"verbose", RPCArg::Type::BOOL, /* opt */ true, | {"verbose", RPCArg::Type::BOOL, /* opt */ true, | ||||
/* default_val */ "false", | /* default_val */ "false", | ||||
"If false, return a string, otherwise return a json " | "If false, return a string, otherwise return a json " | ||||
"object"}, | "object"}, | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"The block in which to look for the transaction"}, | "The block in which to look for the transaction"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult (if verbose is not set or set to false):\n" | "\nResult (if verbose is not set or set to false):\n" | ||||
"\"data\" (string) The serialized, hex-encoded data for " | "\"data\" (string) The serialized, hex-encoded data for " | ||||
"'txid'\n" | "'txid'\n" | ||||
"\nResult (if verbose is set to true):\n" | "\nResult (if verbose is set to true):\n" | ||||
"{\n" | "{\n" | ||||
" \"in_active_chain\": b, (bool) Whether specified block is in " | " \"in_active_chain\": b, (bool) Whether specified block is in " | ||||
"the active chain or not (only present with explicit \"blockhash\" " | "the active chain or not (only present with explicit \"blockhash\" " | ||||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | if (request.fHelp || | ||||
/* default_val */ "", "A transaction hash"}, | /* default_val */ "", "A transaction hash"}, | ||||
}, | }, | ||||
}, | }, | ||||
{"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, | {"blockhash", RPCArg::Type::STR_HEX, /* opt */ true, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"If specified, looks for txid in the block with this " | "If specified, looks for txid in the block with this " | ||||
"hash"}, | "hash"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"data\" (string) A string that is a serialized, " | "\"data\" (string) A string that is a serialized, " | ||||
"hex-encoded data for the proof.\n"); | "hex-encoded data for the proof.\n"); | ||||
} | } | ||||
std::set<TxId> setTxIds; | std::set<TxId> setTxIds; | ||||
TxId oneTxId; | TxId oneTxId; | ||||
UniValue txids = request.params[0].get_array(); | UniValue txids = request.params[0].get_array(); | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"block, returning the transaction it commits to\n" | "block, returning the transaction it commits to\n" | ||||
"and throwing an RPC error if the block is not in our " | "and throwing an RPC error if the block is not in our " | ||||
"best chain\n", | "best chain\n", | ||||
{ | { | ||||
{"proof", RPCArg::Type::STR_HEX, /* opt */ false, | {"proof", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"The hex-encoded proof generated by gettxoutproof"}, | "The hex-encoded proof generated by gettxoutproof"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"[\"txid\"] (array, strings) The txid(s) which the proof " | "[\"txid\"] (array, strings) The txid(s) which the proof " | ||||
"commits to, or empty array if the proof can not be validated.\n"); | "commits to, or empty array if the proof can not be validated.\n"); | ||||
} | } | ||||
CDataStream ssMB(ParseHexV(request.params[0], "proof"), SER_NETWORK, | CDataStream ssMB(ParseHexV(request.params[0], "proof"), SER_NETWORK, | ||||
PROTOCOL_VERSION); | PROTOCOL_VERSION); | ||||
CMerkleBlock merkleBlock; | CMerkleBlock merkleBlock; | ||||
▲ Show 20 Lines • Show All 232 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
{"locktime", RPCArg::Type::NUM, /* opt */ true, | {"locktime", RPCArg::Type::NUM, /* opt */ true, | ||||
/* default_val */ "0", | /* default_val */ "0", | ||||
"Raw locktime. Non-0 value also locktime-activates " | "Raw locktime. Non-0 value also locktime-activates " | ||||
"inputs"}, | "inputs"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"transaction\" (string) hex string of the " | "\"transaction\" (string) hex string of the " | ||||
"transaction\n" | "transaction\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("createrawtransaction", | HelpExampleCli("createrawtransaction", | ||||
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" " | "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" " | ||||
"\"[{\\\"address\\\":0.01}]\"") + | "\"[{\\\"address\\\":0.01}]\"") + | ||||
Show All 27 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{"decoderawtransaction", | RPCHelpMan{"decoderawtransaction", | ||||
"\nReturn a JSON object representing the serialized, " | "\nReturn a JSON object representing the serialized, " | ||||
"hex-encoded transaction.\n", | "hex-encoded transaction.\n", | ||||
{ | { | ||||
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, | {"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", "The transaction hex string"}, | /* default_val */ "", "The transaction hex string"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"txid\" : \"id\", (string) The transaction id\n" | " \"txid\" : \"id\", (string) The transaction id\n" | ||||
" \"hash\" : \"id\", (string) The transaction hash " | " \"hash\" : \"id\", (string) The transaction hash " | ||||
"(differs from txid for witness transactions)\n" | "(differs from txid for witness transactions)\n" | ||||
" \"size\" : n, (numeric) The transaction size\n" | " \"size\" : n, (numeric) The transaction size\n" | ||||
" \"version\" : n, (numeric) The version\n" | " \"version\" : n, (numeric) The version\n" | ||||
" \"locktime\" : ttt, (numeric) The lock time\n" | " \"locktime\" : ttt, (numeric) The lock time\n" | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | static UniValue decodescript(const Config &config, | ||||
if (request.fHelp || request.params.size() != 1) { | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{"decodescript", | RPCHelpMan{"decodescript", | ||||
"\nDecode a hex-encoded script.\n", | "\nDecode a hex-encoded script.\n", | ||||
{ | { | ||||
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, | {"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", "the hex-encoded script"}, | /* default_val */ "", "the hex-encoded script"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"asm\":\"asm\", (string) Script public key\n" | " \"asm\":\"asm\", (string) Script public key\n" | ||||
" \"hex\":\"hex\", (string) hex-encoded public key\n" | " \"hex\":\"hex\", (string) hex-encoded public key\n" | ||||
" \"type\":\"type\", (string) The output type\n" | " \"type\":\"type\", (string) The output type\n" | ||||
" \"reqSigs\": n, (numeric) The required signatures\n" | " \"reqSigs\": n, (numeric) The required signatures\n" | ||||
" \"addresses\": [ (json array of string)\n" | " \"addresses\": [ (json array of string)\n" | ||||
" \"address\" (string) bitcoin address\n" | " \"address\" (string) bitcoin address\n" | ||||
▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"signed transactions", | "signed transactions", | ||||
{ | { | ||||
{"hexstring", RPCArg::Type::STR_HEX, | {"hexstring", RPCArg::Type::STR_HEX, | ||||
/* opt */ false, /* default_val */ "", | /* opt */ false, /* default_val */ "", | ||||
"A transaction hash"}, | "A transaction hash"}, | ||||
}, | }, | ||||
}, | }, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"hex\" (string) The hex-encoded raw transaction with " | "\"hex\" (string) The hex-encoded raw transaction with " | ||||
"signature(s)\n" | "signature(s)\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("combinerawtransaction", | HelpExampleCli("combinerawtransaction", | ||||
"[\"myhex1\", \"myhex2\", \"myhex3\"]")); | "[\"myhex1\", \"myhex2\", \"myhex3\"]")); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 309 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
"The signature hash type. Must be one of:\n" | "The signature hash type. Must be one of:\n" | ||||
" \"ALL|FORKID\"\n" | " \"ALL|FORKID\"\n" | ||||
" \"NONE|FORKID\"\n" | " \"NONE|FORKID\"\n" | ||||
" \"SINGLE|FORKID\"\n" | " \"SINGLE|FORKID\"\n" | ||||
" \"ALL|FORKID|ANYONECANPAY\"\n" | " \"ALL|FORKID|ANYONECANPAY\"\n" | ||||
" \"NONE|FORKID|ANYONECANPAY\"\n" | " \"NONE|FORKID|ANYONECANPAY\"\n" | ||||
" \"SINGLE|FORKID|ANYONECANPAY\""}, | " \"SINGLE|FORKID|ANYONECANPAY\""}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"hex\" : \"value\", (string) The hex-encoded " | " \"hex\" : \"value\", (string) The hex-encoded " | ||||
"raw transaction with signature(s)\n" | "raw transaction with signature(s)\n" | ||||
" \"complete\" : true|false, (boolean) If the " | " \"complete\" : true|false, (boolean) If the " | ||||
"transaction has a complete set of signatures\n" | "transaction has a complete set of signatures\n" | ||||
" \"errors\" : [ (json array of objects) " | " \"errors\" : [ (json array of objects) " | ||||
"Script verification errors (if there are any)\n" | "Script verification errors (if there are any)\n" | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"signrawtransactionwithkey calls.\n", | "signrawtransactionwithkey calls.\n", | ||||
{ | { | ||||
{"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, | {"hexstring", RPCArg::Type::STR_HEX, /* opt */ false, | ||||
/* default_val */ "", | /* default_val */ "", | ||||
"The hex string of the raw transaction"}, | "The hex string of the raw transaction"}, | ||||
{"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, | {"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, | ||||
/* default_val */ "false", "Allow high fees"}, | /* default_val */ "false", "Allow high fees"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"\"hex\" (string) The transaction hash in hex\n" | "\"hex\" (string) The transaction hash in hex\n" | ||||
"\nExamples:\n" | "\nExamples:\n" | ||||
"\nCreate a transaction\n" + | "\nCreate a transaction\n" + | ||||
HelpExampleCli( | HelpExampleCli( | ||||
"createrawtransaction", | "createrawtransaction", | ||||
"\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" " | "\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" " | ||||
"\"{\\\"myaddress\\\":0.01}\"") + | "\"{\\\"myaddress\\\":0.01}\"") + | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
{ | { | ||||
{"rawtx", RPCArg::Type::STR_HEX, | {"rawtx", RPCArg::Type::STR_HEX, | ||||
/* opt */ false, /* default_val */ "", ""}, | /* opt */ false, /* default_val */ "", ""}, | ||||
}, | }, | ||||
}, | }, | ||||
{"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, | {"allowhighfees", RPCArg::Type::BOOL, /* opt */ true, | ||||
/* default_val */ "false", "Allow high fees"}, | /* default_val */ "false", "Allow high fees"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"[ (array) The result of the mempool acceptance " | "[ (array) The result of the mempool acceptance " | ||||
"test for each raw transaction in the input array.\n" | "test for each raw transaction in the input array.\n" | ||||
" Length is exactly one for now.\n" | " Length is exactly one for now.\n" | ||||
" {\n" | " {\n" | ||||
" \"txid\" (string) The transaction hash in hex\n" | " \"txid\" (string) The transaction hash in hex\n" | ||||
" \"allowed\" (boolean) If the mempool allows this tx to " | " \"allowed\" (boolean) If the mempool allows this tx to " | ||||
"be inserted\n" | "be inserted\n" | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
RPCHelpMan{"decodepsbt", | RPCHelpMan{"decodepsbt", | ||||
"\nReturn a JSON object representing the serialized, " | "\nReturn a JSON object representing the serialized, " | ||||
"base64-encoded partially signed Bitcoin transaction.\n", | "base64-encoded partially signed Bitcoin transaction.\n", | ||||
{ | { | ||||
{"psbt", RPCArg::Type::STR, /* opt */ false, | {"psbt", RPCArg::Type::STR, /* opt */ false, | ||||
/* default_val */ "", "The PSBT base64 string"}, | /* default_val */ "", "The PSBT base64 string"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"tx\" : { (json object) The decoded " | " \"tx\" : { (json object) The decoded " | ||||
"network-serialized unsigned transaction.\n" | "network-serialized unsigned transaction.\n" | ||||
" ... The layout is the " | " ... The layout is the " | ||||
"same as the output of decoderawtransaction.\n" | "same as the output of decoderawtransaction.\n" | ||||
" },\n" | " },\n" | ||||
" \"unknown\" : { (json object) The unknown global " | " \"unknown\" : { (json object) The unknown global " | ||||
▲ Show 20 Lines • Show All 273 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 1) { | ||||
"A json array of base64 strings of partially signed " | "A json array of base64 strings of partially signed " | ||||
"transactions", | "transactions", | ||||
{ | { | ||||
{"psbt", RPCArg::Type::STR, /* opt */ false, | {"psbt", RPCArg::Type::STR, /* opt */ false, | ||||
/* default_val */ "", "A base64 string of a PSBT"}, | /* default_val */ "", "A base64 string of a PSBT"}, | ||||
}, | }, | ||||
}, | }, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
" \"psbt\" (string) The base64-encoded partially signed " | " \"psbt\" (string) The base64-encoded partially signed " | ||||
"transaction\n" | "transaction\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("combinepsbt", | HelpExampleCli("combinepsbt", | ||||
"[\"mybase64_1\", \"mybase64_2\", \"mybase64_3\"]")); | "[\"mybase64_1\", \"mybase64_2\", \"mybase64_3\"]")); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
/* default_val */ "", "A base64 string of a PSBT"}, | /* default_val */ "", "A base64 string of a PSBT"}, | ||||
{"extract", RPCArg::Type::BOOL, /* opt */ true, | {"extract", RPCArg::Type::BOOL, /* opt */ true, | ||||
/* default_val */ "true", | /* default_val */ "true", | ||||
"If true and the transaction is complete,\n" | "If true and the transaction is complete,\n" | ||||
" extract and return " | " extract and return " | ||||
"the complete transaction in normal network " | "the complete transaction in normal network " | ||||
"serialization instead of the PSBT."}, | "serialization instead of the PSBT."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"psbt\" : \"value\", (string) The base64-encoded " | " \"psbt\" : \"value\", (string) The base64-encoded " | ||||
"partially signed transaction if not extracted\n" | "partially signed transaction if not extracted\n" | ||||
" \"hex\" : \"value\", (string) The hex-encoded network " | " \"hex\" : \"value\", (string) The hex-encoded network " | ||||
"transaction if extracted\n" | "transaction if extracted\n" | ||||
" \"complete\" : true|false, (boolean) If the transaction has a " | " \"complete\" : true|false, (boolean) If the transaction has a " | ||||
"complete set of signatures\n" | "complete set of signatures\n" | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 2 || | ||||
}, | }, | ||||
}, | }, | ||||
}, | }, | ||||
{"locktime", RPCArg::Type::NUM, /* opt */ true, | {"locktime", RPCArg::Type::NUM, /* opt */ true, | ||||
/* default_val */ "0", | /* default_val */ "0", | ||||
"Raw locktime. Non-0 value also locktime-activates " | "Raw locktime. Non-0 value also locktime-activates " | ||||
"inputs"}, | "inputs"}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
" \"psbt\" (string) The resulting raw transaction " | " \"psbt\" (string) The resulting raw transaction " | ||||
"(base64-encoded string)\n" | "(base64-encoded string)\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("createpsbt", | HelpExampleCli("createpsbt", | ||||
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" " | "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" " | ||||
"\"[{\\\"data\\\":\\\"00010203\\\"}]\"")); | "\"[{\\\"data\\\":\\\"00010203\\\"}]\"")); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() < 1 || | ||||
"The hex string of a raw transaction"}, | "The hex string of a raw transaction"}, | ||||
{"permitsigdata", RPCArg::Type::BOOL, /* opt */ true, | {"permitsigdata", RPCArg::Type::BOOL, /* opt */ true, | ||||
/* default_val */ "false", | /* default_val */ "false", | ||||
"If true, any signatures in the input will be discarded " | "If true, any signatures in the input will be discarded " | ||||
"and conversion\n" | "and conversion\n" | ||||
" will continue. If false, " | " will continue. If false, " | ||||
"RPC will fail if any signatures are present."}, | "RPC will fail if any signatures are present."}, | ||||
}} | }} | ||||
.ToStringWithArgs() + | .ToString() + | ||||
"\nResult:\n" | "\nResult:\n" | ||||
" \"psbt\" (string) The resulting raw transaction " | " \"psbt\" (string) The resulting raw transaction " | ||||
"(base64-encoded string)\n" | "(base64-encoded string)\n" | ||||
"\nExamples:\n" | "\nExamples:\n" | ||||
"\nCreate a transaction\n" + | "\nCreate a transaction\n" + | ||||
HelpExampleCli("createrawtransaction", | HelpExampleCli("createrawtransaction", | ||||
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" " | "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" " | ||||
"\"[{\\\"data\\\":\\\"00010203\\\"}]\"") + | "\"[{\\\"data\\\":\\\"00010203\\\"}]\"") + | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |