7#include <chainparams.h>
73 entry.
pushKV(
"confirmations",
79 entry.
pushKV(
"confirmations", 0);
88 "\nReturn the raw transaction data.\n"
89 "\nBy default, this call only returns a transaction if it is in the "
90 "mempool. If -txindex is enabled\n"
91 "and no blockhash argument is passed, it will return the transaction "
92 "if it is in the mempool or any block.\n"
93 "If a blockhash argument is passed, it will return the transaction if\n"
94 "the specified block is available and the transaction is in that "
96 "\nIf verbose is 'true', returns an Object with information about "
98 "If verbose is 'false' or omitted, returns a string that is "
99 "serialized, hex-encoded data for 'txid'.\n",
102 "The transaction id"},
106 "If false, return a string, otherwise return a json object",
110 "The block in which to look for the transaction"},
113 RPCResult{
"if verbose is not set or set to false",
115 "The serialized, hex-encoded data for 'txid'"},
117 "if verbose is set to true",
123 "Whether specified block is in the active chain or not "
124 "(only present with explicit \"blockhash\" argument)"},
126 "The serialized, hex-encoded data for 'txid'"},
128 "The transaction id (same as provided)"},
131 "The serialized transaction size"},
143 "The transaction id"},
153 "The script sequence number"},
174 "The required sigs"},
176 "The type, eg 'pubkeyhash'"},
189 "The confirmations"},
199 "\"mytxid\" false \"myblockhash\"") +
201 "\"mytxid\" true \"myblockhash\"")},
216 "The genesis block coinbase is not considered an "
217 "ordinary transaction and cannot be retrieved");
223 if (!request.params[1].isNull()) {
224 fVerbose = request.params[1].isNum()
225 ? (request.params[1].getInt<
int>() != 0)
226 : request.params[1].get_bool();
229 if (!request.params[2].isNull()) {
233 ParseHashV(request.params[2],
"parameter 3"));
237 "Block hash not found");
255 return !blockindex->nStatus.hasData())) {
257 "Block not available");
259 errmsg =
"No such transaction found in the provided block";
262 "No such mempool transaction. Use -txindex or provide "
263 "a block hash to enable blockchain transaction queries";
265 errmsg =
"No such mempool transaction. Blockchain "
266 "transactions are still in the process of being "
269 errmsg =
"No such mempool or blockchain transaction";
273 errmsg +
". Use gettransaction for wallet transactions.");
292 "createrawtransaction",
293 "Create a transaction spending the given inputs and creating new "
295 "Outputs can be addresses or data.\n"
296 "Returns hex-encoded raw transaction.\n"
297 "Note that the transaction's inputs are not signed, and\n"
298 "it is not stored in the wallet or transmitted to the network.\n",
315 "The output number"},
318 "'locktime' argument"},
319 "The sequence number"},
327 "The outputs (key-value pairs), where none of "
328 "the keys are duplicated.\n"
329 "That is, each address can only appear once and there can only "
330 "be one 'data' object.\n"
331 "For compatibility reasons, a dictionary, which holds the "
332 "key-value pairs directly, is also\n"
333 " accepted as second parameter.",
342 "A key-value pair. The key (string) is the "
343 "bitcoin address, the value (float or string) is "
355 "A key-value pair. The key must be \"data\", the "
356 "value is hex-encoded data"},
362 "Raw locktime. Non-0 value also locktime-activates inputs"},
365 "hex string of the transaction"},
368 "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]"
369 "\" \"[{\\\"address\\\":10000.00}]\"") +
371 "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]"
372 "\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"") +
374 "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]"
375 "\", \"[{\\\"address\\\":10000.00}]\"") +
377 "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]"
378 "\", \"[{\\\"data\\\":\\\"00010203\\\"}]\"")},
383 request.params[1], request.params[2]);
392 "decoderawtransaction",
393 "Return a JSON object representing the serialized, hex-encoded "
397 "The transaction hex string"},
418 "The transaction id"},
428 "The script sequence number"},
449 "The required sigs"},
451 "The type, eg 'pubkeyhash'"},
485 "Decode a hex-encoded script.\n",
488 "the hex-encoded script"},
506 "address of P2SH script wrapping this redeem script (not "
507 "returned if the script is already a P2SH)"},
515 if (request.params[0].get_str().size() > 0) {
517 ParseHexV(request.params[0],
"argument"));
541 "combinerawtransaction",
542 "Combine multiple partially signed transactions into one "
544 "The combined transaction may be another partially signed transaction "
546 "fully signed transaction.",
552 "The hex strings of partially signed "
557 "A hex-encoded raw transaction"},
562 "The hex-encoded raw transaction with signature(s)"},
564 R
"('["myhex1", "myhex2", "myhex3"]')")},
570 for (
unsigned int idx = 0; idx <
txs.size(); idx++) {
574 strprintf(
"TX decode failed for tx %d", idx));
580 "Missing transactions");
614 for (
size_t i = 0; i <
mergedTx.vin.size(); i++) {
619 "Input not found or already spent");
627 if (
txv.vin.size() > i) {
647 "signrawtransactionwithkey",
648 "Sign inputs for raw transaction (serialized, hex-encoded).\n"
649 "The second argument is an array of base58-encoded private\n"
650 "keys that will be the only keys used to sign the transaction.\n"
651 "The third optional argument (may be null) is an array of previous "
652 "transaction outputs that\n"
653 "this transaction depends on but may not yet be in the block chain.\n",
656 "The transaction hex string"},
661 "The base58-encoded private keys for signing",
664 "private key in base58-encoding"},
671 "The previous dependent transaction outputs",
682 "The output number"},
687 "(required for P2SH) redeem script"},
695 "The signature hash type. Must be one of:\n"
698 " \"SINGLE|FORKID\"\n"
699 " \"ALL|FORKID|ANYONECANPAY\"\n"
700 " \"NONE|FORKID|ANYONECANPAY\"\n"
701 " \"SINGLE|FORKID|ANYONECANPAY\""},
709 "The hex-encoded raw transaction with signature(s)"},
711 "If the transaction has a complete set of signatures"},
715 "Script verification errors (if there are any)",
722 "The hash of the referenced, previous transaction"},
724 "The index of the output to spent and used as "
727 "The hex-encoded signature script"},
729 "Script sequence number"},
731 "Verification or signing error related to the "
738 "\"myhex\" \"[\\\"key1\\\",\\\"key2\\\"]\"") +
740 "\"myhex\", \"[\\\"key1\\\",\\\"key2\\\"]\"")},
751 for (
size_t idx = 0; idx < keys.
size(); ++idx) {
756 "Invalid private key");
762 std::map<COutPoint, Coin> coins;
768 FindCoins(
node, coins);
783 "Return a JSON object representing the serialized, base64-encoded "
784 "partially signed Bitcoin transaction.\n",
787 "The PSBT base64 string"},
796 "The decoded network-serialized unsigned transaction.",
799 "The layout is the same as the output of "
800 "decoderawtransaction."},
804 "The unknown global fields",
807 "(key-value pair) An unknown key-value pair"},
820 "Transaction output for UTXOs",
832 "The type, eg 'pubkeyhash'"},
834 " Bitcoin address if there is one"},
838 "partial_signatures",
843 "The public key and signature that corresponds "
847 "The sighash type to be used"},
856 "The type, eg 'pubkeyhash'"},
866 "The public key with the derivation path as "
870 "The fingerprint of the master key"},
884 "The unknown global fields",
887 "(key-value pair) An unknown key-value pair"},
907 "The type, eg 'pubkeyhash'"},
919 "The public key this path corresponds to"},
921 "The fingerprint of the master key"},
927 "The unknown global fields",
930 "(key-value pair) An unknown key-value pair"},
935 "The transaction fee paid if all UTXOs slots in the PSBT have "
957 if (
psbtx.unknown.size() > 0) {
959 for (
auto entry :
psbtx.unknown) {
969 for (
size_t i = 0; i <
psbtx.inputs.size(); ++i) {
990 in.pushKV(
"utxo", out);
1002 in.pushKV(
"partial_signatures", partial_sigs);
1016 in.pushKV(
"redeem_script", r);
1027 "master_fingerprint",
1029 ReadBE32(entry.second.fingerprint)));
1047 if (input.
unknown.size() > 0) {
1049 for (
auto entry : input.
unknown) {
1058 result.
pushKV(
"inputs", inputs);
1063 for (
size_t i = 0; i <
psbtx.outputs.size(); ++i) {
1070 out.
pushKV(
"redeem_script", r);
1080 "master_fingerprint",
1082 ReadBE32(entry.second.fingerprint)));
1091 if (output.
unknown.size() > 0) {
1093 for (
auto entry : output.
unknown) {
1111 result.
pushKV(
"outputs", outputs);
1124 "Combine multiple partially signed Bitcoin transactions into one "
1126 "Implements the Combiner role.\n",
1132 "The base64 strings of partially signed transactions",
1135 "A base64 string of a PSBT"},
1140 "The base64-encoded partially signed transaction"},
1142 "combinepsbt", R
"('["mybase64_1", "mybase64_2", "mybase64_3"]')")},
1146 std::vector<PartiallySignedTransaction>
psbtxs;
1150 "Parameter 'txs' cannot be empty");
1152 for (
size_t i = 0; i <
txs.size(); ++i) {
1178 "Finalize the inputs of a PSBT. If the transaction is fully signed, it "
1180 "network serialized transaction which can be broadcast with "
1181 "sendrawtransaction. Otherwise a PSBT will be\n"
1182 "created which has the final_scriptSigfields filled for inputs that "
1184 "Implements the Finalizer and Extractor roles.\n",
1187 "A base64 string of a PSBT"},
1189 "If true and the transaction is complete,\n"
1190 " extract and return the complete "
1191 "transaction in normal network serialization instead of the "
1199 "The base64-encoded partially signed transaction if not "
1202 "The hex-encoded network transaction if extracted"},
1204 "If the transaction has a complete set of signatures"},
1218 request.params[1].isNull() ||
1219 (!request.params[1].isNull() && request.params[1].get_bool());
1237 result.
pushKV(
"complete", complete);
1247 "Creates a transaction in the Partially Signed Transaction format.\n"
1248 "Implements the Creator role.\n",
1265 "The output number"},
1268 "'locktime' argument"},
1269 "The sequence number"},
1277 "The outputs (key-value pairs), where none of "
1278 "the keys are duplicated.\n"
1279 "That is, each address can only appear once and there can only "
1280 "be one 'data' object.\n"
1281 "For compatibility reasons, a dictionary, which holds the "
1282 "key-value pairs directly, is also\n"
1283 " accepted as second parameter.",
1292 "A key-value pair. The key (string) is the "
1293 "bitcoin address, the value (float or string) is "
1305 "A key-value pair. The key must be \"data\", the "
1306 "value is hex-encoded data"},
1312 "Raw locktime. Non-0 value also locktime-activates inputs"},
1315 "The resulting raw transaction (base64-encoded string)"},
1317 "createpsbt",
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]"
1318 "\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"")},
1323 request.params[1], request.params[2]);
1328 for (
size_t i = 0; i <
rawTx.vin.size(); ++i) {
1331 for (
size_t i = 0; i <
rawTx.vout.size(); ++i) {
1347 "Converts a network serialized transaction to a PSBT. "
1348 "This should be used only with createrawtransaction and "
1349 "fundrawtransaction\n"
1350 "createpsbt and walletcreatefundedpsbt should be used for new "
1354 "The hex string of a raw transaction"},
1356 "If true, any signatures in the input will be discarded and "
1358 " will continue. If false, RPC will "
1359 "fail if any signatures are present."},
1362 "The resulting raw transaction (base64-encoded string)"},
1364 "\nCreate a transaction\n" +
1366 "\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]"
1367 "\" \"[{\\\"data\\\":\\\"00010203\\\"}]\"") +
1368 "\nConvert the transaction to a PSBT\n" +
1376 : request.params[1].get_bool();
1377 if (!
DecodeHexTx(tx, request.params[0].get_str())) {
1379 "TX decode failed");
1386 "Inputs must not have scriptSigs");
1388 input.scriptSig.clear();
1394 for (
size_t i = 0; i < tx.
vin.size(); ++i) {
1397 for (
size_t i = 0; i < tx.
vout.size(); ++i) {
1413 "Updates all inputs and outputs in a PSBT with data from output "
1414 "descriptors, the UTXO set or the mempool.\n",
1417 "A base64 string of a PSBT"},
1421 "An array of either strings or objects",
1424 "An output descriptor"},
1428 "An object with an output descriptor and extra information",
1431 "An output descriptor"},
1433 "Up to what index HD chains should be explored (either "
1434 "end or [begin,end])"},
1439 "The base64-encoded partially signed transaction with inputs "
1454 if (!request.params[1].isNull()) {
1455 auto descs = request.params[1].get_array();
1456 for (
size_t i = 0; i <
descs.size(); ++i) {
1489 for (
size_t i = 0; i <
psbtx.tx->vin.size(); ++i) {
1505 for (
unsigned int i = 0; i <
psbtx.tx->vout.size(); ++i) {
1519 "Joins multiple distinct PSBTs with different inputs and outputs "
1520 "into one PSBT with inputs and outputs from all of the PSBTs\n"
1521 "No input in any of the PSBTs can be in more than one of the PSBTs.\n",
1525 "The base64 strings of partially signed transactions",
1527 "A base64 string of a PSBT"}}}},
1529 "The base64-encoded partially signed transaction"},
1534 std::vector<PartiallySignedTransaction>
psbtxs;
1537 if (
txs.size() <= 1) {
1540 "At least two PSBTs are required to join PSBTs.");
1545 for (
size_t i = 0; i <
txs.size(); ++i) {
1571 for (
size_t i = 0; i <
psbt.tx->vin.size(); ++i) {
1576 strprintf(
"Input %s:%d exists in multiple PSBTs",
1581 psbt.tx->vin[i].prevout.GetN()));
1584 for (
size_t i = 0; i <
psbt.tx->vout.size(); ++i) {
1588 psbt.unknown.end());
1629 "Analyzes and provides information about the current status of a "
1630 "PSBT and its inputs\n",
1632 "A base64 string of a PSBT"}},
1647 "Whether a UTXO is provided"},
1649 "Whether the input is finalized"},
1653 "Things that are missing that are required to "
1654 "complete this input",
1662 "Public key ID, hash160 of the public "
1663 "key, of a public key whose BIP 32 "
1664 "derivation path is missing"},
1672 "Public key ID, hash160 of the public "
1673 "key, of a public key whose signature is "
1678 "Hash160 of the redeemScript that is missing"},
1681 "Role of the next person that this input needs to "
1686 "Estimated vsize of the final signed transaction"},
1689 "Estimated feerate of the final signed transaction in " +
1691 "/kB. Shown only if all UTXO slots in the PSBT have been "
1694 "The transaction fee paid. Shown only if all UTXO slots in "
1695 "the PSBT have been filled"},
1697 "Role of the next person that this psbt needs to go to"},
1699 "Error message (if there is one)"},
1716 for (
const auto &input :
psbta.inputs) {
1720 input_univ.pushKV(
"has_utxo", input.has_utxo);
1721 input_univ.pushKV(
"is_final", input.is_final);
1724 if (!input.missing_pubkeys.empty()) {
1726 for (
const CKeyID &pubkey : input.missing_pubkeys) {
1731 if (!input.missing_redeem_script.IsNull()) {
1732 missing.pushKV(
"redeemscript",
1733 HexStr(input.missing_redeem_script));
1735 if (!input.missing_sigs.empty()) {
1737 for (
const CKeyID &pubkey : input.missing_sigs) {
1742 if (!
missing.getKeys().empty()) {
1750 if (
psbta.estimated_vsize != std::nullopt) {
1751 result.
pushKV(
"estimated_vsize", (
int)*
psbta.estimated_vsize);
1753 if (
psbta.estimated_feerate != std::nullopt) {
1754 result.
pushKV(
"estimated_feerate",
1755 psbta.estimated_feerate->GetFeePerK());
1757 if (
psbta.fee != std::nullopt) {
1761 if (!
psbta.error.empty()) {
1772 "gettransactionstatus",
1773 "Return the current pool a transaction belongs to\n",
1776 "The transaction id"},
1784 "In which pool the transaction is currently located, "
1785 "either none, mempool, orphanage or conflicting"},
1787 "If the transaction is mined, this is the blockhash of the "
1788 "mining block, otherwise \"none\". This field is only "
1789 "present if -txindex is enabled."},
1801 if (mempool.
exists(txid)) {
1802 ret.pushKV(
"pool",
"mempool");
1805 return orphanage.HaveTx(txid);
1807 ret.pushKV(
"pool",
"orphanage");
1810 return conflicting.HaveTx(txid);
1812 ret.pushKV(
"pool",
"conflicting");
1814 ret.pushKV(
"pool",
"none");
1818 if (!
g_txindex->BlockUntilSyncedToCurrentChain()) {
1821 "Blockchain transactions are still in the process of "
1827 if (
g_txindex->FindTx(txid, blockhash, tx)) {
1828 ret.pushKV(
"block", blockhash.
GetHex());
1830 ret.pushKV(
"block",
"none");
1861 for (
const auto &
c : commands) {
1862 t.appendCommand(
c.name, &
c);
bool MoneyRange(const Amount nValue)
std::string WriteHDKeypath(const std::vector< uint32_t > &keypath)
Write HD keypaths as strings.
The block chain is a tree shaped structure starting with the genesis block at the root,...
int64_t GetBlockTime() const
int nHeight
height of the entry in the chain. The genesis block has height 0
bool Contains(const CBlockIndex *pindex) const
Efficiently check whether a block is present in this chain.
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
const CBlock & GenesisBlock() const
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Abstract view on the open txout dataset.
CCoinsView that brings transactions from a mempool into view.
Double ended buffer combining vector and stream-like interfaces.
An encapsulated secp256k1 private key.
bool IsValid() const
Check whether this private key is valid.
A reference to a CKey: the Hash160 of its serialized public key.
A mutable version of CTransaction.
std::vector< CTxOut > vout
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
An input of a transaction.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
bool exists(const TxId &txid) const
auto withOrphanage(Callable &&func) const EXCLUSIVE_LOCKS_REQUIRED(!cs_orphanage)
auto withConflicting(Callable &&func) const EXCLUSIVE_LOCKS_REQUIRED(!cs_conflicting)
An output of a transaction.
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
SnapshotCompletionResult MaybeCompleteSnapshotValidation(std::function< void(bilingual_str)> shutdown_fnc=[](bilingual_str msg) { AbortNode(msg.original, msg);}) EXCLUSIVE_LOCKS_REQUIRED(Chainstate & ActiveChainstate() const
Once the background validation chainstate has reached the height which is the base of the UTXO snapsh...
CChain & ActiveChain() const EXCLUSIVE_LOCKS_REQUIRED(GetMutex())
node::BlockManager m_blockman
A single BlockManager instance is shared across each constructed chainstate to avoid duplicating bloc...
Fillable signing provider that keeps keys in an address->secret map.
A signature creator for transactions.
Signature hash type wrapper class.
uint32_t getRawSigHashType() const
void push_back(UniValue val)
const std::string & get_str() const
const UniValue & find_value(std::string_view key) const
const UniValue & get_array() const
void pushKV(std::string key, UniValue val)
std::string GetHex() const
CBlockIndex * LookupBlockIndex(const BlockHash &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
void ScriptToUniv(const CScript &script, UniValue &out, bool include_address)
void TxToUniv(const CTransaction &tx, const BlockHash &hashBlock, UniValue &entry, bool include_hex=true, int serialize_flags=0, const CTxUndo *txundo=nullptr)
std::string SighashToStr(uint8_t sighash_type)
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex)
bool DecodeHexTx(CMutableTransaction &tx, const std::string &strHexTx)
std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode=false)
Create the assembly string representation of a CScript object.
std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags=0)
static uint32_t ReadBE32(const uint8_t *ptr)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
std::string EncodeDestination(const CTxDestination &dest, const Config &config)
CKey DecodeSecret(const std::string &str)
bool error(const char *fmt, const Args &...args)
PSBTAnalysis AnalyzePSBT(PartiallySignedTransaction psbtx)
Provides helpful miscellaneous information about where a PSBT is in the signing workflow.
TransactionError BroadcastTransaction(const NodeContext &node, const CTransactionRef tx, std::string &err_string, const Amount max_tx_fee, bool relay, bool wait_callback)
Submit a transaction to the mempool and (optionally) relay it to all P2P peers.
CTransactionRef GetTransaction(const CBlockIndex *const block_index, const CTxMemPool *const mempool, const TxId &txid, BlockHash &hashBlock, const BlockManager &blockman)
Return transaction with a given txid.
void FindCoins(const NodeContext &node, std::map< COutPoint, Coin > &coins)
Look up unspent output information.
std::shared_ptr< const CTransaction > CTransactionRef
bool DecodeBase64PSBT(PartiallySignedTransaction &psbt, const std::string &base64_tx, std::string &error)
Decode a base64ed PSBT into a PartiallySignedTransaction.
void UpdatePSBTOutput(const SigningProvider &provider, PartiallySignedTransaction &psbt, int index)
Updates a PSBTOutput with information from provider.
std::string PSBTRoleName(const PSBTRole role)
bool FinalizeAndExtractPSBT(PartiallySignedTransaction &psbtx, CMutableTransaction &result)
Finalizes a PSBT if possible, and extracts it to a CMutableTransaction if it could be finalized.
TransactionError CombinePSBTs(PartiallySignedTransaction &out, const std::vector< PartiallySignedTransaction > &psbtxs)
Combines PSBTs with the same underlying transaction, resulting in a single PSBT with all partial sign...
bool SignPSBTInput(const SigningProvider &provider, PartiallySignedTransaction &psbt, int index, SigHashType sighash, SignatureData *out_sigdata, bool use_dummy)
Signs a PSBTInput, verifying that all provided data matches what is being signed.
void Shuffle(I first, I last, R &&rng)
More efficient than using std::shuffle on a FastRandomContext.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
static RPCHelpMan getrawtransaction()
static RPCHelpMan converttopsbt()
static RPCHelpMan decoderawtransaction()
static RPCHelpMan combinepsbt()
static RPCHelpMan decodepsbt()
RPCHelpMan gettransactionstatus()
static RPCHelpMan decodescript()
static RPCHelpMan createpsbt()
RPCHelpMan utxoupdatepsbt()
static RPCHelpMan combinerawtransaction()
static void TxToJSON(const CTransaction &tx, const BlockHash &hashBlock, UniValue &entry, Chainstate &active_chainstate)
static RPCHelpMan signrawtransactionwithkey()
static RPCHelpMan createrawtransaction()
static RPCHelpMan finalizepsbt()
void RegisterRawTransactionRPCCommands(CRPCTable &t)
void SignTransaction(CMutableTransaction &mtx, const SigningProvider *keystore, const std::map< COutPoint, Coin > &coins, const UniValue &hashType, UniValue &result)
Sign a transaction with the given keystore and previous transactions.
CMutableTransaction ConstructTransaction(const CChainParams ¶ms, const UniValue &inputs_in, const UniValue &outputs_in, const UniValue &locktime)
Create a transaction from univalue parameters.
void ParsePrevouts(const UniValue &prevTxsUnival, FillableSigningProvider *keystore, std::map< COutPoint, Coin > &coins)
Parse a prevtxs UniValue array and get the map of coins from it.
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_MISC_ERROR
General application defined errors std::exception thrown in command handling.
@ RPC_INVALID_PARAMETER
Invalid, missing or duplicate parameter.
@ RPC_VERIFY_ERROR
General error during transaction or block submission.
@ RPC_DESERIALIZATION_ERROR
Error parsing or validating structure in raw format.
@ RPC_INVALID_ADDRESS_OR_KEY
Invalid address or key.
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
UniValue JSONRPCTransactionError(TransactionError terr, const std::string &err_string)
std::vector< uint8_t > ParseHexV(const UniValue &v, std::string strName)
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
std::vector< CScript > EvalDescriptorStringOrObject(const UniValue &scanobject, FlatSigningProvider &provider)
Evaluate a descriptor given as a string, or as a {"desc":...,"range":...} object, with default range ...
const std::string UNIX_EPOCH_TIME
String used to describe UNIX epoch time in documentation, factored out to a constant for consistency.
std::string GetAllOutputTypes()
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded values (throws error if not hex).
#define extract(n)
Extract the lowest 64 bits of (c0,c1,c2) into n, and left shift the number 64 bits.
int RPCSerializationFlags()
Retrieves any serialization flags requested in command line argument.
NodeContext & EnsureAnyNodeContext(const std::any &context)
CTxMemPool & EnsureMemPool(const NodeContext &node)
ChainstateManager & EnsureChainman(const NodeContext &node)
bool ProduceSignature(const SigningProvider &provider, const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata)
Produce a script signature using a generic signature creator.
void UpdateInput(CTxIn &input, const SignatureData &data)
SignatureData DataFromTransaction(const CMutableTransaction &tx, unsigned int nIn, const CTxOut &txout)
Extract signature data from a transaction input, and insert it.
const SigningProvider & DUMMY_SIGNING_PROVIDER
static constexpr Amount zero() noexcept
A BlockHash is a unqiue identifier for a block.
static const Currency & get()
A structure for PSBTs which contains per output information.
std::map< CPubKey, KeyOriginInfo > hd_keypaths
std::map< std::vector< uint8_t >, std::vector< uint8_t > > unknown
A version of CTransaction with the PSBT format.
std::optional< CMutableTransaction > tx
@ RANGE
Special type that is a NUM or [NUM,NUM].
@ OBJ_USER_KEYS
Special type where the user must set the keys e.g.
@ STR_HEX
Special type that is a STR with only hex chars.
@ AMOUNT
Special type representing a floating point amount (can be either NUM or STR)
std::string DefaultHint
Hint for default value.
@ OMITTED
The arg is optional for one of two reasons:
@ ELISION
Special type to denote elision (...)
@ NUM_TIME
Special numeric to denote unix epoch time.
@ OBJ_DYN
Special dictionary with keys that are not literals.
@ STR_HEX
Special string with only hex chars.
@ STR_AMOUNT
Special string to represent a floating point amount.
void MergeSignatureData(SignatureData sigdata)
A TxId is the identifier of a transaction.
NodeContext struct containing references to chain state and connection state.
Holds the results of AnalyzePSBT (miscellaneous information about a PSBT)
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
std::unique_ptr< TxIndex > g_txindex
The global transaction index, used in GetTransaction. May be null.
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
std::string EncodeBase64(Span< const uint8_t > input)
static const int PROTOCOL_VERSION
network protocol versioning