36 template <
typename Payload>
41 pl.ToJson(payloadObj);
42 entry.
pushKV(
"payload", payloadObj);
49 case CTransaction::TxType::PROREG: {
51 PayloadToJSON(tx, pl, entry);
54 case CTransaction::TxType::PROUPSERV: {
56 PayloadToJSON(tx, pl, entry);
59 case CTransaction::TxType::PROUPREG: {
61 PayloadToJSON(tx, pl, entry);
64 case CTransaction::TxType::PROUPREV: {
66 PayloadToJSON(tx, pl, entry);
94 std::vector<libzcash::SaplingPaymentAddress> addresses =
97 for (
const auto& addr : addresses) {
100 entry.
pushKV(
"shielded_addresses", addrs);
106 PayloadToJSON(tx, entry);
109 bool chainLock =
false;
110 if (blockindex && tip) {
112 int confirmations = ComputeConfirmations(tip, blockindex);
113 if (confirmations != -1) {
114 entry.
pushKV(
"confirmations", confirmations);
119 entry.
pushKV(
"confirmations", 0);
122 entry.
pushKV(
"chainlock", chainLock);
127 return " \"valueBalance\": n, (numeric) The net value of spend transfers minus output transfers\n"
128 " \"valueBalanceSat\": n, (numeric) `valueBalance` in sats\n"
129 " \"vShieldSpend\": [ (array of json objects)\n"
131 " \"cv\": \"hex\", (string) A value commitment to the value of the input note\n"
132 " \"anchor\": hex, (string) A Merkle root of the Sapling note commitment tree at some block height in the past\n"
133 " \"nullifier\": hex, (string) The nullifier of the input note\n"
134 " \"rk\": hex, (string) The randomized public key for spendAuthSig\n"
135 " \"proof\": hex, (string) A zero-knowledge proof using the spend circuit\n"
136 " \"spendAuthSig\": hex, (string) A signature authorizing this spend\n"
140 " \"vShieldOutput\": [ (array of json objects)\n"
142 " \"cv\": hex, (string) A value commitment to the value of the output note\n"
143 " \"cmu\": hex, (string) The u-coordinate of the note commitment for the output note\n"
144 " \"ephemeralKey\": hex, (string) A Jubjub public key\n"
145 " \"encCiphertext\": hex, (string) A ciphertext component for the encrypted output note\n"
146 " \"outCiphertext\": hex, (string) A ciphertext component for the encrypted output note\n"
147 " \"proof\": hex, (string) A zero-knowledge proof using the output circuit\n"
151 " \"bindingSig\": hex, (string) Prove consistency of valueBalance with the value commitments in spend descriptions and output descriptions, and proves knowledge of the randomness used for the spend and output value commitments\n";
157 throw std::runtime_error(
158 "getrawtransaction \"txid\" ( verbose \"blockhash\" )\n"
160 "\nNOTE: By default this function only works for mempool transactions. If the -txindex option is\n"
161 "enabled, it also works for blockchain transactions. If the block which contains the transaction\n"
162 "is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is\n"
163 "provided, only that block will be searched and if the transaction is in the mempool or other\n"
164 "blocks, or if this node does not have the given block available, the transaction will not be found.\n"
165 "DEPRECATED: for now, it also works for transactions with unspent outputs.\n"
167 "\nReturn the raw transaction data.\n"
168 "\nIf verbose is 'true', returns an Object with information about 'txid'.\n"
169 "If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.\n"
172 "1. \"txid\" (string, required) The transaction id\n"
173 "2. verbose (bool, optional, default=false) If false, return a string, otherwise return a json object\n"
174 "3. \"blockhash\" (string, optional) The block in which to look for the transaction\n"
176 "\nResult (if verbose is not set or set to false):\n"
177 "\"data\" (string) The serialized, hex-encoded data for 'txid'\n"
179 "\nResult (if verbose is set to true):\n"
181 " \"in_active_chain\": b, (bool) Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument)\n"
182 " \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n"
183 " \"txid\" : \"id\", (string) The transaction id (same as provided)\n"
184 " \"size\" : n, (numeric) The serialized transaction size\n"
185 " \"version\" : n, (numeric) The version\n"
186 " \"type\" : n, (numeric) The type\n"
187 " \"locktime\" : ttt, (numeric) The lock time\n"
188 " \"vin\" : [ (array of json objects)\n"
190 " \"txid\": \"id\", (string) The transaction id\n"
191 " \"vout\": n, (numeric) \n"
192 " \"scriptSig\": { (json object) The script\n"
193 " \"asm\": \"asm\", (string) asm\n"
194 " \"hex\": \"hex\" (string) hex\n"
196 " \"sequence\": n (numeric) The script sequence number\n"
200 " \"vout\" : [ (array of json objects)\n"
202 " \"value\" : x.xxx, (numeric) The value in PIV\n"
203 " \"n\" : n, (numeric) index\n"
204 " \"scriptPubKey\" : { (json object)\n"
205 " \"asm\" : \"asm\", (string) the asm\n"
206 " \"hex\" : \"hex\", (string) the hex\n"
207 " \"reqSigs\" : n, (numeric) The required sigs\n"
208 " \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
209 " \"addresses\" : [ (json array of string)\n"
210 " \"pivxaddress\" (string) pivx address\n"
218 " \"shielded_addresses\" (json array of string) the shielded addresses involved in this transaction if possible (only for shielded transactions and the tx owner/viewer)\n"
219 " \"extraPayloadSize\" : n (numeric) Size of extra payload. Only present if it's a special TX\n"
220 " \"extraPayload\" : \"hex\" (string) Hex encoded extra payload data. Only present if it's a special TX\n"
221 " \"blockhash\" : \"hash\", (string) the block hash\n"
222 " \"confirmations\" : n, (numeric) The confirmations\n"
223 " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n"
224 " \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
231 +
HelpExampleCli(
"getrawtransaction",
"\"mytxid\" false \"myblockhash\"")
232 +
HelpExampleCli(
"getrawtransaction",
"\"mytxid\" true \"myblockhash\"")
237 bool in_active_chain =
true;
241 bool fVerbose =
false;
263 errmsg =
"No such transaction found in the provided block";
266 ?
"No such mempool or blockchain transaction"
267 :
"No such mempool transaction. Use -txindex to enable blockchain transaction queries";
277 if (blockindex) result.
pushKV(
"in_active_chain", in_active_chain);
287 throw std::runtime_error(
288 "createrawtransaction [{\"txid\":\"id\",\"vout\":n},...] {\"address\":amount,...} ( locktime )\n"
289 "\nCreate a transaction spending the given inputs and sending to the given addresses.\n"
290 "Returns hex-encoded raw transaction.\n"
291 "Note that the transaction's inputs are not signed, and\n"
292 "it is not stored in the wallet or transmitted to the network.\n"
295 "1. \"inputs\" (string, required) A json array of json objects\n"
298 " \"txid\":\"id\", (string, required) The transaction id\n"
299 " \"vout\":n, (numeric, required) The output number\n"
300 " \"sequence\":n (numeric, optional) The sequence number\n"
304 "2. \"outputs\" (string, required) a json object with addresses as keys and amounts as values\n"
306 " \"address\": x.xxx (numeric, required) The key is the pivx address, the value is the pivx amount\n"
309 "3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n"
312 "\"transaction\" (string) hex string of the transaction\n"
315 HelpExampleCli(
"createrawtransaction",
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"") +
HelpExampleRpc(
"createrawtransaction",
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\""));
329 if (nLockTime < 0 || nLockTime > std::numeric_limits<uint32_t>::max())
334 for (
unsigned int idx = 0; idx < inputs.
size(); idx++) {
335 const UniValue& input = inputs[idx];
343 int nOutput = vout_v.
get_int();
351 if (sequenceObj.
isNum()) {
352 int64_t seqNr64 = sequenceObj.
get_int64();
356 nSequence = (uint32_t)seqNr64;
361 rawTx.
vin.push_back(in);
364 std::set<CTxDestination> setAddress;
365 std::vector<std::string> addrList = sendTo.
getKeys();
366 for (
const std::string& name_ : addrList) {
371 if (setAddress.count(address))
373 setAddress.insert(address);
378 CTxOut out(nAmount, scriptPubKey);
379 rawTx.
vout.push_back(out);
388 throw std::runtime_error(
389 "decoderawtransaction \"hexstring\"\n"
390 "\nReturn a JSON object representing the serialized, hex-encoded transaction.\n"
393 "1. \"hexstring\" (string, required) The transaction hex string\n"
397 " \"txid\" : \"id\", (string) The transaction id\n"
398 " \"size\" : n, (numeric) The transaction size\n"
399 " \"version\" : n, (numeric) The version\n"
400 " \"type\" : n, (numeric) The type\n"
401 " \"locktime\" : ttt, (numeric) The lock time\n"
402 " \"vin\" : [ (array of json objects)\n"
404 " \"txid\": \"id\", (string) The transaction id\n"
405 " \"vout\": n, (numeric) The output number\n"
406 " \"scriptSig\": { (json object) The script\n"
407 " \"asm\": \"asm\", (string) asm\n"
408 " \"hex\": \"hex\" (string) hex\n"
410 " \"sequence\": n (numeric) The script sequence number\n"
414 " \"vout\" : [ (array of json objects)\n"
416 " \"value\" : x.xxx, (numeric) The value in PIV\n"
417 " \"n\" : n, (numeric) index\n"
418 " \"scriptPubKey\" : { (json object)\n"
419 " \"asm\" : \"asm\", (string) the asm\n"
420 " \"hex\" : \"hex\", (string) the hex\n"
421 " \"reqSigs\" : n, (numeric) The required sigs\n"
422 " \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
423 " \"addresses\" : [ (json array of string)\n"
424 " \"12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc\" (string) pivx address\n"
432 " \"extraPayloadSize\" : n (numeric) Size of extra payload. Only present if it's a special TX\n"
433 " \"extraPayload\" : \"hex\" (string) Hex encoded extra payload data. Only present if it's a special TX\n"
457 throw std::runtime_error(
458 "decodescript \"hexstring\"\n"
459 "\nDecode a hex-encoded script.\n"
462 "1. \"hexstring\" (string) the hex encoded script\n"
466 " \"asm\":\"asm\", (string) Script public key\n"
467 " \"hex\":\"hex\", (string) hex encoded public key\n"
468 " \"type\":\"type\", (string) The output type\n"
469 " \"reqSigs\": n, (numeric) The required signatures\n"
470 " \"addresses\": [ (json array of string)\n"
471 " \"address\" (string) pivx address\n"
474 " \"p2sh\",\"address\" (string) script address\n"
486 std::vector<unsigned char> scriptData(
ParseHexV(request.
params[0],
"argument"));
487 script =
CScript(scriptData.begin(), scriptData.end());
498 static void TxInErrorToJSON(
const CTxIn& txin,
UniValue& vErrorsRet,
const std::string& strMessage)
505 entry.
pushKV(
"error", strMessage);
514 throw std::runtime_error(
515 "signrawtransaction \"hexstring\" ( [{\"txid\":\"id\",\"vout\":n,\"scriptPubKey\":\"hex\",\"redeemScript\":\"hex\"},...] [\"privatekey1\",...] sighashtype )\n"
516 "\nSign inputs for raw transaction (serialized, hex-encoded).\n"
517 "The second optional argument (may be null) is an array of previous transaction outputs that\n"
518 "this transaction depends on but may not yet be in the block chain.\n"
519 "The third optional argument (may be null) is an array of base58-encoded private\n"
520 "keys that, if given, will be the only keys used to sign the transaction.\n"
526 "1. \"hexstring\" (string, required) The transaction hex string\n"
527 "2. \"prevtxs\" (string, optional) An json array of previous dependent transaction outputs\n"
528 " [ (json array of json objects, or 'null' if none provided)\n"
530 " \"txid\":\"id\", (string, required) The transaction id\n"
531 " \"vout\":n, (numeric, required) The output number\n"
532 " \"scriptPubKey\": \"hex\", (string, required) script key\n"
533 " \"redeemScript\": \"hex\" (string, required for P2SH) redeem script\n"
534 " \"amount\": value (numeric, required) The amount spent\n"
538 "3. \"privkeys\" (string, optional) A json array of base58-encoded private keys for signing\n"
539 " [ (json array of strings, or 'null' if none provided)\n"
540 " \"privatekey\" (string) private key in base58-encoding\n"
543 "4. \"sighashtype\" (string, optional, default=ALL) The signature hash type. Must be one of\n"
547 " \"ALL|ANYONECANPAY\"\n"
548 " \"NONE|ANYONECANPAY\"\n"
549 " \"SINGLE|ANYONECANPAY\"\n"
553 " \"hex\" : \"value\", (string) The hex-encoded raw transaction with signature(s)\n"
554 " \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n"
555 " \"errors\" : [ (json array of objects) Script verification errors (if there are any)\n"
557 " \"txid\" : \"hash\", (string) The hash of the referenced, previous transaction\n"
558 " \"vout\" : n, (numeric) The index of the output to spent and used as input\n"
559 " \"scriptSig\" : \"hex\", (string) The hex-encoded signature script\n"
560 " \"sequence\" : n, (numeric) Script sequence number\n"
561 " \"error\" : \"text\" (string) Verification or signing error related to the input\n"
575 RPCTypeCheck(request.
params, {UniValue::VSTR, UniValue::VARR, UniValue::VARR, UniValue::VSTR},
true);
577 std::vector<unsigned char> txData(
ParseHexV(request.
params[0],
"argument 1"));
579 std::vector<CMutableTransaction> txVariants;
580 while (!ssData.
empty()) {
584 txVariants.push_back(tx);
585 }
catch (
const std::exception&) {
590 if (txVariants.empty())
598 std::map<COutPoint, std::pair<CScript, CAmount>> mapPrevOut;
599 if (
Params().IsRegTestNet()) {
600 for (
const CTxIn &txbase : mergedTx.
vin)
606 mapPrevOut[txbase.
prevout] = std::make_pair(tempTx->vout[txbase.
prevout.
n].scriptPubKey, tempTx->vout[txbase.
prevout.
n].nValue);
618 for (
const CTxIn& txin : mergedTx.
vin) {
625 bool fGivenKeys =
false;
630 for (
unsigned int idx = 0; idx < keys.
size(); idx++) {
646 for (
unsigned int idx = 0; idx < prevTxs.
size(); idx++) {
667 std::vector<unsigned char> pkData(
ParseHexO(prevOut,
"scriptPubKey"));
668 CScript scriptPubKey(pkData.begin(), pkData.end());
673 std::string err(
"Previous output scriptPubKey mismatch:\n");
683 if (prevOut.
exists(
"amount")) {
686 view.
AddCoin(out, std::move(newcoin),
true);
701 std::vector<unsigned char> rsData(
ParseHexV(v,
"redeemScript"));
702 CScript redeemScript(rsData.begin(), rsData.end());
710 const CKeyStore& keystore = ((fGivenKeys || !pwallet) ? tempKeystore : *pwallet);
712 const CKeyStore& keystore = tempKeystore;
717 static std::map<std::string, int> mapSigHashValues = {
726 if (mapSigHashValues.count(strHashType))
727 nHashType = mapSigHashValues[strHashType];
741 for (
unsigned int i = 0; i < mergedTx.
vin.size(); i++) {
744 if (
Params().IsRegTestNet()) {
747 TxInErrorToJSON(txin, vErrors,
"Input not found");
752 TxInErrorToJSON(txin, vErrors,
"Input not found or already spent");
763 bool fColdStake =
false;
772 if (!fHashSingle || (i < mergedTx.
vout.size()))
774 prevPubKey, sigdata, sigversion, fColdStake);
789 bool fComplete = vErrors.
empty();
793 result.
pushKV(
"complete", fComplete);
794 if (!vErrors.
empty()) {
795 result.
pushKV(
"errors", vErrors);
804 std::promise<void> promise;
805 bool fLimitFree =
true;
810 bool fHaveChain =
false;
811 for (
size_t o = 0; !fHaveChain && o < mtx.
vout.size(); o++) {
813 fHaveChain = !existingCoin.
IsSpent();
816 if (!fHaveMempool && !fHaveChain) {
819 if (!
AcceptToMemoryPool(
mempool, state, MakeTransactionRef(std::move(mtx)), fLimitFree, &fMissingInputs,
false, !fOverrideFees)) {
823 if (fMissingInputs) {
838 }
else if (fHaveChain) {
844 promise.get_future().wait();
862 throw std::runtime_error(
863 "sendrawtransaction \"hexstring\" ( allowhighfees )\n"
864 "\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
865 "\nAlso see createrawtransaction and signrawtransaction calls.\n"
868 "1. \"hexstring\" (string, required) The hex string of the raw transaction)\n"
869 "2. allowhighfees (boolean, optional, default=false) Allow high fees\n"
872 "\"hex\" (string) The transaction hash in hex\n"
875 "\nCreate a transaction\n" +
876 HelpExampleCli(
"createrawtransaction",
"\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") +
877 "Sign the transaction, and get back the hex\n" +
HelpExampleCli(
"signrawtransaction",
"\"myhex\"") +
878 "\nSend the transaction (signed hex)\n" +
HelpExampleCli(
"sendrawtransaction",
"\"signedhex\"") +
879 "\nAs a json rpc call\n" +
HelpExampleRpc(
"sendrawtransaction",
"\"signedhex\""));
889 bool fOverrideFees =
false;
903 {
"rawtransactions",
"createrawtransaction", &
createrawtransaction,
true, {
"inputs",
"outputs",
"locktime"} },
905 {
"rawtransactions",
"decodescript", &
decodescript,
true, {
"hexstring"} },
906 {
"rawtransactions",
"getrawtransaction", &
getrawtransaction,
true, {
"txid",
"verbose",
"blockhash"} },
907 {
"rawtransactions",
"sendrawtransaction", &
sendrawtransaction,
false, {
"hexstring",
"allowhighfees"} },
908 {
"rawtransactions",
"signrawtransaction", &
signrawtransaction,
false, {
"hexstring",
"prevtxs",
"privkeys",
"sighashtype"} },
914 for (
unsigned int vcidx = 0; vcidx <
ARRAYLEN(commands); vcidx++)
int64_t CAmount
Amount in PIV (Can be negative)
const CChainParams & Params()
Return the currently selected parameters.
Basic key store, that keeps keys in an address->secret map.
virtual bool AddCScript(const CScript &redeemScript)
Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki.
The block chain is a tree shaped structure starting with the genesis block at the root,...
uint256 GetBlockHash() const
int64_t GetBlockTime() const
int nHeight
height of the entry in the chain. The genesis block has height 0
uint32_t nStatus
Verification status of this block. See enum BlockStatus.
CBlockIndex * Tip(bool fProofOfStake=false) const
Returns the index entry for the tip of this chain, or nullptr if none.
bool Contains(const CBlockIndex *pindex) const
Efficiently check whether a block is present in this chain.
bool IsRegTestNet() const
void SetBackend(CCoinsView &viewIn)
CCoinsView that adds a memory cache for transactions to another CCoinsView.
void AddCoin(const COutPoint &outpoint, Coin &&coin, bool potential_overwrite)
Add a coin.
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to a Coin in the cache, or a pruned one if not found.
Abstract view on the open txout dataset.
CCoinsView that brings transactions from a memorypool into view.
An encapsulated private key.
bool IsValid() const
Check whether this private key is valid.
A virtual base class for key stores.
virtual bool AddKey(const CKey &key)
Information about a peer.
void PushInventory(const CInv &inv)
An outpoint - a combination of a transaction hash and an index n into its vout.
PIVX RPC command dispatcher.
bool appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
Serialized script, used inside transaction inputs and outputs.
bool IsPayToScriptHash() const
bool IsPayToColdStaking() const
A reference to a CScript: the Hash160 of its serialization (see script.h)
The basic transaction that is broadcasted on the network and contained in blocks.
bool IsShieldedTx() const
An input of a transaction.
static const uint32_t SEQUENCE_FINAL
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
bool exists(uint256 hash) const
An output of a transaction.
Capture information about block/transaction validation.
std::string GetRejectReason() const
std::string GetDebugMessage() const
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
SaplingScriptPubKeyMan * GetSaplingScriptPubKeyMan() const
CTxOut out
unspent transaction output
uint32_t nHeight
at which height the containing transaction was included in the active block chain
std::vector< libzcash::SaplingPaymentAddress > FindMySaplingAddresses(const CTransaction &tx) const
Find all of the addresses in the given tx that have been sent to a SaplingPaymentAddress in this wall...
const std::string & get_str() const
int64_t get_int64() const
const UniValue & get_obj() const
const std::vector< std::string > & getKeys() const
bool push_back(const UniValue &val)
const UniValue & get_array() const
bool exists(const std::string &key) const
bool pushKV(const std::string &key, const UniValue &val)
std::string ToString() const
std::string GetHex() const
std::string EncodeHexTx(const CTransaction &tx)
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.
void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry)
bool HasSaplingSPKM() const
std::unique_ptr< CConnman > g_connman
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, unsigned int flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptError *serror)
isminetype IsMine(const CKeyStore &keystore, const CTxDestination &dest)
@ ISMINE_SPENDABLE_DELEGATED
Indicates that we have the spending key of a P2CS.
std::string EncodePaymentAddress(const libzcash::PaymentAddress &zaddr)
CKey DecodeSecret(const std::string &str)
bool IsValidDestination(const CWDestination &address)
std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType)
CWDestination DecodeDestination(const std::string &strAddress)
std::unique_ptr< CChainLocksHandler > chainLocksHandler
RecursiveMutex cs_main
Global state.
void RegisterRawTransactionRPCCommands(CRPCTable &tableRPC)
Register raw transaction RPC commands.
std::string GetSaplingTxHelpInfo()
void TryATMP(const CMutableTransaction &mtx, bool fOverrideFees)
UniValue signrawtransaction(const JSONRPCRequest &request)
UniValue getrawtransaction(const JSONRPCRequest &request)
void RelayTx(const uint256 &hashTx)
void TxToJSON(CWallet *const pwallet, const CTransaction &tx, const CBlockIndex *tip, const CBlockIndex *blockindex, UniValue &entry)
int ComputeNextBlockAndDepth(const CBlockIndex *tip, const CBlockIndex *blockindex, const CBlockIndex *&next)
UniValue createrawtransaction(const JSONRPCRequest &request)
UniValue decoderawtransaction(const JSONRPCRequest &request)
UniValue sendrawtransaction(const JSONRPCRequest &request)
UniValue decodescript(const JSONRPCRequest &request)
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_MISC_ERROR
General application defined errors.
@ RPC_TRANSACTION_ALREADY_IN_CHAIN
@ RPC_TRANSACTION_REJECTED
@ RPC_TRANSACTION_ERROR
RPC method is deprecated.
@ RPC_INVALID_PARAMETER
Ran out of memory during operation.
@ RPC_DESERIALIZATION_ERROR
Database error.
@ RPC_INVALID_ADDRESS_OR_KEY
Unexpected type was passed as parameter.
@ RPC_CLIENT_P2P_DISABLED
Invalid IP/Subnet.
CWallet * GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
std::string HelpRequiringPassphrase(CWallet *const pwallet)
void EnsureWalletIsUnlocked(CWallet *const pwallet, bool fAllowAnonOnly)
const char * ScriptErrorString(const ScriptError serror)
enum ScriptError_t ScriptError
std::vector< unsigned char > ParseHexV(const UniValue &v, std::string strName)
std::string HelpExampleCli(std::string methodname, std::string args)
void RPCTypeCheck(const UniValue ¶ms, const std::list< UniValue::VType > &typesExpected, bool fAllowNull)
Type-check arguments; throws JSONRPCError if wrong type given.
CAmount AmountFromValue(const UniValue &value)
uint256 ParseHashO(const UniValue &o, std::string strKey)
std::vector< unsigned char > ParseHexO(const UniValue &o, std::string strKey)
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded Values (throws error if not hex).
std::string HelpExampleRpc(std::string methodname, std::string args)
void RPCTypeCheckObj(const UniValue &o, const std::map< std::string, UniValueType > &typesExpected, bool fAllowNull, bool fStrict)
Check for expected keys/value types in an Object.
void UpdateTransaction(CMutableTransaction &tx, unsigned int nIn, const SignatureData &data)
SignatureData DataFromTransaction(const CMutableTransaction &tx, unsigned int nIn)
Extract signature data from a transaction, and insert it.
SignatureData CombineSignatures(const CScript &scriptPubKey, const BaseSignatureChecker &checker, const SignatureData &scriptSig1, const SignatureData &scriptSig2)
Combine two script signatures using a generic signature checker, intelligently, possibly with OP_0 pl...
bool ProduceSignature(const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata, SigVersion sigversion, bool fColdStake, ScriptError *serror)
Produce a script signature using a generic signature creator.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a PIVX scriptPubKey for the given CTxDestination.
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
A mutable version of CTransaction.
uint256 GetHash() const
Compute the hash of this CMutableTransaction.
SigVersion GetRequiredSigVersion() const
std::vector< CTxOut > vout
Wrapper for UniValue::VType, which includes typeAny: Used to denote don't care type.
bool GetTxPayload(const std::vector< unsigned char > &payload, T &obj)
std::shared_ptr< const CTransaction > CTransactionRef
const UniValue & find_value(const UniValue &obj, const std::string &name)
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
bool GetTransaction(const uint256 &hash, CTransactionRef &txOut, uint256 &hashBlock, bool fAllowSlow, CBlockIndex *blockIndex)
Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock.
CTxMemPool mempool(::minRelayTxFee)
std::unique_ptr< CCoinsViewCache > pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
bool AcceptToMemoryPool(CTxMemPool &pool, CValidationState &state, const CTransactionRef &tx, bool fLimitFree, bool *pfMissingInputs, bool fOverrideMempoolLimit, bool fRejectInsaneFee, bool ignoreFees)
(try to) add transaction to memory pool
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
CBlockIndex * LookupBlockIndex(const uint256 &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
void CallFunctionInValidationInterfaceQueue(std::function< void()> func)
Pushes a function to callback onto the notification queue, guaranteeing any callbacks generated prior...