 |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Go to the documentation of this file.
31 #include <boost/assign/list_of.hpp>
37 std::vector<CTxDestination> addresses;
49 out.
push_back(Pair(
"reqSigs", nRequired));
63 entry.
push_back(Pair(
"isauditsuccessful", nTime > 0?
"true":
"false"));
90 std::vector<COutPoint> allDecoys = txin.
decoys;
92 allDecoys.insert(allDecoys.begin(), txin.
prevout);
93 for (
size_t i = 0; i < allDecoys.size(); i++) {
96 decoy.
push_back(Pair(
"vout", (int64_t)allDecoys[i].n));
98 std::map<uint256, CWalletTx>::const_iterator mi =
pwalletMain->
mapWallet.find(allDecoys[i].hash);
101 if (allDecoys[i].n < prev.
vout.size()) {
103 std::string outString = allDecoys[i].
hash.
GetHex() + std::to_string(allDecoys[i].n);
111 decoy.
push_back(Pair(
"decoded_amount",
"Wallet is Locked"));
141 for (
unsigned int i = 0; i < tx.
vout.size(); i++) {
159 unsigned char zeroBlind[32];
160 memset(zeroBlind, 0, 32);
161 const unsigned char* pBlind;
166 pBlind = blind.
begin();
169 out.
push_back(Pair(
"decoded_amount",
"Wallet is Locked"));
183 if (!hashBlock.
IsNull()) {
194 entry.
push_back(Pair(
"confirmations", 0));
202 if (fHelp || params.
size() != 1)
203 throw std::runtime_error(
204 "getrawtransactionbyblockheight \"blockheight\" ( verbose )\n"
205 "\nNOTE: By default this function only works sometimes. This is when the tx is in the mempool\n"
206 "or there is an unspent output in the utxo for this transaction. To make it always work,\n"
207 "you need to maintain a transaction index, using the -txindex command line option.\n"
208 "\nReturn the raw transaction data.\n"
209 "\nIf verbose=0, returns a string that is serialized, hex-encoded data for 'txid'.\n"
210 "If verbose is non-zero, returns an Object with information about 'txid'.\n"
213 "1. \"blockheight\" (numeric, required) The transaction id\n"
215 "\nResult (if verbose is not set or set to 0):\n"
216 "\"data\" (string) The serialized, hex-encoded data for 'txid'\n"
218 "\nResult (if verbose > 0):\n"
220 " \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n"
221 " \"blockhash\" : \"hash\", (string) the block hash\n"
222 " \"confirmations\" : n, (numeric) The confirmations\n"
223 " \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
229 int nHeight = params[0].
get_int();
240 for (
size_t i = 0; i < block.
vtx.size(); i++) {
254 if (fHelp || params.
size() < 1 || params.
size() > 3)
255 throw std::runtime_error(
256 "getrawtransaction \"txid\" ( verbose \"blockhash\" )\n"
258 "\nNOTE: By default this function only works sometimes. This is when the tx is in the mempool\n"
259 "or there is an unspent output in the utxo for this transaction. To make it always work,\n"
260 "you need to maintain a transaction index, using the -txindex command line option.\n"
262 "\nReturn the raw transaction data.\n"
263 "\nIf verbose is 'true', returns an Object with information about 'txid'.\n"
264 "If verbose is 'false' or omitted, returns a string that is serialized, hex-encoded data for 'txid'.\n"
267 "1. \"txid\" (string, required) The transaction id\n"
268 "2. verbose (bool, optional, default=false) If false, return a string, otherwise return a json object\n"
269 "3. \"blockhash\" (string, optional) The block in which to look for the transaction\n"
271 "\nResult (if verbose is not set or set to false):\n"
272 "\"data\" (string) The serialized, hex-encoded data for 'txid'\n"
274 "\nResult (if verbose is set to true):\n"
276 " \"in_active_chain\": b, (bool) Whether specified block is in the active chain or not (only present with explicit \"blockhash\" argument)\n"
277 " \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n"
278 " \"txid\" : \"id\", (string) The transaction id (same as provided)\n"
279 " \"size\" : n, (numeric) The serialized transaction size\n"
280 " \"version\" : n, (numeric) The version\n"
281 " \"locktime\" : ttt, (numeric) The lock time\n"
282 " \"vin\" : [ (array of json objects)\n"
284 " \"txid\": \"id\", (string) The transaction id\n"
285 " \"vout\": n, (numeric) \n"
286 " \"scriptSig\": { (json object) The script\n"
287 " \"asm\": \"asm\", (string) asm\n"
288 " \"hex\": \"hex\" (string) hex\n"
290 " \"sequence\": n (numeric) The script sequence number\n"
294 " \"vout\" : [ (array of json objects)\n"
296 " \"value\" : x.xxx, (numeric) The value in PRCY\n"
297 " \"n\" : n, (numeric) index\n"
298 " \"scriptPubKey\" : { (json object)\n"
299 " \"asm\" : \"asm\", (string) the asm\n"
300 " \"hex\" : \"hex\", (string) the hex\n"
301 " \"reqSigs\" : n, (numeric) The required sigs\n"
302 " \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
303 " \"addresses\" : [ (json array of string)\n"
304 " \"prcycoinaddress\" (string) prcycoin address\n"
311 " \"blockhash\" : \"hash\", (string) the block hash\n"
312 " \"confirmations\" : n, (numeric) The confirmations\n"
313 " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT)\n"
314 " \"blocktime\" : ttt (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
321 +
HelpExampleCli(
"getrawtransaction",
"\"mytxid\" false \"myblockhash\"")
322 +
HelpExampleCli(
"getrawtransaction",
"\"mytxid\" true \"myblockhash\"")
327 bool in_active_chain =
true;
331 bool fVerbose =
false;
332 if (!params[1].isNull()) {
333 fVerbose = params[1].
isNum() ? (params[1].
get_int() != 0) : params[1].get_bool();
336 if (!params[2].isNull()) {
342 blockindex = it->second;
354 errmsg =
"No such transaction found in the provided block";
357 ?
"No such mempool or blockchain transaction"
358 :
"No such mempool transaction. Use -txindex to enable blockchain transaction queries";
368 if (blockindex) result.
push_back(Pair(
"in_active_chain", in_active_chain));
376 if (fHelp || params.
size() > 3)
377 throw std::runtime_error(
378 "listunspent ( minconf maxconf [\"address\",...] )\n"
379 "\nReturns array of unspent transaction outputs\n"
380 "with between minconf and maxconf (inclusive) confirmations.\n"
381 "Optionally filter to only include txouts paid to specified addresses.\n"
382 "Results are an array of Objects, each of which has:\n"
383 "{txid, vout, scriptPubKey, amount, confirmations, spendable}\n"
385 "1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n"
386 "2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n"
387 "3. \"addresses\" (string) A json array of prcycoin addresses to filter\n"
389 " \"address\" (string) prcycoin address\n"
393 "[ (array of json object)\n"
395 " \"txid\" : \"txid\", (string) the transaction id\n"
396 " \"vout\" : n, (numeric) the vout value\n"
397 " \"address\" : \"address\", (string) the prcycoin address\n"
398 " \"account\" : \"account\", (string) The associated account, or \"\" for the default account\n"
399 " \"scriptPubKey\" : \"key\", (string) the script key\n"
400 " \"amount\" : x.xxx, (numeric) the transaction amount in PRCY\n"
401 " \"confirmations\" : n, (numeric) The number of confirmations\n"
402 " \"spendable\" : true|false (boolean) Whether we have the private keys to spend this output\n"
408 HelpExampleCli(
"listunspent",
"") +
HelpExampleCli(
"listunspent",
"6 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"") +
HelpExampleRpc(
"listunspent",
"6, 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\""));
413 if (params.
size() > 0)
414 nMinDepth = params[0].
get_int();
416 int nMaxDepth = 9999999;
417 if (params.
size() > 1)
418 nMaxDepth = params[1].
get_int();
420 std::set<CBitcoinAddress> setAddress;
421 if (params.
size() > 2) {
423 for (
unsigned int inx = 0; inx < inputs.
size(); inx++) {
424 const UniValue& input = inputs[inx];
426 if (!address.IsValid())
428 if (setAddress.count(address))
430 setAddress.insert(address);
435 std::vector<COutput> vecOutputs;
439 for (
const COutput& out : vecOutputs) {
440 if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
443 if (setAddress.size()) {
448 if (!setAddress.count(address))
453 const CScript& pk = out.tx->vout[out.i].scriptPubKey;
455 entry.push_back(Pair(
"txid", out.tx->GetHash().GetHex()));
456 entry.push_back(Pair(
"vout", out.i));
463 entry.push_back(Pair(
"scriptPubKey",
HexStr(pk.
begin(), pk.
end())));
467 const CScriptID& hash = boost::get<CScriptID>(address);
474 entry.push_back(Pair(
"confirmations", out.nDepth));
475 entry.push_back(Pair(
"spendable", out.fSpendable));
476 results.push_back(entry);
484 if (fHelp || params.
size() > 3)
485 throw std::runtime_error(
486 "getunspentcount ( minconf maxconf [\"address\",...] )\n"
487 "\nReturns the number of unspent transactions\n"
488 "Optionally filter to only include txouts paid to specified addresses.\n"
490 "1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n"
491 "2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n"
492 "3. \"addresses\" (string) A json array of prcycoin addresses to filter\n"
494 " \"address\" (string) prcycoin address\n"
498 "[ (array of json object)\n"
500 " \"unspentcount\" : x.xxx, (numeric) the number of unspent transactions\n"
506 HelpExampleCli(
"getunspentcount",
"") +
HelpExampleCli(
"getunspentcount",
"6 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"") +
HelpExampleRpc(
"getunspentcount",
"6, 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\""));
511 if (params.
size() > 0)
512 nMinDepth = params[0].
get_int();
514 int nMaxDepth = 9999999;
515 if (params.
size() > 1)
516 nMaxDepth = params[1].
get_int();
518 std::set<CBitcoinAddress> setAddress;
519 if (params.
size() > 2) {
521 for (
unsigned int inx = 0; inx < inputs.
size(); inx++) {
522 const UniValue& input = inputs[inx];
524 if (!address.IsValid())
526 if (setAddress.count(address))
528 setAddress.insert(address);
533 std::vector<COutput> vecOutputs;
537 for (
const COutput& out : vecOutputs) {
538 if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
541 if (setAddress.size()) {
546 if (!setAddress.count(address))
552 obj.push_back(Pair(
"unspentcount", count));
559 if (fHelp || params.
size() < 2 || params.
size() > 3)
560 throw std::runtime_error(
561 "createrawtransaction [{\"txid\":\"id\",\"vout\":n},...] {\"address\":amount,...} ( locktime )\n"
562 "\nCreate a transaction spending the given inputs and sending to the given addresses.\n"
563 "Returns hex-encoded raw transaction.\n"
564 "Note that the transaction's inputs are not signed, and\n"
565 "it is not stored in the wallet or transmitted to the network.\n"
568 "1. \"transactions\" (string, required) A json array of json objects\n"
571 " \"txid\":\"id\", (string, required) The transaction id\n"
572 " \"vout\":n, (numeric, required) The output number\n"
573 " \"sequence\":n (numeric, optional) The sequence number\n"
577 "2. \"addresses\" (string, required) a json object with addresses as keys and amounts as values\n"
579 " \"address\": x.xxx (numeric, required) The key is the prcycoin address, the value is the PRCY amount\n"
582 "3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n"
585 "\"transaction\" (string) hex string of the transaction\n"
588 HelpExampleCli(
"createrawtransaction",
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\" \"{\\\"address\\\":0.01}\"") +
HelpExampleRpc(
"createrawtransaction",
"\"[{\\\"txid\\\":\\\"myid\\\",\\\"vout\\\":0}]\", \"{\\\"address\\\":0.01}\""));
592 if (params[0].isNull() || params[1].isNull())
600 if (params.
size() > 2 && !params[2].
isNull()) {
601 int64_t nLockTime = params[2].
get_int64();
602 if (nLockTime < 0 || nLockTime > std::numeric_limits<uint32_t>::max())
607 for (
unsigned int idx = 0; idx < inputs.
size(); idx++) {
608 const UniValue& input = inputs[idx];
616 int nOutput = vout_v.
get_int();
620 uint32_t nSequence = (rawTx.
nLockTime ? std::numeric_limits<uint32_t>::max() - 1 : std::numeric_limits<uint32_t>::max());
624 if (sequenceObj.
isNum()) {
625 int64_t seqNr64 = sequenceObj.
get_int64();
626 if (seqNr64 < 0 || seqNr64 > std::numeric_limits<uint32_t>::max())
629 nSequence = (uint32_t)seqNr64;
634 rawTx.
vin.push_back(in);
637 std::set<CBitcoinAddress> setAddress;
638 std::vector<std::string> addrList = sendTo.
getKeys();
639 for (
const std::string& name_ : addrList) {
644 if (setAddress.count(address))
646 setAddress.insert(address);
651 CTxOut out(nAmount, scriptPubKey);
652 rawTx.
vout.push_back(out);
660 if (fHelp || params.
size() != 1)
661 throw std::runtime_error(
662 "decoderawtransaction \"hexstring\"\n"
663 "\nReturn a JSON object representing the serialized, hex-encoded transaction.\n"
666 "1. \"hex\" (string, required) The transaction hex string\n"
670 " \"txid\" : \"id\", (string) The transaction id\n"
671 " \"size\" : n, (numeric) The transaction size\n"
672 " \"version\" : n, (numeric) The version\n"
673 " \"locktime\" : ttt, (numeric) The lock time\n"
674 " \"vin\" : [ (array of json objects)\n"
676 " \"txid\": \"id\", (string) The transaction id\n"
677 " \"vout\": n, (numeric) The output number\n"
678 " \"scriptSig\": { (json object) The script\n"
679 " \"asm\": \"asm\", (string) asm\n"
680 " \"hex\": \"hex\" (string) hex\n"
682 " \"sequence\": n (numeric) The script sequence number\n"
686 " \"vout\" : [ (array of json objects)\n"
688 " \"value\" : x.xxx, (numeric) The value in PRCY\n"
689 " \"n\" : n, (numeric) index\n"
690 " \"scriptPubKey\" : { (json object)\n"
691 " \"asm\" : \"asm\", (string) the asm\n"
692 " \"hex\" : \"hex\", (string) the hex\n"
693 " \"reqSigs\" : n, (numeric) The required sigs\n"
694 " \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
695 " \"addresses\" : [ (json array of string)\n"
696 " \"12tvKAXCxZjSmdNbao16dKXC8tRWfcF5oc\" (string) prcycoin address\n"
724 if (fHelp || params.
size() != 1)
725 throw std::runtime_error(
726 "decodescript \"hex\"\n"
727 "\nDecode a hex-encoded script.\n"
729 "1. \"hex\" (string) the hex encoded script\n"
732 " \"asm\":\"asm\", (string) Script public key\n"
733 " \"hex\":\"hex\", (string) hex encoded public key\n"
734 " \"type\":\"type\", (string) The output type\n"
735 " \"reqSigs\": n, (numeric) The required signatures\n"
736 " \"addresses\": [ (json array of string)\n"
737 " \"address\" (string) prcycoin address\n"
740 " \"p2sh\",\"address\" (string) script address\n"
750 if (params[0].get_str().size() > 0) {
751 std::vector<unsigned char> scriptData(
ParseHexV(params[0],
"argument"));
752 script =
CScript(scriptData.begin(), scriptData.end());
763 static void TxInErrorToJSON(
const CTxIn& txin,
UniValue& vErrorsRet,
const std::string& strMessage)
767 entry.push_back(Pair(
"vout", (uint64_t)txin.
prevout.
n));
769 entry.push_back(Pair(
"sequence", (uint64_t)txin.
nSequence));
770 entry.push_back(Pair(
"error", strMessage));
776 if (fHelp || params.
size() < 1 || params.
size() > 4)
777 throw std::runtime_error(
778 "signrawtransaction \"hexstring\" ( [{\"txid\":\"id\",\"vout\":n,\"scriptPubKey\":\"hex\",\"redeemScript\":\"hex\"},...] [\"privatekey1\",...] sighashtype )\n"
779 "\nSign inputs for raw transaction (serialized, hex-encoded).\n"
780 "The second optional argument (may be null) is an array of previous transaction outputs that\n"
781 "this transaction depends on but may not yet be in the block chain.\n"
782 "The third optional argument (may be null) is an array of base58-encoded private\n"
783 "keys that, if given, will be the only keys used to sign the transaction.\n"
789 "1. \"hexstring\" (string, required) The transaction hex string\n"
790 "2. \"prevtxs\" (string, optional) An json array of previous dependent transaction outputs\n"
791 " [ (json array of json objects, or 'null' if none provided)\n"
793 " \"txid\":\"id\", (string, required) The transaction id\n"
794 " \"vout\":n, (numeric, required) The output number\n"
795 " \"scriptPubKey\": \"hex\", (string, required) script key\n"
796 " \"redeemScript\": \"hex\" (string, required for P2SH) redeem script\n"
800 "3. \"privatekeys\" (string, optional) A json array of base58-encoded private keys for signing\n"
801 " [ (json array of strings, or 'null' if none provided)\n"
802 " \"privatekey\" (string) private key in base58-encoding\n"
805 "4. \"sighashtype\" (string, optional, default=ALL) The signature hash type. Must be one of\n"
809 " \"ALL|ANYONECANPAY\"\n"
810 " \"NONE|ANYONECANPAY\"\n"
811 " \"SINGLE|ANYONECANPAY\"\n"
815 " \"hex\" : \"value\", (string) The hex-encoded raw transaction with signature(s)\n"
816 " \"complete\" : true|false, (boolean) If the transaction has a complete set of signatures\n"
817 " \"errors\" : [ (json array of objects) Script verification errors (if there are any)\n"
819 " \"txid\" : \"hash\", (string) The hash of the referenced, previous transaction\n"
820 " \"vout\" : n, (numeric) The index of the output to spent and used as input\n"
821 " \"scriptSig\" : \"hex\", (string) The hex-encoded signature script\n"
822 " \"sequence\" : n, (numeric) Script sequence number\n"
823 " \"error\" : \"text\" (string) Verification or signing error related to the input\n"
840 std::vector<unsigned char> txData(
ParseHexV(params[0],
"argument 1"));
842 std::vector<CMutableTransaction> txVariants;
843 while (!ssData.
empty()) {
847 txVariants.push_back(tx);
848 }
catch (
const std::exception&) {
853 if (txVariants.empty())
861 std::map<COutPoint, CScript> mapPrevOut;
862 if (
Params().IsRegTestNet()) {
863 for (
const CTxIn &txbase : mergedTx.
vin)
881 for (
const CTxIn& txin : mergedTx.
vin) {
890 bool fGivenKeys =
false;
892 if (params.
size() > 2 && !params[2].
isNull()) {
895 for (
unsigned int idx = 0; idx < keys.
size(); idx++) {
913 if (params.
size() > 1 && !params[1].
isNull()) {
915 for (
unsigned int idx = 0; idx < prevTxs.
size(); idx++) {
930 std::vector<unsigned char> pkData(
ParseHexO(prevOut,
"scriptPubKey"));
931 CScript scriptPubKey(pkData.begin(), pkData.end());
935 if (coins->
IsAvailable(nOut) && coins->
vout[nOut].scriptPubKey != scriptPubKey) {
936 std::string err(
"Previous output scriptPubKey mismatch:\n");
937 err = err + coins->
vout[nOut].scriptPubKey.ToString() +
"\nvs:\n" +
941 if ((
unsigned int)nOut >= coins->
vout.size())
942 coins->
vout.resize(nOut + 1);
943 coins->
vout[nOut].scriptPubKey = scriptPubKey;
944 coins->
vout[nOut].nValue = 0;
953 std::vector<unsigned char> rsData(
ParseHexV(v,
"redeemScript"));
954 CScript redeemScript(rsData.begin(), rsData.end());
964 const CKeyStore& keystore = tempKeystore;
968 if (params.
size() > 3 && !params[3].
isNull()) {
969 static std::map<std::string, int> mapSigHashValues =
971 std::string strHashType = params[3].
get_str();
972 if (mapSigHashValues.count(strHashType))
973 nHashType = mapSigHashValues[strHashType];
984 for (
unsigned int i = 0; i < mergedTx.
vin.size(); i++) {
987 if (
Params().IsRegTestNet()) {
988 if (mapPrevOut.count(txin.
prevout) == 0)
990 TxInErrorToJSON(txin, vErrors,
"Input not found");
995 TxInErrorToJSON(txin, vErrors,
"Input not found or already spent");
1003 if (!fHashSingle || (i < mergedTx.
vout.size()))
1004 SignSignature(keystore, prevPubKey, mergedTx, i, nHashType);
1015 bool fComplete = vErrors.
empty();
1019 result.
push_back(Pair(
"complete", fComplete));
1020 if (!vErrors.
empty()) {
1021 result.
push_back(Pair(
"errors", vErrors));
1029 if (fHelp || params.
size() < 1 || params.
size() > 2)
1030 throw std::runtime_error(
1031 "sendrawtransaction \"hexstring\" ( allowhighfees )\n"
1032 "\nSubmits raw transaction (serialized, hex-encoded) to local node and network.\n"
1033 "\nAlso see createrawtransaction and signrawtransaction calls.\n"
1035 "1. \"hexstring\" (string, required) The hex string of the raw transaction)\n"
1036 "2. allowhighfees (boolean, optional, default=false) Allow high fees\n"
1038 "\"hex\" (string) The transaction hash in hex\n"
1040 "\nCreate a transaction\n" +
1041 HelpExampleCli(
"createrawtransaction",
"\"[{\\\"txid\\\" : \\\"mytxid\\\",\\\"vout\\\":0}]\" \"{\\\"myaddress\\\":0.01}\"") +
1042 "Sign the transaction, and get back the hex\n" +
HelpExampleCli(
"signrawtransaction",
"\"myhex\"") +
1043 "\nSend the transaction (signed hex)\n" +
HelpExampleCli(
"sendrawtransaction",
"\"signedhex\"") +
1044 "\nAs a json rpc call\n" +
HelpExampleRpc(
"sendrawtransaction",
"\"signedhex\""));
1054 bool fOverrideFees =
false;
1055 if (params.
size() > 1)
1056 fOverrideFees = params[1].
get_bool();
1062 bool fHaveChain = existingCoins && existingCoins->
nHeight < 1000000000;
1063 if (!fHaveMempool && !fHaveChain) {
1072 }
else if (fHaveChain) {
int64_t GetBlockTime() const
void SetBackend(CCoinsView &viewIn)
An input of a transaction.
A virtual base class for key stores.
@ RPC_MISC_ERROR
General application defined errors.
const uint256 UINT256_ZERO
constant uint256 instances
UniValue createrawtransaction(const UniValue ¶ms, bool fHelp)
UniValue getrawtransaction(const UniValue ¶ms, bool fHelp)
std::map< uint256, CWalletTx > mapWallet
CCoinsModifier ModifyCoins(const uint256 &txid)
Return a modifiable reference to a CCoins.
bool RevealTxOutAmount(const CTransaction &tx, const CTxOut &out, CAmount &amount, CKey &) const
isminetype IsMine(const CTxIn &txin) const
std::string GetHex() const
@ RPC_TRANSACTION_REJECTED
UniValue ValueFromAmount(const CAmount &amount)
CChain chainActive
The currently-connected chain of blocks.
CScript GetScriptForDestination(const CTxDestination &dest)
base58-encoded PRCY addresses.
@ RPC_INVALID_PARAMETER
Ran out of memory during operation.
bool exists(uint256 hash)
UniValue sendrawtransaction(const UniValue ¶ms, bool fHelp)
UniValue signrawtransaction(const UniValue ¶ms, bool fHelp)
const char * ScriptErrorString(const ScriptError serror)
bool IsAvailable(unsigned int nPos) const
check whether a particular output is still available
int nHeight
height of the entry in the chain. The genesis block has height 0
unsigned int GetSerializeSize(char a, int, int=0)
int nHeight
at which height this transaction was included in the active block chain
unsigned int nStatus
Verification status of this block. See enum BlockStatus.
void RPCTypeCheck(const UniValue ¶ms, const std::list< UniValue::VType > &typesExpected, bool fAllowNull)
Type-check arguments; throws JSONRPCError if wrong type given.
bool IsPayToScriptHash() const
std::string GetRejectReason() const
bool IsRegTestNet() const
@ RPC_TRANSACTION_ALREADY_IN_CHAIN
std::string GetHex() const
The basic transaction that is broadcasted on the network and contained in blocks.
enum ScriptError_t ScriptError
A base58-encoded secret key.
std::string HelpRequiringPassphrase()
Abstract view on the open txout dataset.
void const uint64_t uint64_t * r
bool AcceptToMemoryPool(CTxMemPool &pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool *pfMissingInputs, bool fRejectInsaneFee, bool ignoreFees)
(try to) add transaction to memory pool
const std::string & get_str() const
RecursiveMutex cs_main
Global state.
const unsigned char * begin() const
@ RPC_DESERIALIZATION_ERROR
Database error.
std::vector< CTxOut > vout
unspent transaction outputs; spent outputs are .IsNull(); spent outputs at the end of the array are d...
const char * GetTxnOutputType(txnouttype t)
void push_back(const T &value)
int64_t get_int64() const
const UniValue & get_obj() const
RecursiveMutex cs
sum of all mempool tx' byte sizes
#define AssertLockNotHeld(cs)
void RPCTypeCheckObj(const UniValue &o, const std::map< std::string, UniValue::VType > &typesExpected, bool fAllowNull)
Check for expected keys/value types in an Object.
An output of a transaction.
std::vector< unsigned char > ParseHexV(const UniValue &v, std::string strName)
bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock, bool fAllowSlow, CBlockIndex *blockIndex)
Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock.
std::vector< CTxOut > vout
UniValue decoderawtransaction(const UniValue ¶ms, bool fHelp)
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
bool IsValid() const
Check whether this private key is valid.
bool DecodeHexTx(CTransaction &tx, const std::string &strHexTx)
unsigned char GetRejectCode() const
A reference to a mutable cache entry.
std::map< std::string, CKeyImage > outpointToKeyImages
UniValue JSONRPCError(int code, const std::string &message)
int64_t CAmount
Amount in PRCY (Can be negative)
CCoinsViewCache * pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
@ RPC_INVALID_BLOCK_HEIGHT
Client still warming up.
CTxMemPool mempool(::minRelayTxFee)
bool SetString(const char *pszSecret)
virtual bool AddCScript(const CScript &redeemScript)
Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki.
std::vector< COutPoint > decoys
const std::vector< std::string > & getKeys() const
std::string HelpExampleRpc(std::string methodname, std::string args)
256-bit unsigned big integer.
CAmount AmountFromValue(const UniValue &value)
Serialized script, used inside transaction inputs and outputs.
virtual bool GetCScript(const CScriptID &hash, CScript &redeemScriptOut) const
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded Values (throws error if not hex).
const CCoins * AccessCoins(const uint256 &txid) const
Return a pointer to CCoins in the cache, or NULL if not found.
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
int Height() const
Return the maximal height in the chain.
std::string HelpExampleCli(std::string methodname, std::string args)
@ RPC_INVALID_ADDRESS_OR_KEY
Unexpected type was passed as parameter.
void RelayTransaction(const CTransaction &tx)
std::vector< CTransaction > vtx
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, unsigned int flags, const BaseSignatureChecker &checker, ScriptError *serror)
std::vector< CTxOut > vout
void TxToJSON(const CTransaction &tx, const uint256 hashBlock, UniValue &entry)
An encapsulated public key.
bool AvailableCoins(std::vector< COutput > &vCoins, bool fOnlyConfirmed=true, const CCoinControl *coinControl=NULL, bool fIncludeZeroValue=false, AvailableCoinsType nCoinType=ALL_COINS, bool fUseIX=false)
populate vCoins with vector of available COutputs.
std::string GetTransactionType(const CTransaction &tx)
An encapsulated private key.
CCoinsView that adds a memory cache for transactions to another CCoinsView.
virtual bool AddKey(const CKey &key)
void PoSBlockInfoToJSON(const uint256 hashBlock, int64_t nTime, int height, UniValue &entry)
void EnsureWalletIsUnlocked(bool fAllowAnonOnly=false)
std::string ToString() const
A transaction with a bunch of additional info that only the owner cares about.
UniValue listunspent(const UniValue ¶ms, bool fHelp)
bool ReadBlockFromDisk(CBlock &block, const CDiskBlockPos &pos)
bool SignSignature(const CKeyStore &keystore, const CScript &fromPubKey, CMutableTransaction &txTo, unsigned int nIn, int nHashType)
CCoinsView that brings transactions from a memorypool into view.
bool push_back(const UniValue &val)
const CChainParams & Params()
Return the currently selected parameters.
bool Contains(const CBlockIndex *pindex) const
Efficiently check whether a block is present in this chain.
Double ended buffer combining vector and stream-like interfaces.
std::vector< unsigned char > ParseHexO(const UniValue &o, std::string strKey)
Basic key store, that keeps keys in an address->secret map.
std::vector< unsigned char > commitment
const uint256 & GetHash() const
std::string EncodeHexTx(const CTransaction &tx)
An outpoint - a combination of a transaction hash and an index n into its vout.
const UniValue & find_value(const UniValue &obj, const std::string &name)
A mutable version of CTransaction.
const UniValue & get_array() const
UniValue getunspentcount(const UniValue ¶ms, bool fHelp)
CScript CombineSignatures(const CScript &scriptPubKey, const CTransaction &txTo, unsigned int nIn, const CScript &scriptSig1, const CScript &scriptSig2)
Given two sets of signatures for scriptPubKey, possibly with OP_0 placeholders, combine them intellig...
bool ExtractDestinations(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
The block chain is a tree shaped structure starting with the genesis block at the root,...
A reference to a CScript: the Hash160 of its serialization (see script.h)
CTxDestination Get() const
Capture information about block/transaction validation.
void ScriptPubKeyToJSON(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex)
CAmount getCTxOutValue(const CTransaction &tx, const CTxOut &out) const
UniValue getrawtransactionbyblockheight(const UniValue ¶ms, bool fHelp)
const uint256 hash
Memory only.
std::map< CTxDestination, CAddressBookData > mapAddressBook
@ RPC_TRANSACTION_ERROR
Invalid block height.
std::vector< unsigned char > txPub
UniValue decodescript(const UniValue ¶ms, bool fHelp)
uint256 ParseHashO(const UniValue &o, std::string strKey)
std::string ToString() const