37 static const std::string WALLET_ENDPOINT_BASE =
"/wallet/";
41 if (request.
URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) {
43 std::string requestedWallet =
urlDecode(request.
URI.substr(WALLET_ENDPOINT_BASE.size()));
45 if (pwallet->
GetName() == requestedWallet) {
56 return pwallet && pwallet->
IsCrypted() ?
"\nRequires wallet passphrase to be set with walletpassphrase call." :
"";
61 if (pwallet)
return true;
62 if (avoidException)
return false;
68 "Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path).");
82 entry.
pushKV(
"confirmations", confirms);
83 entry.
pushKV(
"bcconfirmations", confirms);
85 entry.
pushKV(
"generated",
true);
97 conflicts.push_back(conflict.GetHex());
98 entry.
pushKV(
"walletconflicts", conflicts);
101 for (
const std::pair<std::string, std::string> & item : wtx.
mapValue)
102 entry.
pushKV(item.first, item.second);
107 std::string label = value.
get_str();
125 return *r.getObjResult();
133 ret.pushKV(
"name", data.
name);
135 ret.pushKV(
"purpose", data.
purpose);
154 const std::string example_address =
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"";
157 throw std::runtime_error(
158 "getaddressinfo ( \"address\" )\n"
159 "\nReturn information about the given PIVX address.\n"
160 "Some of the information will only be present if the address is in the active wallet.\n"
161 "Metadata for shield addresses is available only if the wallet is unlocked.\n"
163 " \"address\" : \"address\", (string) The PIVX address validated.\n"
164 " \"isshield\" : true|false, (boolean) If the address is shield or transparent.\n"
165 " \"scriptPubKey\" : \"hex\", (string, only if isshield=false) The hex-encoded scriptPubKey generated by the address.\n"
166 " \"ischange\" : true|false, (boolean) If the transparent address was used for change output.\n"
167 " \"ismine\" : true|false, (boolean) If the address is yours.\n"
168 " \"iswatchonly\" : true|false, (boolean) If the address is watchonly.\n"
169 " \"label\" : \"label\" (string) The label associated with the address, \"\" is the default label.\n"
170 " \"timestamp\" : timestamp, (number, optional) The creation time of the key, if available, expressed in the UNIX epoch time.\n"
171 " \"hdkeypath\" : \"keypath\" (string, optional) The HD keypath, if the key is HD and available.\n"
172 " \"hdseedid\" : \"<hash160>\" (string, optional) The Hash160 of the HD seed.\n"
173 " \"hdmasterfingerprint\" : \"<hash160>\" (string, optional) The fingerprint of the master key.\n"
174 " \"labels\" (json object) An array of labels associated with the address. Currently limited to one label but returned\n"
175 " as an array to keep the API stable if multiple labels are enabled in the future.\n"
177 " { (json object of label data)\n"
178 " \"name\" : \"labelname\" (string) The label.\n"
179 " \"purpose\" : \"purpose\" (string) The purpose of the associated address (send or receive).\n"
192 ret.
pushKV(
"address", strAdd);
201 ret.
pushKV(
"isshield", pTransDest ==
nullptr);
224 if (spk_man && pTransDest) {
226 const CKeyID* keyID = boost::get<CKeyID>(pTransDest);
233 }
else if (sspk_man && !pTransDest) {
267 labels.
push_back(AddressBookDataToJSON(*addrBookData,
true));
269 ret.
pushKV(
"labels", std::move(labels));
282 throw std::runtime_error(
283 "getaddressesbylabel \"label\"\n"
284 "\nReturns the list of addresses assigned the specified label.\n"
287 "1. \"label\" (string, required) The label.\n"
290 "{ (json object with addresses as keys)\n"
291 " \"address\": { (json object with information about address)\n"
292 " \"purpose\": \"string\" (string) Purpose of address (\"send\" for sending address, \"receive\" for receiving address)\n"
308 auto addrBook = it.GetValue();
309 if (addrBook.name == label) {
310 if (!addrBook.isShielded()) {
333 throw std::runtime_error(
334 "listlabels ( \"purpose\" )\n"
335 "\nReturns the list of all labels, or labels that are assigned to addresses with a specific purpose.\n"
338 "1. \"purpose\" (string, optional) Address purpose to list labels for ('send','receive', 'delegable', 'delegator', 'coldstaking', 'coldstaking_send', 'refund'). An empty string is the same as not providing this argument.\n"
341 "[ (json array of string)\n"
342 " \"label\", (string) Label name\n"
347 "\nList all labels\n"
349 "\nList labels that have receiving addresses\n"
351 "\nList labels that have sending addresses\n"
353 "\nAs json rpc call\n"
365 std::set<std::string> label_set;
367 auto addrBook = it.GetValue();
368 if (purpose.empty() || addrBook.purpose == purpose) {
369 label_set.insert(addrBook.name);
374 for (
const std::string&
name : label_set) {
402 throw std::runtime_error(
"upgradewallet\n"
403 "Bump the wallet features to the latest supported version. Non-HD wallets will be upgraded to HD wallet functionality. "
404 "Marking all the previous keys as pre-split keys and managing them separately. Once the last key in the pre-split keypool gets marked as used (received balance), the wallet will automatically start using the HD generated keys.\n"
405 "The upgraded HD wallet will have a new HD seed set so that new keys added to the keypool will be derived from this new seed.\n"
406 "Wallets that are already running the latest HD version will be upgraded to Sapling support\n"
407 "Enabling the Sapling key manager. Sapling keys will be deterministically derived by the same HD wallet seed.\n"
408 "Wallets that are running the latest Sapling version will not be upgraded"
409 "\nNote that you will need to MAKE A NEW BACKUP of your wallet after upgrade it.\n"
430 std::string upgradeError;
431 if (!pwallet->
Upgrade(upgradeError, prev_version)) {
432 upgradeError =
strprintf(
"Error: Cannot upgrade wallet, %s", upgradeError);
447 throw std::runtime_error(
"sethdseed ( newkeypool \"seed\" )\n"
448 "Set or generate a new HD wallet seed. Non-HD wallets will not be upgraded to being a HD wallet. Wallets that are already\n"
449 "HD will have a new HD seed set so that new keys added to the keypool will be derived from this new seed.\n"
450 "\nNote that you will need to MAKE A NEW BACKUP of your wallet after setting the HD wallet seed.\n"
454 "1. newkeypool (boolean, optional, default true): Whether to flush old unused addresses, including change addresses, from the keypool and regenerate it.\n"
455 " If true, the next address from getnewaddress and change address from getrawchangeaddress will be from this new seed.\n"
456 " If false, addresses (including change addresses if the wallet already had HD Chain Split enabled) from the existing\n"
457 " keypool will be used until it has been depleted."
458 "2. \"seed\" (string, optional, default random seed): The WIF private key to use as the new HD seed.\n"
459 " The seed value can be retrieved using the dumpwallet command. It is the private key marked hdseed=1"
478 throw JSONRPCError(
RPC_WALLET_ERROR,
"Cannot set a HD seed on a non-HD wallet. Start with -upgradewallet in order to upgrade a non-HD wallet to HD");
483 bool flush_key_pool =
true;
492 spk_man->
SetHDSeed(master_pub_key,
true);
499 sspk_man->
SetHDSeed(master_pub_key,
true);
513 throw std::runtime_error(
514 "getnewaddress ( \"label\" )\n"
515 "\nReturns a new PIVX address for receiving payments.\n"
516 "If 'label' is specified, it is added to the address book \n"
517 "so payments received with the address will be associated with 'label'.\n"
520 "1. \"label\" (string, optional) The label name for the address to be linked to. if not provided, the default label \"\" is used. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.\n"
523 "\"pivxaddress\" (string) The new pivx address\n"
540 throw std::runtime_error(
541 "getnewexchangeaddress ( \"label\" )\n"
542 "\nReturns a new PIVX exchange address for receiving transparent funds only.\n"
545 "1. \"label\" (string, optional) The label name for the address to be linked to. if not provided, the default label \"\" is used. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.\n"
549 "\"pivxaddress\" (string) The new pivx exchange address\n"
567 throw std::runtime_error(
568 "getnewstakingaddress ( \"label\" )\n"
569 "\nReturns a new PIVX cold staking address for receiving delegated cold stakes.\n"
572 "1. \"label\" (string, optional) The label name for the address to be linked to. if not provided, the default label \"\" is used. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.\n"
576 "\"pivxaddress\" (string) The new pivx address\n"
592 throw std::runtime_error(
593 "getnewshieldaddress ( \"label\" )\n"
594 "\nReturns a new shield address for receiving payments.\n"
595 "If 'label' is specified, it is added to the address book \n"
596 "so payments received with the shield address will be associated with 'label'.\n"
600 "1. \"label\" (string, optional) The label name for the address to be linked to. if not provided, the default label \"\" is used. It can also be set to the empty string \"\" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.\n"
603 "\"address\" (string) The new shield address.\n"
622 static inline std::string HexStrTrimmed(std::array<unsigned char, ZC_MEMO_SIZE> vch)
624 return HexStr(std::vector<unsigned char>(vch.begin(),
FindFirstNonZero(vch.rbegin(), vch.rend()).base()));
635 throw std::runtime_error(
636 "listshieldunspent ( minconf maxconf include_watchonly [\"shield_addr\",...] )\n"
637 "\nReturns array of unspent shield notes with between minconf and maxconf (inclusive) confirmations.\n"
638 "Optionally filter to only include notes sent to specified addresses.\n"
639 "When minconf is 0, unspent notes with zero confirmations are returned, even though they are not immediately spendable.\n"
642 "1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n"
643 "2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n"
644 "3. include_watchonly (bool, optional, default=false) Also include watchonly addresses (see 'importsaplingviewingkey')\n"
645 "4. \"addresses\" (string) A json array of shield addrs to filter on. Duplicate addresses not allowed.\n"
647 " \"address\" (string) shield addr\n"
652 "[ (array of json object)\n"
654 " \"txid\" : \"txid\", (string) the transaction id \n"
655 " \"outindex\" (sapling) : n, (numeric) the output index\n"
656 " \"confirmations\" : n, (numeric) the number of confirmations\n"
657 " \"spendable\" : true|false, (boolean) true if note can be spent by wallet, false if address is watchonly\n"
658 " \"address\" : \"address\", (string) the shield address\n"
659 " \"amount\": xxxxx, (numeric) the amount of value in the note\n"
660 " \"memo\": xxxxx, (string) hexadecimal string representation of memo field\n"
661 " \"change\": true|false, (boolean) true if the address that received the note is also one of the sending addresses\n"
662 " \"nullifier\": xxxxx, (string) the note's nullifier, hex encoded"
669 +
HelpExampleCli(
"listshieldunspent",
"6 9999999 false \"[\\\"ptestsapling1h0w73csah2aq0a32h42kr7tq4htlt5wfn4ejxfnm56f6ehjvek7k4e244g6v8v3pgylmz5ea8jh\\\",\\\"ptestsapling1h0w73csah2aq0a32h42kr7tq4htlt5wfn4ejxfnm56f6ehjvek7k4e244g6v8v3pgylmz5ea8jh\\\"]\"")
670 +
HelpExampleRpc(
"listshieldunspent",
"6 9999999 false \"[\\\"ptestsapling1h0w73csah2aq0a32h42kr7tq4htlt5wfn4ejxfnm56f6ehjvek7k4e244g6v8v3pgylmz5ea8jh\\\",\\\"ptestsapling1h0w73csah2aq0a32h42kr7tq4htlt5wfn4ejxfnm56f6ehjvek7k4e244g6v8v3pgylmz5ea8jh\\\"]\"")
673 RPCTypeCheck(request.
params, {UniValue::VNUM, UniValue::VNUM, UniValue::VBOOL, UniValue::VARR});
681 if (nMaxDepth < nMinDepth) {
685 std::set<libzcash::PaymentAddress> shieldAddrs = {};
693 if (addresses.
size()==0)
697 std::set<std::string> setAddress;
704 std::string address = o.get_str();
711 if (!fIncludeWatchonly && !hasSpendingKey) {
714 shieldAddrs.insert(shieldAddr);
716 if (setAddress.count(address)) {
719 setAddress.insert(address);
723 std::set<libzcash::SaplingPaymentAddress> saplingzaddrs = {};
725 shieldAddrs.insert(saplingzaddrs.begin(), saplingzaddrs.end());
730 if (shieldAddrs.size() > 0) {
731 std::vector<SaplingNoteEntry> saplingEntries;
735 for (
const auto& entry : saplingEntries) {
737 obj.
pushKV(
"txid", entry.op.hash.ToString());
738 obj.
pushKV(
"outindex", (
int)entry.op.n);
739 obj.
pushKV(
"confirmations", entry.confirmations);
741 obj.
pushKV(
"spendable", hasSaplingSpendingKey);
744 obj.
pushKV(
"memo", HexStrTrimmed(entry.memo));
745 if (hasSaplingSpendingKey) {
748 const auto& nd = pwallet->
mapWallet.at(entry.op.hash).mapSaplingNoteData.at(entry.op);
750 obj.
pushKV(
"nullifier", nd.nullifier->ToString());
767 throw std::runtime_error(
768 "delegatoradd \"address\" ( \"label\" )\n"
769 "\nAdd the provided address <address> into the allowed delegators AddressBook.\n"
770 "This enables the staking of coins delegated to this wallet, owned by <addr>\n"
773 "1. \"address\" (string, required) The address to whitelist\n"
774 "2. \"label\" (string, optional) A label for the address to whitelist\n"
777 "true|false (boolean) true if successful.\n"
780 HelpExampleCli(
"delegatoradd",
"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6") +
781 HelpExampleRpc(
"delegatoradd",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"") +
782 HelpExampleRpc(
"delegatoradd",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"myPaperWallet\""));
784 bool isStaking =
false;
785 bool isExchange =
false;
792 const CKeyID* keyID = boost::get<CKeyID>(&dest);
807 throw std::runtime_error(
808 "delegatorremove \"address\"\n"
809 "\nUpdates the provided address <address> from the allowed delegators keystore to a \"delegable\" status.\n"
810 "This disables the staking of coins delegated to this wallet, owned by <addr>\n"
813 "1. \"address\" (string, required) The address to blacklist\n"
816 "true|false (boolean) true if successful.\n"
819 HelpExampleCli(
"delegatorremove",
"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6") +
820 HelpExampleRpc(
"delegatorremove",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\""));
822 bool isStaking =
false;
823 bool isExchange =
false;
828 const CKeyID* keyID = boost::get<CKeyID>(&dest);
835 std::string label =
"";
838 label = optAdd->name;
844 static UniValue ListaddressesForPurpose(
CWallet*
const pwallet,
const std::string strPurpose)
858 auto addrBook = it.GetValue();
859 if (addrBook.purpose != strPurpose)
continue;
860 auto dest = it.GetCTxDestKey();
863 entry.
pushKV(
"label", addrBook.name);
865 ret.push_back(entry);
880 throw std::runtime_error(
881 "listdelegators ( blacklist )\n"
882 "\nShows the list of allowed delegator addresses for cold staking.\n"
885 "1. blacklist (boolean, optional, default = false) Show addresses removed\n"
886 " from the delegators whitelist\n"
891 " \"label\": \"yyy\", (string) Address label\n"
892 " \"address\": \"xxx\", (string) PIVX address string\n"
915 throw std::runtime_error(
916 "liststakingaddresses\n"
917 "\nShows the list of staking addresses for this wallet.\n"
922 " \"label\": \"yyy\", (string) Address label\n"
923 " \"address\": \"xxx\", (string) PIVX address string\n"
943 throw std::runtime_error(
944 "listshieldaddresses ( include_watchonly )\n"
945 "\nReturns the list of shield addresses belonging to the wallet.\n"
948 "1. include_watchonly (bool, optional, default=false) Also include watchonly addresses (see 'importviewingkey')\n"
951 "[ (json array of string)\n"
952 " \"addr\" (string) a shield address belonging to the wallet\n"
963 bool fIncludeWatchonly =
false;
970 std::set<libzcash::SaplingPaymentAddress> addresses;
990 throw std::runtime_error(
991 "getrawchangeaddress\n"
992 "\nReturns a new PIVX address, for receiving change.\n"
993 "This is for use with raw transactions, NOT normal use.\n"
996 "\"address\" (string) The address\n"
1027 throw std::runtime_error(
1028 "setlabel \"address\" \"label\"\n"
1029 "\nSets the label associated with the given address.\n"
1032 "1. \"address\" (string, required) The pivx address to be associated with a label.\n"
1033 "2. \"label\" (string, required) The label to assign to the address.\n"
1036 HelpExampleCli(
"setlabel",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"tabby\"") +
HelpExampleRpc(
"setlabel",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\", \"tabby\""));
1040 bool isStaking =
false, isExchange =
false, isShielded =
false;
1075 std::string strError;
1076 std::vector<CRecipient> vecSend;
1077 int nChangePosRet = -1;
1078 CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount};
1080 if (!pwallet->
CreateTransaction(vecSend, tx, reservekey, nFeeRequired, nChangePosRet, strError)) {
1082 strError =
strprintf(
"Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!",
FormatMoney(nFeeRequired));
1083 LogPrintf(
"%s: %s\n", __func__, strError);
1098 const std::string& commentStr,
1099 const std::string& toStr,
1101 bool fIncludeDelegated,
1107 if (!fIncludeDelegated) {
1113 for (
const std::string& key : sendTo.
getKeys()) {
1115 recipient.pushKV(
"address", key);
1116 recipient.pushKV(
"amount", sendTo[key]);
1117 recipients.push_back(recipient);
1127 auto res = operation.
send(txid);
1133 auto it = pwallet->
mapWallet.find(txHash);
1135 if (!commentStr.empty()) {
1136 it->second.mapValue[
"comment"] = commentStr;
1138 if (!toStr.empty()) {
1139 it->second.mapValue[
"to"] = toStr;
1153 throw std::runtime_error(
1154 "sendtoaddress \"address\" amount ( \"comment\" \"comment-to\" subtract_fee )\n"
1155 "\nSend an amount to a given address. The amount is a real and is rounded to the nearest 0.00000001\n" +
1159 "1. \"address\" (string, required) The pivx address to send to.\n"
1160 "2. \"amount\" (numeric, required) The amount in PIV to send. eg 0.1\n"
1161 "3. \"comment\" (string, optional) A comment used to store what the transaction is for. \n"
1162 " This is not part of the transaction, just kept in your wallet.\n"
1163 "4. \"comment-to\" (string, optional) A comment to store the name of the person or organization \n"
1164 " to which you're sending the transaction. This is not part of the \n"
1165 " transaction, just kept in your wallet.\n"
1166 "5. subtract_fee (boolean, optional, default=false) The fee will be deducted from the amount being sent.\n"
1167 " The recipient will receive less PIVs than you enter in the amount field.\n"
1170 "\"transactionid\" (string) The transaction id.\n"
1173 HelpExampleCli(
"sendtoaddress",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" 0.1") +
1174 HelpExampleCli(
"sendtoaddress",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" 0.1 \"donation\" \"seans outpost\"") +
1175 HelpExampleCli(
"sendtoaddress",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" 0.1 \"\" \"\" true") +
1176 HelpExampleRpc(
"sendtoaddress",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\", 0.1, \"donation\", \"seans outpost\""));
1184 bool isStaking =
false, isExchange =
false, isShielded =
false;
1199 if (fSubtractFeeFromAmount) {
1200 subtractFeeFromAmount.
push_back(addrStr);
1202 return ShieldSendManyTo(pwallet, sendTo, commentStr, toStr, 1,
false, subtractFeeFromAmount);
1211 SendMoney(pwallet, address, nAmount, fSubtractFeeFromAmount, tx);
1215 if (!commentStr.empty())
1216 wtx.
mapValue[
"comment"] = commentStr;
1228 bool fForceNotEnabled =
false;
1229 if (params.
size() > 6 && !params[6].isNull())
1230 fForceNotEnabled = params[6].
get_bool();
1233 std::string errMsg =
"Cold Staking temporarily disabled with SPORK 19.\n"
1234 "You may force the stake delegation setting fForceNotEnabled to true.\n"
1235 "WARNING: If relayed before activation, this tx will be rejected resulting in a ban.\n";
1240 bool isStaking{
false};
1245 CKeyID* stakeKey = boost::get<CKeyID>(&stakeAddr);
1251 if (nValue < MIN_COLDSTAKING_AMOUNT)
1253 nValue, MIN_COLDSTAKING_AMOUNT));
1256 bool fUseDelegated =
false;
1257 if (params.
size() > 4 && !params[4].isNull())
1258 fUseDelegated = params[4].
get_bool();
1262 if (nValue > currBalance)
1265 std::string strError;
1268 std::string ownerAddressStr;
1270 bool isStakingAddress =
false;
1271 bool isExchange =
false;
1272 if (params.
size() > 2 && !params[2].isNull() && !params[2].get_str().empty()) {
1277 ownerKey = *boost::get<CKeyID>(&dest);
1279 bool fForceExternalAddr = params.
size() > 3 && !params[3].
isNull() ? params[3].
get_bool() :
false;
1281 std::string errMsg =
strprintf(
"The provided owneraddress \"%s\" is not present in this wallet.\n", params[2].get_str());
1282 errMsg +=
"Set 'fExternalOwner' argument to true, in order to force the stake delegation to an external owner address.\n"
1283 "e.g. delegatestake stakingaddress amount owneraddress true.\n"
1284 "WARNING: Only the owner of the key to owneraddress will be allowed to spend these coins after the delegation.";
1287 ownerAddressStr = params[2].
get_str();
1291 CKeyID* pOwnerKey = boost::get<CKeyID>(&ownerAddr);
1301 const bool fUseShielded = (params.
size() > 5) && params[5].get_bool();
1302 if (!fUseShielded) {
1307 if (!pwallet->
CreateTransaction(scriptPubKey, nValue, txNew, reservekey, nFeeRequired, strError,
nullptr, (
CAmount)0, fUseDelegated)) {
1308 if (nValue + nFeeRequired > currBalance)
1309 strError =
strprintf(
"Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!",
FormatMoney(nFeeRequired));
1310 LogPrintf(
"%s : %s\n", __func__, strError);
1326 txNew = MakeTransactionRef(operation.
getFinalTx());
1330 result.pushKV(
"owner_address", ownerAddressStr);
1343 throw std::runtime_error(
1344 "delegatestake \"staking_addr\" amount ( \"owner_addr\" ext_owner include_delegated from_shield force )\n"
1345 "\nDelegate an amount to a given address for cold staking. The amount is a real and is rounded to the nearest 0.00000001\n" +
1349 "1. \"staking_addr\" (string, required) The pivx staking address to delegate.\n"
1350 "2. \"amount\" (numeric, required) The amount in PIV to delegate for staking. eg 100\n"
1351 "3. \"owner_addr\" (string, optional) The pivx address corresponding to the key that will be able to spend the stake.\n"
1352 " If not provided, or empty string, a new wallet address is generated.\n"
1353 "4. \"ext_owner\" (boolean, optional, default = false) use the provided 'owneraddress' anyway, even if not present in this wallet.\n"
1354 " WARNING: The owner of the keys to 'owneraddress' will be the only one allowed to spend these coins.\n"
1355 "5. \"include_delegated\" (boolean, optional, default = false) include already delegated inputs if needed.\n"
1356 "6. \"from_shield\" (boolean, optional, default = false) delegate shield funds.\n"
1357 "7. \"force\" (boolean, optional, default = false) ONLY FOR TESTING: force the creation even if SPORK 17 is disabled.\n"
1361 " \"owner_address\": \"xxx\" (string) The owner (delegator) owneraddress.\n"
1362 " \"staker_address\": \"xxx\" (string) The cold staker (delegate) stakingaddress.\n"
1363 " \"txid\": \"xxx\" (string) The stake delegation transaction id.\n"
1367 HelpExampleCli(
"delegatestake",
"\"S1t2a3kab9c8c71VA78xxxy4MxZg6vgeS6\" 100") +
1368 HelpExampleCli(
"delegatestake",
"\"S1t2a3kab9c8c71VA78xxxy4MxZg6vgeS6\" 1000 \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg34fk\"") +
1369 HelpExampleRpc(
"delegatestake",
"\"S1t2a3kab9c8c71VA78xxxy4MxZg6vgeS6\", 1000, \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg34fk\""));
1381 UniValue ret = CreateColdStakeDelegation(pwallet, request.
params, wtx, reservekey);
1387 ret.
pushKV(
"txid", wtx->GetHash().GetHex());
1399 throw std::runtime_error(
1400 "rawdelegatestake \"staking_addr\" amount ( \"owner_addr\" ext_owner include_delegated from_shield )\n"
1401 "\nDelegate an amount to a given address for cold staking. The amount is a real and is rounded to the nearest 0.00000001\n"
1402 "\nDelegate transaction is returned as json object." +
1406 "1. \"staking_addr\" (string, required) The pivx staking address to delegate.\n"
1407 "2. \"amount\" (numeric, required) The amount in PIV to delegate for staking. eg 100\n"
1408 "3. \"owner_addr\" (string, optional) The pivx address corresponding to the key that will be able to spend the stake.\n"
1409 " If not provided, or empty string, a new wallet address is generated.\n"
1410 "4. \"ext_owner\" (boolean, optional, default = false) use the provided 'owneraddress' anyway, even if not present in this wallet.\n"
1411 " WARNING: The owner of the keys to 'owneraddress' will be the only one allowed to spend these coins.\n"
1412 "5. \"include_delegated\" (boolean, optional, default = false) include already delegated inputs if needed.\n"
1413 "6. \"from_shield\" (boolean, optional, default = false) delegate shield funds.\n"
1414 "7. \"force\" (boolean, optional, default = false) ONLY FOR TESTING: force the creation even if SPORK 17 is disabled (for tests).\n"
1417 "\"transaction\" (string) hex string of the transaction\n"
1420 HelpExampleCli(
"rawdelegatestake",
"\"S1t2a3kab9c8c71VA78xxxy4MxZg6vgeS6\" 100") +
1421 HelpExampleCli(
"rawdelegatestake",
"\"S1t2a3kab9c8c71VA78xxxy4MxZg6vgeS6\" 1000 \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg34fk\"") +
1422 HelpExampleRpc(
"rawdelegatestake",
"\"S1t2a3kab9c8c71VA78xxxy4MxZg6vgeS6\", 1000, \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg34fk\""));
1434 CreateColdStakeDelegation(pwallet, request.
params, wtx, reservekey);
1442 std::vector<SaplingNoteEntry> saplingEntries;
1445 for (
auto & entry : saplingEntries) {
1446 balance +=
CAmount(entry.note.value());
1459 throw std::runtime_error(
1460 "getshieldbalance \"address\" ( minconf include_watchonly )\n"
1461 "\nReturn the total shield value of funds stored in the node's wallet or if an address was given,"
1462 "\nreturns the balance of the shield addr belonging to the node's wallet.\n"
1463 "\nCAUTION: If the wallet contains any addresses for which it only has incoming viewing keys,"
1464 "\nthe returned private balance may be larger than the actual balance, because spends cannot"
1465 "\nbe detected with incoming viewing keys.\n"
1468 "1. \"address\" (string, optional) The selected address. If non empty nor \"*\", it must be a Sapling address\n"
1469 "2. minconf (numeric, optional, default=1) Only include private and transparent transactions confirmed at least this many times.\n"
1470 "3. include_watchonly (bool, optional, default=false) Also include balance in watchonly addresses (see 'importaddress' and 'importsaplingviewingkey')\n"
1473 "amount (numeric) the total balance of shield funds (in Sapling addresses)\n"
1476 "\nThe total amount in the wallet\n"
1478 +
HelpExampleCli(
"getshieldbalance",
"ptestsapling1h0w73csah2aq0a32h42kr7tq4htlt5wfn4ejxfnm56f6ehjvek7k4e244g6v8v3pgylmz5ea8jh") +
1479 "\nThe total amount in the wallet at least 5 blocks confirmed\n"
1481 "\nAs a json rpc call\n"
1490 if (addressStr.empty() || addressStr !=
"*") {
1499 if (nMinDepth < 0) {
1504 CAmount nBalance = getBalanceShieldedAddr(pwallet, address, nMinDepth, !fIncludeWatchonly);
1516 throw std::runtime_error(
1517 "viewshieldtransaction \"txid\"\n"
1518 "\nGet detailed shield information about in-wallet transaction \"txid\"\n"
1522 "1. \"txid\" (string, required) The transaction id\n"
1525 " \"txid\" : \"transactionid\", (string) The transaction id\n"
1526 " \"fee\" : x.xxx, (numeric) The transaction fee in " +
CURRENCY_UNIT +
"\n"
1529 " \"spend\" : n, (numeric, sapling) the index of the spend within vShieldedSpend\n"
1530 " \"txidPrev\" : \"transactionid\", (string) The id for the transaction this note was created in\n"
1531 " \"outputPrev\" : n, (numeric, sapling) the index of the output within the vShieldedOutput\n"
1532 " \"address\" : \"pivxaddress\", (string) The PIVX address involved in the transaction\n"
1533 " \"value\" : x.xxx (numeric) The amount in " +
CURRENCY_UNIT +
"\n"
1534 " \"valueSat\" : xxxx (numeric) The amount in satoshis\n"
1538 " \"outputs\" : [\n"
1540 " \"output\" : n, (numeric, sapling) the index of the output within the vShieldedOutput\n"
1541 " \"address\" : \"pivxaddress\", (string) The PIVX address involved in the transaction\n"
1542 " \"outgoing\" : true|false (boolean, sapling) True if the output is not for an address in the wallet\n"
1543 " \"value\" : x.xxx (numeric) The amount in " +
CURRENCY_UNIT +
"\n"
1544 " \"valueSat\" : xxxx (numeric) The amount in satoshis\n"
1545 " \"memo\" : \"hexmemo\", (string) Hexadecimal string representation of the memo field\n"
1546 " \"memoStr\" : \"memo\", (string) Only returned if memo contains valid UTF-8 text.\n"
1553 +
HelpExampleCli(
"viewshieldtransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
1554 +
HelpExampleRpc(
"viewshieldtransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
1572 auto it = pwallet->
mapWallet.find(hash);
1577 if (!wtx.
tx->IsShieldedTx()) {
1588 if (!
static_cast<bool>(optMemo)) {
1589 const std::array<unsigned char, 1> memo {0xF6};
1593 const auto& memo = *optMemo;
1595 entry.
pushKV(
"memo",
HexStr(std::vector<unsigned char>(memo.begin(), end.base())));
1598 if (memo[0] <= 0xf4) {
1599 std::string memoStr(memo.begin(), end.base());
1601 entry.
pushKV(
"memoStr", memoStr);
1609 std::set<uint256> ovks;
1613 ovks.insert(sspkm->getCommonOVK());
1616 for (
size_t i = 0; i < wtx.
tx->sapData->vShieldedSpend.size(); ++i) {
1617 const auto& spend = wtx.
tx->sapData->vShieldedSpend[i];
1620 auto res = sspkm->mapSaplingNullifiersToNotes.find(spend.nullifier);
1621 if (res == sspkm->mapSaplingNullifiersToNotes.end()) {
1624 const auto& op = res->second;
1625 std::string addrStr =
"unknown";
1628 auto wtxPrevIt = pwallet->
mapWallet.find(op.hash);
1629 if (wtxPrevIt != pwallet->
mapWallet.end()) {
1630 const auto ndIt = wtxPrevIt->second.mapSaplingNoteData.find(op);
1631 if (ndIt != wtxPrevIt->second.mapSaplingNoteData.end()) {
1633 if (ndIt->second.address) {
1636 if (ndIt->second.amount) {
1637 amount = *(ndIt->second.amount);
1644 entry_.
pushKV(
"spend", (
int)i);
1645 entry_.
pushKV(
"txidPrev", op.hash.GetHex());
1646 entry_.
pushKV(
"outputPrev", (
int)op.n);
1647 entry_.
pushKV(
"address", addrStr);
1648 entry_.
pushKV(
"value", amountStr);
1649 entry_.
pushKV(
"valueSat", amount);
1654 for (uint32_t i = 0; i < wtx.
tx->sapData->vShieldedOutput.size(); ++i) {
1658 const auto& nd = it->second;
1660 const bool isOutgoing = !nd.IsMyNote();
1661 std::string addrStr =
"unknown";
1668 amount = *(nd.amount);
1673 entry_.
pushKV(
"output", (
int)op.n);
1674 entry_.
pushKV(
"outgoing", isOutgoing);
1675 entry_.
pushKV(
"address", addrStr);
1676 entry_.
pushKV(
"value", amountStr);
1677 entry_.
pushKV(
"valueSat", amount);
1678 addMemo(entry_, nd.memo);
1684 entry.
pushKV(
"spends", spends);
1685 entry.
pushKV(
"outputs", outputs);
1697 bool fromSapling =
false;
1699 if (sendFromStr ==
"from_transparent") {
1702 }
else if (sendFromStr ==
"from_trans_cold") {
1705 }
else if (sendFromStr ==
"from_shield") {
1734 if (outputs.
empty())
1738 std::set<std::string> setAddress;
1740 std::vector<SendManyRecipient> recipients;
1742 bool containsSaplingOutput =
false;
1749 for (
const std::string& name_ : o.getKeys()) {
1750 if (name_ !=
"address" && name_ !=
"amount" && name_!=
"memo")
1761 saddr = *(boost::get<libzcash::SaplingPaymentAddress>(&addr));
1762 containsSaplingOutput =
true;
1768 if (setAddress.count(address))
1770 setAddress.insert(address);
1774 if (!memoValue.
isNull()) {
1789 bool fSubtractFeeFromAmount =
false;
1790 for (
unsigned int idx = 0; idx < subtractFeeFromAmount.
size(); idx++) {
1791 const UniValue& addr = subtractFeeFromAmount[idx];
1792 if (addr.
get_str() == address) {
1793 fSubtractFeeFromAmount =
true;
1799 recipients.emplace_back(*saddr, nAmount, memo, fSubtractFeeFromAmount);
1801 recipients.emplace_back(taddr, nAmount, fSubtractFeeFromAmount);
1804 nTotalOut += nAmount;
1810 if (fromSapling || containsSaplingOutput) {
1823 if (nMinDepth < 0) {
1833 }
else if (nFee > 0) {
1840 if (fromSapling && nMinDepth == 0) {
1844 if (nMinDepth < 0) {
1864 throw std::runtime_error(
1865 "shieldsendmany \"fromaddress\" [{\"address\":... ,\"amount\":...},...] ( minconf fee subtract_fee_from )\n"
1866 "\nSend to many recipients. Amounts are decimal numbers with at most 8 digits of precision."
1867 "\nChange generated from a transparent addr flows to a new transparent addr address, while change generated from a shield addr returns to itself."
1868 "\nWhen sending coinbase UTXOs to a shield addr, change is not allowed. The entire value of the UTXO(s) must be consumed."
1872 "1. \"fromaddress\" (string, required) The transparent addr or shield addr to send the funds from.\n"
1873 " It can also be the string \"from_transparent\"|\"from_shield\" to send the funds\n"
1874 " from any transparent|shield address available.\n"
1875 " Additionally, it can be the string \"from_trans_cold\" to select transparent funds,\n"
1876 " possibly including delegated coins, if needed.\n"
1877 "2. \"amounts\" (array, required) An array of json objects representing the amounts to send.\n"
1879 " \"address\":address (string, required) The address is a transparent addr or shield addr\n"
1880 " \"amount\":amount (numeric, required) The numeric amount in " +
"PIV" +
" is the value\n"
1881 " \"memo\":memo (string, optional) If the address is a shield addr, message string of max 512 bytes\n"
1883 "3. minconf (numeric, optional, default=1) Only use funds confirmed at least this many times.\n"
1884 "4. fee (numeric, optional), The fee amount to attach to this transaction.\n"
1885 " If not specified, or set to 0, the wallet will try to compute the minimum possible fee for a shield TX,\n"
1886 " based on the expected transaction size and the current value of -minRelayTxFee.\n"
1887 "5. subtract_fee_from (array, optional) A json array with addresses.\n"
1888 " The fee will be equally deducted from the amount of each selected address.\n"
1889 " Those recipients will receive less PIV than you enter in their corresponding amount field.\n"
1890 " If no addresses are specified here, the sender pays the fee.\n"
1892 " \"address\" (string) Subtract fee from this address\n"
1896 "\"id\" (string) transaction hash in the network\n"
1899 "\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" '[{\"address\": \"ps1ra969yfhvhp73rw5ak2xvtcm9fkuqsnmad7qln79mphhdrst3lwu9vvv03yuyqlh42p42st47qd\" ,\"amount\": 5.0}]'")
1901 "\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\", [{\"address\": \"ps1ra969yfhvhp73rw5ak2xvtcm9fkuqsnmad7qln79mphhdrst3lwu9vvv03yuyqlh42p42st47qd\" ,\"amount\": 5.0}]")
1912 auto res = operation.
send(txHash);
1926 throw std::runtime_error(
1927 "rawshieldsendmany \"fromaddress\" [{\"address\":... ,\"amount\":...},...] ( minconf fee )\n"
1928 "\nCreates a transaction sending to many recipients (without committing it), and returns the hex string."
1929 "\nAmounts are decimal numbers with at most 8 digits of precision."
1930 "\nChange generated from a transparent addr flows to a new transparent addr address, while change generated from a shield addr returns to itself."
1931 "\nWhen sending coinbase UTXOs to a shield addr, change is not allowed. The entire value of the UTXO(s) must be consumed."
1935 "1. \"fromaddress\" (string, required) The transparent addr or shield addr to send the funds from.\n"
1936 " It can also be the string \"from_transparent\"|\"from_shield\" to send the funds\n"
1937 " from any transparent|shield address available.\n"
1938 " Additionally, it can be the string \"from_trans_cold\" to select transparent funds,\n"
1939 " possibly including delegated coins, if needed.\n"
1940 "2. \"amounts\" (array, required) An array of json objects representing the amounts to send.\n"
1942 " \"address\":address (string, required) The address is a transparent addr or shield addr\n"
1943 " \"amount\":amount (numeric, required) The numeric amount in " +
"PIV" +
" is the value\n"
1944 " \"memo\":memo (string, optional) If the address is a shield addr, message string of max 512 bytes\n"
1946 "3. minconf (numeric, optional, default=1) Only use funds confirmed at least this many times.\n"
1947 "4. fee (numeric, optional), The fee amount to attach to this transaction.\n"
1948 " If not specified, the wallet will try to compute the minimum possible fee for a shield TX,\n"
1949 " based on the expected transaction size and the current value of -minRelayTxFee.\n"
1951 "\"transaction\" (string) hex string of the transaction\n"
1955 "\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" '[{\"address\": \"ps1ra969yfhvhp73rw5ak2xvtcm9fkuqsnmad7qln79mphhdrst3lwu9vvv03yuyqlh42p42st47qd\" ,\"amount\": 5.0}]'")
1957 "\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\", [{\"address\": \"ps1ra969yfhvhp73rw5ak2xvtcm9fkuqsnmad7qln79mphhdrst3lwu9vvv03yuyqlh42p42st47qd\" ,\"amount\": 5.0}]")
1978 throw std::runtime_error(
1979 "listaddressgroupings\n"
1980 "\nLists groups of addresses which have had their common ownership\n"
1981 "made public by common use as inputs or as the resulting change\n"
1982 "in past transactions\n"
1988 " \"pivxaddress\", (string) The pivx address\n"
1989 " amount, (numeric) The amount in PIV\n"
1990 " \"label\" (string, optional) The label\n"
2022 return jsonGroupings;
2033 throw std::runtime_error(
2034 "signmessage \"address\" \"message\"\n"
2035 "\nSign a message with the private key of an address" +
2039 "1. \"address\" (string, required) The pivx address to use for the private key.\n"
2040 "2. \"message\" (string, required) The message to create a signature of.\n"
2043 "\"signature\" (string) The signature of the message encoded in base 64\n"
2046 "\nUnlock the wallet for 30 seconds\n" +
2048 "\nCreate the signature\n" +
2049 HelpExampleCli(
"signmessage",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"my message\"") +
2050 "\nVerify the signature\n" +
2051 HelpExampleCli(
"verifymessage",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"signature\" \"my message\"") +
2053 HelpExampleRpc(
"signmessage",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\", \"my message\""));
2066 const CKeyID* keyID = boost::get<CKeyID>(&dest);
2071 if (!pwallet->
GetKey(*keyID, key))
2074 std::vector<unsigned char> vchSig;
2090 throw std::runtime_error(
2091 "getreceivedbyaddress \"address\" ( minconf )\n"
2092 "\nReturns the total amount received by the given pivxaddress in transactions with at least minconf confirmations.\n"
2095 "1. \"address\" (string, required) The pivx address for transactions.\n"
2096 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
2099 "amount (numeric) The total amount in PIV received at this address.\n"
2102 "\nThe amount from transactions with at least 1 confirmation\n" +
2103 HelpExampleCli(
"getreceivedbyaddress",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"") +
2104 "\nThe amount including unconfirmed transactions, zero confirmations\n" +
2105 HelpExampleCli(
"getreceivedbyaddress",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" 0") +
2106 "\nThe amount with at least 6 confirmation, very safe\n" +
2107 HelpExampleCli(
"getreceivedbyaddress",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" 6") +
2108 "\nAs a json rpc call\n" +
2109 HelpExampleRpc(
"getreceivedbyaddress",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\", 6"));
2123 if (!
IsMine(*pwallet, scriptPubKey))
2133 for (
const auto& entry : pwallet->
mapWallet) {
2138 for (
const CTxOut& txout : wtx.
tx->vout)
2156 throw std::runtime_error(
2157 "getreceivedbylabel \"label\" ( minconf )\n"
2158 "\nReturns the total amount received by addresses with <label> in transactions with at least [minconf] confirmations.\n"
2161 "1. \"label\" (string, required) The selected label, may be the default label using \"\".\n"
2162 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
2165 "amount (numeric) The total amount in PIV received for this label.\n"
2168 "\nAmount received by the default label with at least 1 confirmation\n" +
2170 "\nAmount received at the tabby label including unconfirmed amounts with zero confirmations\n" +
2172 "\nThe amount with at least 6 confirmation, very safe\n" +
2174 "\nAs a json rpc call\n" +
2195 for (
const auto& entry : pwallet->
mapWallet) {
2200 for (
const CTxOut& txout : wtx.
tx->vout) {
2208 return (
double)nAmount / (double)COIN;
2219 throw std::runtime_error(
2220 "getbalance ( minconf include_watchonly include_delegated include_shield )\n"
2221 "\nReturns the server's total available balance.\n"
2222 "The available balance is what the wallet considers currently spendable, and is\n"
2223 "thus affected by options which limit spendability such as -spendzeroconfchange.\n"
2226 "1. minconf (numeric, optional, default=0) Only include transactions confirmed at least this many times.\n"
2227 "2. include_watchonly (bool, optional, default=false) Also include balance in watchonly addresses (see 'importaddress')\n"
2228 "3. include_delegated (bool, optional, default=true) Also include balance delegated to cold stakers\n"
2229 "4. include_shield (bool, optional, default=true) Also include shield balance\n"
2232 "amount (numeric) The total amount in PIV received for this wallet.\n"
2235 "\nThe total amount in the wallet\n" +
2237 "\nThe total amount in the wallet, with at least 5 confirmations\n" +
2239 "\nAs a json rpc call\n" +
2248 const int paramsSize = request.
params.
size();
2249 const int nMinDepth = paramsSize > 0 ? request.
params[0].
get_int() : 0;
2250 bool fIncludeWatchOnly = paramsSize > 1 && request.
params[1].
get_bool();
2251 bool fIncludeDelegated = paramsSize <= 2 || request.
params[2].
get_bool();
2252 bool fIncludeShielded = paramsSize <= 3 || request.
params[3].
get_bool();
2269 throw std::runtime_error(
2270 "getcoldstakingbalance\n"
2271 "\nReturns the server's total available cold balance.\n"
2274 "amount (numeric) The total amount in PIV received for this wallet in P2CS contracts.\n"
2277 "\nThe total amount in the wallet\n" +
2279 "\nAs a json rpc call\n" +
2299 throw std::runtime_error(
2300 "getdelegatedbalance\n"
2301 "\nReturns the server's total available delegated balance (sum of all utxos delegated\n"
2302 "to a cold staking address to stake on behalf of addresses of this wallet).\n"
2305 "amount (numeric) The total amount in PIV received for this wallet in P2CS contracts.\n"
2308 "\nThe total amount in the wallet\n" +
2310 "\nAs a json rpc call\n" +
2330 throw std::runtime_error(
2331 "getunconfirmedbalance\n"
2332 "Returns the server's total unconfirmed balance\n");
2346 static UniValue legacy_sendmany(
CWallet*
const pwallet,
const UniValue& sendTo,
int nMinDepth, std::string comment,
bool fIncludeDelegated,
const UniValue& subtractFeeFromAmount)
2356 std::set<CTxDestination> setAddress;
2357 std::vector<CRecipient> vecSend;
2360 std::vector<std::string> keys = sendTo.
getKeys();
2361 for (
const std::string& name_ : keys) {
2362 bool isStaking =
false;
2363 bool isExchange =
false;
2368 if (setAddress.count(dest))
2370 setAddress.insert(dest);
2374 totalAmount += nAmount;
2376 bool fSubtractFeeFromAmount =
false;
2377 for (
unsigned int idx = 0; idx < subtractFeeFromAmount.
size(); idx++) {
2378 const UniValue& addr = subtractFeeFromAmount[idx];
2379 if (addr.
get_str() == name_) {
2380 fSubtractFeeFromAmount =
true;
2385 vecSend.emplace_back(scriptPubKey, nAmount, fSubtractFeeFromAmount);
2396 std::string strFailReason;
2397 int nChangePosInOut = -1;
2398 bool fCreated = pwallet->
CreateTransaction(vecSend, txNew, keyChange, nFeeRequired, nChangePosInOut, strFailReason,
2414 if (!comment.empty()) {
2433 throw std::runtime_error(
2434 "sendmany \"\" {\"address\":amount,...} ( minconf \"comment\" include_delegated )\n"
2435 "\nSend to multiple destinations. Recipients are transparent or shield PIVX addresses.\n"
2436 "\nAmounts are double-precision floating point numbers.\n"
2440 "1. \"dummy\" (string, required) Must be set to \"\" for backwards compatibility.\n"
2441 "2. \"amounts\" (string, required) A json object with addresses and amounts\n"
2443 " \"address\":amount (numeric) The pivx address (either transparent or shield) is the key,\n"
2444 " the numeric amount in PIV is the value\n"
2447 "3. minconf (numeric, optional, default=1) Only use the balance confirmed at least this many times.\n"
2448 "4. \"comment\" (string, optional) A comment\n"
2449 "5. include_delegated (bool, optional, default=false) Also include balance delegated to cold stakers\n"
2450 "6. subtract_fee_from (array, optional) A json array with addresses.\n"
2451 " The fee will be equally deducted from the amount of each selected address.\n"
2452 " Those recipients will receive less PIV than you enter in their corresponding amount field.\n"
2453 " If no addresses are specified here, the sender pays the fee.\n"
2455 " \"address\" (string) Subtract fee from this address\n"
2460 "\"transactionid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n"
2461 " the number of addresses.\n"
2464 "\nSend two amounts to two different addresses:\n" +
2465 HelpExampleCli(
"sendmany",
"\"\" \"{\\\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\\\":0.01,\\\"DAD3Y6ivr8nPQLT1NEPX84DxGCw9jz9Jvg\\\":0.02}\"") +
2466 "\nSend two amounts to two different addresses setting the confirmation and comment:\n" +
2467 HelpExampleCli(
"sendmany",
"\"\" \"{\\\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\\\":0.01,\\\"DAD3Y6ivr8nPQLT1NEPX84DxGCw9jz9Jvg\\\":0.02}\" 6 \"testing\"") +
2468 "\nSend to shield address:\n" +
2469 HelpExampleCli(
"sendmany",
"\"\" \"{\\\"ps1u87kylcmn28yclnx2uy0psnvuhs2xn608ukm6n2nshrpg2nzyu3n62ls8j77m9cgp40dx40evej\\\":10}\"") +
2470 "\nAs a json rpc call\n" +
2471 HelpExampleRpc(
"sendmany",
"\"\", \"{\\\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\\\":0.01,\\\"DAD3Y6ivr8nPQLT1NEPX84DxGCw9jz9Jvg\\\":0.02}\", 6, \"testing\"")
2495 bool fShieldSend =
false;
2496 for (
const std::string& key : sendTo.
getKeys()) {
2497 bool isStaking =
false, isExchange =
false, isShielded =
false;
2506 return ShieldSendManyTo(pwallet, sendTo, comment,
"", nMinDepth, fIncludeDelegated, subtractFeeFromAmount);
2510 return legacy_sendmany(pwallet, sendTo, nMinDepth, comment, fIncludeDelegated, subtractFeeFromAmount);
2524 throw std::runtime_error(
2525 "addmultisigaddress nrequired [\"key\",...] ( \"label\" )\n"
2526 "\nAdd a nrequired-to-sign multisignature address to the wallet. Requires a new wallet backup.\n"
2527 "Each key is a PIVX address or hex-encoded public key.\n"
2528 "If 'label' is specified, assign address to that label.\n"
2531 "1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses.\n"
2532 "2. \"keys\" (string, required) A json array of pivx addresses or hex-encoded public keys\n"
2534 " \"address\" (string) pivx address or hex-encoded public key\n"
2537 "3. \"label\" (string, optional) A label to assign the addresses to.\n"
2540 "\"pivxaddress\" (string) A pivx address associated with the keys.\n"
2543 "\nAdd a multisig address from 2 addresses\n" +
2544 HelpExampleCli(
"addmultisigaddress",
"2 \"[\\\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\\\",\\\"DAD3Y6ivr8nPQLT1NEPX84DxGCw9jz9Jvg\\\"]\"") +
2545 "\nAs json rpc call\n" +
2546 HelpExampleRpc(
"addmultisigaddress",
"2, \"[\\\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\\\",\\\"DAD3Y6ivr8nPQLT1NEPX84DxGCw9jz9Jvg\\\"]\""));
2572 nConf = std::numeric_limits<int>::max();
2581 if (params.
size() > 0)
2582 nMinDepth = params[0].
get_int();
2585 bool fIncludeEmpty =
false;
2586 if (params.
size() > 1)
2587 fIncludeEmpty = params[1].
get_bool();
2590 if (params.
size() > 2)
2591 if (params[2].get_bool())
2594 bool has_filtered_address =
false;
2596 if (!by_label && params.
size() > 3) {
2601 filtered_address = dest;
2602 has_filtered_address =
true;
2606 std::map<CTxDestination, tallyitem> mapTally;
2607 for (
const auto& entry : pwallet->
mapWallet) {
2615 if (nDepth < nMinDepth) {
2619 for (
const CTxOut& txout : wtx.
tx->vout) {
2625 if (has_filtered_address && !(filtered_address == address)) {
2630 if (!(mine & filter)) {
2647 if (has_filtered_address) {
2653 std::map<std::string, tallyitem> label_tally;
2655 for (
auto& itAddrBook = itAddr; itAddrBook.IsValid(); itAddrBook.Next()) {
2657 auto* dest = itAddrBook.GetCTxDestKey();
2658 if (!dest)
continue;
2660 const auto &address = *dest;
2661 const std::string &label = itAddrBook.GetValue().name;
2662 auto it = mapTally.find(address);
2663 if (it == mapTally.end() && !fIncludeEmpty) {
2668 int nConf = std::numeric_limits<int>::max();
2669 bool fIsWatchonly =
false;
2670 if (it != mapTally.end()) {
2671 nAmount = (*it).second.nAmount;
2672 nConf = (*it).second.nConf;
2673 fIsWatchonly = (*it).second.fIsWatchonly;
2684 obj.pushKV(
"involvesWatchonly",
true);
2687 if (nConf == std::numeric_limits<int>::max()) nConf = 0;
2688 obj.pushKV(
"confirmations", nConf);
2689 obj.pushKV(
"bcconfirmations", nConf);
2690 obj.pushKV(
"label", label);
2692 if (it != mapTally.end()) {
2693 for (
const uint256 &item : (*it).second.txids) {
2694 transactions.push_back(item.
GetHex());
2697 obj.pushKV(
"txids", transactions);
2703 for (
const auto& entry : label_tally) {
2704 CAmount nAmount = entry.second.nAmount;
2705 int nConf = entry.second.nConf;
2707 if (entry.second.fIsWatchonly)
2708 obj.pushKV(
"involvesWatchonly",
true);
2710 obj.pushKV(
"confirmations", (nConf == std::numeric_limits<int>::max() ? 0 : nConf));
2711 obj.pushKV(
"label", entry.first);
2727 throw std::runtime_error(
2728 "listreceivedbyaddress ( minconf include_empty include_watchonly filter)\n"
2729 "\nList balances by receiving address.\n"
2732 "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
2733 "2. include_empty (numeric, optional, default=false) Whether to include addresses that haven't received any payments.\n"
2734 "3. include_watchonly (bool, optional, default=false) Whether to include watchonly addresses (see 'importaddress').\n"
2735 "4. filter (string, optional) If present, only return information on this address.\n"
2740 " \"involvesWatchonly\" : \"true\", (bool) Only returned if imported addresses were involved in transaction\n"
2741 " \"address\" : \"receivingaddress\", (string) The receiving address\n"
2742 " \"amount\" : x.xxx, (numeric) The total amount in PIV received by the address\n"
2743 " \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n"
2744 " \"bcconfirmations\" : n, (numeric) DEPRECATED: Will be removed in a future release\n"
2745 " \"label\" : \"label\", (string) The label of the receiving address. The default label is \"\".\n"
2754 HelpExampleRpc(
"listreceivedbyaddress",
"6, true, true, \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\""));
2762 return ListReceived(pwallet, request.
params,
false, nBlockHeight);
2773 throw std::runtime_error(
2774 "listreceivedbyshieldaddress \"address\" ( minconf )\n"
2775 "\nReturn a list of amounts received by a shield addr belonging to the node's wallet.\n"
2778 "1. \"address\" (string) The private address.\n"
2779 "2. minconf (numeric, optional, default=1) Only include transactions confirmed at least this many times.\n"
2783 " \"txid\": \"txid\", (string) the transaction id\n"
2784 " \"amount\": xxxxx, (numeric) the amount of value in the note\n"
2785 " \"memo\": xxxxx, (string) hexadecimal string representation of memo field\n"
2786 " \"confirmations\" : n, (numeric) the number of confirmations\n"
2787 " \"blockheight\": n, (numeric) The block height containing the transaction\n"
2788 " \"blockindex\": n, (numeric) The block index containing the transaction.\n"
2789 " \"blocktime\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
2790 " \"outindex\" (sapling) : n, (numeric) the output index\n"
2791 " \"change\": true|false, (boolean) true if the address that received the note is also one of the sending addresses\n"
2795 +
HelpExampleCli(
"listreceivedbyshieldaddress",
"\"ps1ra969yfhvhp73rw5ak2xvtcm9fkuqsnmad7qln79mphhdrst3lwu9vvv03yuyqlh42p42st47qd\"")
2796 +
HelpExampleRpc(
"listreceivedbyshieldaddress",
"\"ps1ra969yfhvhp73rw5ak2xvtcm9fkuqsnmad7qln79mphhdrst3lwu9vvv03yuyqlh42p42st47qd\"")
2809 if (nMinDepth < 0) {
2824 if (!sspkm->PaymentAddressBelongsToWallet(shieldAddr)) {
2829 std::vector<SaplingNoteEntry> saplingEntries;
2830 sspkm->GetFilteredNotes(saplingEntries, zaddr, nMinDepth,
false,
false);
2832 std::set<std::pair<libzcash::PaymentAddress, uint256>> nullifierSet;
2834 if (hasSpendingKey) {
2835 nullifierSet = sspkm->GetNullifiersForAddresses({*zaddr});
2840 obj.
pushKV(
"txid", entry.op.hash.ToString());
2842 obj.
pushKV(
"memo", HexStrTrimmed(entry.memo));
2843 obj.
pushKV(
"outindex", (
int)entry.op.n);
2844 obj.
pushKV(
"confirmations", entry.confirmations);
2850 auto it = pwallet->
mapWallet.find(entry.op.hash);
2859 obj.
pushKV(
"blockheight", height);
2860 obj.
pushKV(
"blockindex", index);
2861 obj.
pushKV(
"blocktime", time);
2863 if (hasSpendingKey) {
2864 obj.
pushKV(
"change", sspkm->IsNoteSaplingChange(nullifierSet, entry.address, entry.op));
2879 throw std::runtime_error(
2880 "listreceivedbylabel ( minconf include_empty include_watchonly)\n"
2881 "\nList received transactions by label.\n"
2884 "1. minconf (numeric, optional, default=1) The minimum number of confirmations before payments are included.\n"
2885 "2. include_empty (boolean, optional, default=false) Whether to include labels that haven't received any payments.\n"
2886 "3. include_watchonly (bool, optional, default=false) Whether to include watchonly addresses (see 'importaddress').\n"
2891 " \"involvesWatchonly\" : \"true\", (bool) Only returned if imported addresses were involved in transaction\n"
2892 " \"amount\" : x.xxx, (numeric) The total amount received by addresses with this label\n"
2893 " \"confirmations\" : n (numeric) The number of confirmations of the most recent transaction included\n"
2894 " \"bcconfirmations\" : n, (numeric) DEPRECATED: Will be removed in a future release\n"
2895 " \"label\" : \"label\" (string) The label of the receiving address. The default label is \"\".\n"
2909 return ListReceived(pwallet, request.
params,
true, nBlockHeight);
2920 throw std::runtime_error(
2921 "listcoldutxos ( not_whitelisted )\n"
2922 "\nList P2CS unspent outputs received by this wallet as cold-staker-\n"
2925 "1. not_whitelisted (boolean, optional, default=false) Whether to exclude P2CS from whitelisted delegators.\n"
2930 " \"txid\" : \"true\", (string) The transaction id of the P2CS utxo\n"
2931 " \"txidn\" : n (numeric) The output number of the P2CS utxo\n"
2932 " \"amount\" : x.xxx, (numeric) The amount of the P2CS utxo\n"
2933 " \"confirmations\" : n (numeric) The number of confirmations of the P2CS utxo\n"
2934 " \"cold-staker\" : \"address\" (string) The cold-staker address of the P2CS utxo\n"
2935 " \"coin-owner\" : \"address\" (string) The coin-owner address of the P2CS utxo\n"
2936 " \"whitelisted\" : \"true\" (boolean) \"true\"/\"false\" coin-owner in delegator whitelist\n"
2950 bool fExcludeWhitelisted =
false;
2955 for (
const auto& entry : pwallet->
mapWallet) {
2956 const uint256& wtxid = entry.first;
2965 for (
unsigned int i = 0; i < pcoin->
tx->vout.size(); i++) {
2966 const CTxOut& out = pcoin->
tx->vout[i];
2971 std::vector<CTxDestination> addresses;
2975 const bool fWhitelisted = pwallet->
HasAddressBook(addresses[1]) > 0;
2976 if (fExcludeWhitelisted && fWhitelisted)
2980 entry.
pushKV(
"txidn", (
int)i);
2985 entry.
pushKV(
"whitelisted", fWhitelisted ?
"true" :
"false");
3004 std::list<COutputEntry> listReceived;
3005 std::list<COutputEntry> listSent;
3007 wtx.
GetAmounts(listReceived, listSent, nFee, filter);
3012 if ((!listSent.empty() || nFee != 0)) {
3016 entry.
pushKV(
"involvesWatchonly",
true);
3017 MaybePushAddress(entry, s.destination);
3018 entry.
pushKV(
"category",
"send");
3023 entry.
pushKV(
"vout", s.vout);
3026 WalletTxToJSON(wtx, entry);
3027 ret.push_back(entry);
3033 if (listReceived.size() > 0 && depth >= nMinDepth) {
3040 entry.
pushKV(
"involvesWatchonly",
true);
3041 MaybePushAddress(entry, r.destination);
3044 entry.
pushKV(
"category",
"orphan");
3046 entry.
pushKV(
"category",
"immature");
3048 entry.
pushKV(
"category",
"generate");
3050 entry.
pushKV(
"category",
"receive");
3054 entry.
pushKV(
"label", label);
3056 entry.
pushKV(
"vout", r.vout);
3058 WalletTxToJSON(wtx, entry);
3059 ret.push_back(entry);
3071 if (request.
fHelp || request.
params.
size() > 6)
throw std::runtime_error(
3072 "listtransactions ( \"dummy\" count from include_watchonly include_delegated include_cold)\n"
3073 "\nReturns up to 'count' most recent transactions skipping the first 'from' transactions.\n"
3076 "1. \"dummy\" (string, optional) If set, should be \"*\" for backwards compatibility.\n"
3077 "2. count (numeric, optional, default=10) The number of transactions to return\n"
3078 "3. from (numeric, optional, default=0) The number of transactions to skip\n"
3079 "4. include_watchonly (bool, optional, default=false) Include transactions to watchonly addresses (see 'importaddress')\n"
3080 "5. include_delegated (bool, optional, default=true) Also include balance delegated to cold stakers\n"
3081 "6. include_cold (bool, optional, default=true) Also include delegated balance received as cold-staker by this node\n"
3086 " \"address\":\"pivxaddress\", (string) The pivx address of the transaction.\n"
3087 " \"category\":\"category\", (string) The transaction category (send|receive|orphan|immature|generate).\n"
3088 " \"amount\": x.xxx, (numeric) The amount in PIV. This is negative for the 'send' category, and positive\n"
3089 " for the 'receive' category,\n"
3090 " \"vout\" : n, (numeric) the vout value\n"
3091 " \"fee\": x.xxx, (numeric) The amount of the fee in PIV. This is negative and only available for the \n"
3092 " 'send' category of transactions.\n"
3093 " \"confirmations\": n, (numeric) The number of blockchain confirmations for the transaction. Available for 'send'\n"
3094 " 'receive' category of transactions. Negative confirmations indicate the\n"
3095 " transaction conflicts with the block chain\n"
3096 " \"bcconfirmations\" : n, (numeric) DEPRECATED: Will be removed in a future release\n"
3097 " \"trusted\": xxx (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n"
3098 " and 'receive' category of transactions.\n"
3099 " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n"
3100 " category of transactions.\n"
3101 " \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive'\n"
3102 " category of transactions.\n"
3103 " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n"
3104 " \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
3105 " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available \n"
3106 " for 'send' and 'receive' category of transactions.\n"
3107 " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
3112 "\nList the most recent 10 transactions in the systems\n" +
3114 "\nList transactions 100 to 120\n" +
3116 "\nAs a json rpc call\n" +
3153 for (CWallet::TxItems::const_reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it) {
3155 ListTransactions(pwallet, *pwtx, 0,
true, ret, filter);
3156 if ((
int)ret.
size() >= (nCount + nFrom))
break;
3160 if (nFrom > (
int)ret.
size())
3162 if ((nFrom + nCount) > (
int)ret.
size())
3163 nCount = ret.
size() - nFrom;
3165 std::vector<UniValue> arrTmp = ret.
getValues();
3167 std::vector<UniValue>::iterator first = arrTmp.begin();
3168 std::advance(first, nFrom);
3169 std::vector<UniValue>::iterator last = arrTmp.begin();
3170 std::advance(last, nFrom+nCount);
3172 if (last != arrTmp.end()) arrTmp.erase(last, arrTmp.end());
3173 if (first != arrTmp.begin()) arrTmp.erase(arrTmp.begin(), first);
3175 std::reverse(arrTmp.begin(), arrTmp.end());
3192 throw std::runtime_error(
3193 "listsinceblock ( \"blockhash\" target_confirmations include_watchonly)\n"
3194 "\nGet all transactions in blocks since block [blockhash], or all transactions if omitted\n"
3197 "1. \"blockhash\" (string, optional) The block hash to list transactions since\n"
3198 "2. target_confirmations: (numeric, optional) The confirmations required, must be 1 or more\n"
3199 "3. include_watchonly: (bool, optional, default=false) Include transactions to watchonly addresses (see 'importaddress')"
3203 " \"transactions\": [\n"
3204 " \"address\":\"pivxaddress\", (string) The pivx address of the transaction. Not present for move transactions (category = move).\n"
3205 " \"category\":\"send|receive\", (string) The transaction category. 'send' has negative amounts, 'receive' has positive amounts.\n"
3206 " \"amount\": x.xxx, (numeric) The amount in PIV. This is negative for the 'send' category, and for the 'move' category for moves \n"
3207 " outbound. It is positive for the 'receive' category, and for the 'move' category for inbound funds.\n"
3208 " \"vout\" : n, (numeric) the vout value\n"
3209 " \"fee\": x.xxx, (numeric) The amount of the fee in PIV. This is negative and only available for the 'send' category of transactions.\n"
3210 " \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and 'receive' category of transactions.\n"
3211 " \"bcconfirmations\" : n, (numeric) DEPRECATED: Will be removed in a future release\n"
3212 " \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
3213 " \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive' category of transactions.\n"
3214 " \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
3215 " \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n"
3216 " \"time\": xxx, (numeric) The transaction time in seconds since epoch (Jan 1 1970 GMT).\n"
3217 " \"timereceived\": xxx, (numeric) The time received in seconds since epoch (Jan 1 1970 GMT). Available for 'send' and 'receive' category of transactions.\n"
3218 " \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
3219 " \"label\" : \"label\" (string) A comment for the address/transaction, if any\n"
3220 " \"to\": \"...\", (string) If a comment to is associated with the transaction.\n"
3222 " \"lastblock\": \"lastblockhash\" (string) The hash of the last block\n"
3227 HelpExampleCli(
"listsinceblock",
"\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\" 6") +
3228 HelpExampleRpc(
"listsinceblock",
"\"000000000000000bacf66f7497b7dc45ef753ee9a7d38571037cdb1a57f663ad\", 6"));
3237 int target_confirms = 1;
3248 if (target_confirms < 1)
3260 for (
const auto& entry : pwallet->
mapWallet) {
3264 ListTransactions(pwallet, tx, 0,
true, transactions, filter);
3271 ret.
pushKV(
"transactions", transactions);
3285 throw std::runtime_error(
3286 "gettransaction \"txid\" ( include_watchonly )\n"
3287 "\nGet detailed information about in-wallet transaction \"txid\"\n"
3290 "1. \"txid\" (string, required) The transaction id\n"
3291 "2. \"include_watchonly\" (bool, optional, default=false) Whether to include watchonly addresses in balance calculation and details[]\n"
3295 " \"amount\" : x.xxx, (numeric) The transaction amount in PIV\n"
3296 " \"confirmations\" : n, (numeric) The number of confirmations\n"
3297 " \"bcconfirmations\" : n, (numeric) DEPRECATED: Will be removed in a future release\n"
3298 " \"blockhash\" : \"hash\", (string) The block hash\n"
3299 " \"blockindex\" : xx, (numeric) The block index\n"
3300 " \"blocktime\" : ttt, (numeric) The time in seconds since epoch (1 Jan 1970 GMT)\n"
3301 " \"txid\" : \"transactionid\", (string) The transaction id.\n"
3302 " \"time\" : ttt, (numeric) The transaction time in seconds since epoch (1 Jan 1970 GMT)\n"
3303 " \"timereceived\" : ttt, (numeric) The time received in seconds since epoch (1 Jan 1970 GMT)\n"
3304 " \"details\" : [\n"
3306 " \"address\" : \"pivxaddress\", (string) The pivx address involved in the transaction\n"
3307 " \"category\" : \"send|receive\", (string) The category, either 'send' or 'receive'\n"
3308 " \"amount\" : x.xxx (numeric) The amount in PIV\n"
3309 " \"label\" : \"label\", (string) A comment for the address/transaction, if any\n"
3310 " \"vout\" : n, (numeric) the vout value\n"
3314 " \"hex\" : \"data\" (string) Raw data for transaction\n"
3318 HelpExampleCli(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"") +
3319 HelpExampleCli(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\" true") +
3320 HelpExampleRpc(
"gettransaction",
"\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\""));
3336 auto it = pwallet->
mapWallet.find(hash);
3344 CAmount nNet = nCredit - nDebit;
3351 WalletTxToJSON(wtx, entry);
3354 ListTransactions(pwallet, wtx, 0,
false, details, filter);
3355 entry.
pushKV(
"details", details);
3358 entry.
pushKV(
"hex", strHex);
3371 throw std::runtime_error(
3372 "abandontransaction \"txid\"\n"
3373 "\nMark in-wallet transaction \"txid\" as abandoned\n"
3374 "This will mark this transaction and all its in-wallet descendants as abandoned which will allow\n"
3375 "for their inputs to be respent. It can be used to replace \"stuck\" or evicted transactions.\n"
3376 "It only works on transactions which are not included in a block and are not currently in the mempool.\n"
3377 "It has no effect on transactions which are already abandoned.\n"
3379 "1. \"txid\" (string, required) The transaction id\n"
3383 "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
3385 "\"1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d\"")
3413 throw std::runtime_error(
3414 "backupwallet \"destination\"\n"
3415 "\nSafely copies wallet file to destination, which can be a directory or a path with filename.\n"
3418 "1. \"destination\" (string) The destination directory or file\n"
3445 throw std::runtime_error(
3446 "keypoolrefill ( newsize )\n"
3447 "\nFills the keypool." +
3451 "1. newsize (numeric, optional, default=100) The new keypool size\n"
3459 unsigned int kpSize = 0;
3476 static void LockWallet(
CWallet* pWallet)
3492 throw std::runtime_error(
3493 "walletpassphrase \"passphrase\" timeout ( staking_only )\n"
3494 "\nStores the wallet decryption key in memory for 'timeout' seconds.\n"
3495 "This is needed prior to performing transactions related to private keys such as sending PIVs\n"
3498 "1. \"passphrase\" (string, required) The wallet passphrase\n"
3499 "2. timeout (numeric, required) The time to keep the decryption key in seconds.\n"
3500 "3. staking_only (boolean, optional, default=false) If is true sending functions are disabled."
3503 "Issuing the walletpassphrase command while the wallet is already unlocked will set a new unlock\n"
3504 "time that overrides the old one. A timeout of \"0\" unlocks until the wallet is closed.\n"
3507 "\nUnlock the wallet for 60 seconds\n" +
3509 "\nUnlock the wallet for 60 seconds but allow staking only\n" +
3510 HelpExampleCli(
"walletpassphrase",
"\"my pass phrase\" 60 true") +
3511 "\nLock the wallet again (before 60 seconds)\n" +
3513 "\nAs json rpc call\n" +
3526 strWalletPass.reserve(100);
3531 bool stakingOnly =
false;
3541 if (nSleepTime < 0) {
3545 constexpr int64_t MAX_SLEEP_TIME = 100000000;
3546 if (nSleepTime > MAX_SLEEP_TIME) {
3547 nSleepTime = MAX_SLEEP_TIME;
3550 if (!pwallet->
Unlock(strWalletPass, stakingOnly))
3555 if (nSleepTime > 0) {
3572 throw std::runtime_error(
3573 "walletpassphrasechange \"oldpassphrase\" \"newpassphrase\"\n"
3574 "\nChanges the wallet passphrase from 'oldpassphrase' to 'newpassphrase'.\n"
3577 "1. \"oldpassphrase\" (string) The current passphrase\n"
3578 "2. \"newpassphrase\" (string) The new passphrase\n"
3581 HelpExampleCli(
"walletpassphrasechange",
"\"old one\" \"new one\"") +
HelpExampleRpc(
"walletpassphrasechange",
"\"old one\", \"new one\""));
3594 strOldWalletPass.reserve(100);
3598 strNewWalletPass.reserve(100);
3601 if (strOldWalletPass.length() < 1 || strNewWalletPass.length() < 1)
3602 throw std::runtime_error(
3603 "walletpassphrasechange <oldpassphrase> <newpassphrase>\n"
3604 "Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>.");
3621 throw std::runtime_error(
3623 "\nRemoves the wallet encryption key from memory, locking the wallet.\n"
3624 "After calling this method, you will need to call walletpassphrase again\n"
3625 "before being able to call any methods which require the wallet to be unlocked.\n"
3628 "\nSet the passphrase for 2 minutes to perform a transaction\n" +
3630 "\nPerform a send (requires passphrase set)\n" +
3631 HelpExampleCli(
"sendtoaddress",
"\"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" 1.0") +
3632 "\nClear the passphrase since we are done before 2 minutes is up\n" +
3634 "\nAs json rpc call\n" +
3664 throw std::runtime_error(
3665 "encryptwallet \"passphrase\"\n"
3666 "\nEncrypts the wallet with 'passphrase'. This is for first time encryption.\n"
3667 "After this, any calls that interact with private keys such as sending or signing \n"
3668 "will require the passphrase to be set prior the making these calls.\n"
3669 "Use the walletpassphrase call for this, and then walletlock call.\n"
3670 "If the wallet is already encrypted, use the walletpassphrasechange call.\n"
3673 "1. \"passphrase\" (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.\n"
3676 "\nEncrypt you wallet\n" +
3678 "\nNow set the passphrase to use the wallet, such as for signing or sending PIVs\n" +
3680 "\nNow we can so something like sign\n" +
3681 HelpExampleCli(
"signmessage",
"\"pivxaddress\" \"test message\"") +
3682 "\nNow lock the wallet again by removing the passphrase\n" +
3684 "\nAs a json rpc call\n" +
3698 strWalletPass.reserve(100);
3701 if (strWalletPass.length() < 1)
3702 throw std::runtime_error(
3703 "encryptwallet <passphrase>\n"
3704 "Encrypts the wallet with <passphrase>.");
3709 return "wallet encrypted; The keypool has been flushed, you need to make a new backup.";
3720 throw std::runtime_error(
3721 "listunspent ( minconf maxconf [\"address\",...] watchonly_config [query_options] include_unsafe)\n"
3722 "\nReturns array of unspent transaction outputs\n"
3723 "with between minconf and maxconf (inclusive) confirmations.\n"
3724 "Optionally filter to only include txouts paid to specified addresses.\n"
3725 "Results are an array of Objects, each of which has:\n"
3726 "{txid, vout, scriptPubKey, amount, confirmations, spendable}\n"
3729 "1. minconf (numeric, optional, default=1) The minimum confirmations to filter\n"
3730 "2. maxconf (numeric, optional, default=9999999) The maximum confirmations to filter\n"
3731 "3. \"addresses\" (string) A json array of pivx addresses to filter\n"
3733 " \"address\" (string) pivx address\n"
3736 "4. watchonly_config (numeric, optional, default=1) 1 = list regular unspent transactions, 2 = list all unspent transactions (including watchonly)\n"
3737 "5. query_options (json, optional) JSON with query options\n"
3739 " \"minimumAmount\" (numeric or string, default=0) Minimum value of each UTXO in " +
CURRENCY_UNIT +
"\n"
3740 " \"maximumAmount\" (numeric or string, default=unlimited) Maximum value of each UTXO in " +
CURRENCY_UNIT +
"\n"
3741 " \"maximumCount\" (numeric or string, default=unlimited) Maximum number of UTXOs\n"
3742 " \"minimumSumAmount\" (numeric or string, default=unlimited) Minimum sum value of all UTXOs in " +
CURRENCY_UNIT +
"\n"
3744 "6. include_unsafe (bool, optional, default=true) Include outputs that are not safe to spend\n"
3745 " See description of \"safe\" attribute below.\n"
3748 "[ (array of json object)\n"
3750 " \"txid\" : \"txid\", (string) the transaction id\n"
3751 " \"generated\" : true|false (boolean) true if txout is a coinstake transaction output\n"
3752 " \"vout\" : n, (numeric) the vout value\n"
3753 " \"address\" : \"address\", (string) the pivx address\n"
3754 " \"label\" : \"label\", (string) The associated label, or \"\" for the default label\n"
3755 " \"scriptPubKey\" : \"key\", (string) the script key\n"
3756 " \"redeemScript\" : \"key\", (string) the redeemscript key\n"
3757 " \"amount\" : x.xxx, (numeric) the transaction amount in PIV\n"
3758 " \"confirmations\" : n, (numeric) The number of confirmations\n"
3759 " \"spendable\" : true|false (boolean) Whether we have the private keys to spend this output\n"
3760 " \"solvable\" : xxx (boolean) Whether we know how to spend this output, ignoring the lack of keys\n"
3761 " \"safe\" : xxx (boolean) Whether this output is considered safe to spend. Unconfirmed transactions\n"
3762 " from outside keys and unconfirmed replacement transactions are considered unsafe\n"
3763 " and are not eligible for spending by fundrawtransaction and sendtoaddress.\n"
3769 HelpExampleCli(
"listunspent",
"") +
HelpExampleCli(
"listunspent",
"6 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"")
3770 +
HelpExampleRpc(
"listunspent",
"6, 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"")
3771 +
HelpExampleCli(
"listunspent",
"6 9999999 '[]' 1 '{ \"minimumAmount\": 0.005 }'")
3772 +
HelpExampleCli(
"listunspent",
"6 9999999 '[]' 1 '{ \"minimumAmount\": 0.005 }' false")
3773 +
HelpExampleRpc(
"listunspent",
"6, 9999999, [] , 1, { \"minimumAmount\": 0.005 } ")
3786 int nMaxDepth = 9999999;
3794 std::set<CTxDestination> destinations;
3798 for (
unsigned int inx = 0; inx < inputs.
size(); inx++) {
3799 const UniValue& input = inputs[inx];
3803 if (destinations.count(dest))
3805 destinations.insert(dest);
3811 int nWatchonlyConfig = 1;
3815 if (nWatchonlyConfig > 2 || nWatchonlyConfig < 1)
3816 nWatchonlyConfig = 1;
3831 if (options.
exists(
"minimumAmount")) {
3835 if (options.
exists(
"maximumAmount")) {
3839 if (options.
exists(
"minimumSumAmount")) {
3843 if (options.
exists(
"maximumCount"))
3854 std::vector<COutput> vecOutputs;
3858 for (
const COutput& out : vecOutputs) {
3859 if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
3863 entry.
pushKV(
"txid", out.tx->GetHash().GetHex());
3864 entry.
pushKV(
"vout", out.i);
3865 entry.
pushKV(
"generated", out.tx->IsCoinStake() || out.tx->IsCoinBase());
3867 const CScript& scriptPubKey = out.tx->tx->vout[out.i].scriptPubKey;
3874 const CScriptID& hash = boost::get<CScriptID>(address);
3882 entry.
pushKV(
"confirmations", out.nDepth);
3883 entry.
pushKV(
"spendable", out.fSpendable);
3884 entry.
pushKV(
"solvable", out.fSolvable);
3885 entry.
pushKV(
"safe", out.fSafe);
3900 throw std::runtime_error(
3901 "fundrawtransaction \"hexstring\" ( options )\n"
3902 "\nAdd inputs to a transaction until it has enough in value to meet its out value.\n"
3903 "This will not modify existing inputs, and will add one change output to the outputs.\n"
3904 "Note that inputs which were signed may need to be resigned after completion since in/outputs have been added.\n"
3905 "The inputs added will not be signed, use signrawtransaction for that.\n"
3906 "Note that all existing inputs must have their previous output transaction be in the wallet.\n"
3907 "Note that all inputs selected must be of standard form and P2SH scripts must be "
3908 "in the wallet using importaddress or addmultisigaddress (to calculate fees).\n"
3909 "You can see whether this is the case by checking the \"solvable\" field in the listunspent output.\n"
3910 "Only pay-to-pubkey, multisig, and P2SH versions thereof are currently supported for watch-only\n"
3913 "1. \"hexstring\" (string, required) The hex string of the raw transaction\n"
3914 "2. options (object, optional)\n"
3916 " \"changeAddress\" (string, optional, default pool address) The PIVX address to receive the change\n"
3917 " \"changePosition\" (numeric, optional, default random) The index of the change output\n"
3918 " \"includeWatching\" (boolean, optional, default false) Also select inputs which are watch only\n"
3919 " \"lockUnspents\" (boolean, optional, default false) Lock selected unspent outputs\n"
3920 " \"feeRate\" (numeric, optional, default 0=estimate) Set a specific feerate (PIV per KB)\n"
3921 " \"subtractFeeFromOutputs\" (array, optional) A json array of integers.\n"
3922 " The fee will be equally deducted from the amount of each specified output.\n"
3923 " The outputs are specified by their zero-based index, before any change output is added.\n"
3924 " Those recipients will receive less PIV than you enter in their corresponding amount field.\n"
3925 " If no outputs are specified here, the sender pays the fee.\n"
3926 " [vout_index,...]\n"
3930 " \"hex\": \"value\", (string) The resulting raw transaction (hex-encoded string)\n"
3931 " \"fee\": n, (numeric) The fee added to the transaction\n"
3932 " \"changepos\": n (numeric) The position of the added change output, or -1\n"
3936 "\nCreate a transaction with no inputs\n"
3937 +
HelpExampleCli(
"createrawtransaction",
"\"[]\" \"{\\\"myaddress\\\":0.01}\"") +
3938 "\nAdd sufficient unsigned inputs to meet the output value\n"
3939 +
HelpExampleCli(
"fundrawtransaction",
"\"rawtransactionhex\"") +
3940 "\nSign the transaction\n"
3941 +
HelpExampleCli(
"signrawtransaction",
"\"fundedtransactionhex\"") +
3942 "\nSend the transaction\n"
3943 +
HelpExampleCli(
"sendrawtransaction",
"\"signedtransactionhex\"")
3953 int changePosition = -1;
3954 bool includeWatching =
false;
3955 bool lockUnspents =
false;
3957 std::set<int> setSubtractFeeFromOutputs;
3959 bool overrideEstimatedFeerate =
false;
3975 if (options.
exists(
"changeAddress")) {
3982 if (options.
exists(
"changePosition"))
3983 changePosition = options[
"changePosition"].
get_int();
3985 if (options.
exists(
"includeWatching"))
3986 includeWatching = options[
"includeWatching"].
get_bool();
3988 if (options.
exists(
"lockUnspents"))
3989 lockUnspents = options[
"lockUnspents"].
get_bool();
3991 if (options.
exists(
"feeRate")) {
3993 overrideEstimatedFeerate =
true;
3996 if (options.
exists(
"subtractFeeFromOutputs")) {
3997 subtractFeeFromOutputs = options[
"subtractFeeFromOutputs"].
get_array();
4006 if (origTx.
vout.size() == 0)
4009 if (changePosition != -1 && (changePosition < 0 || (
unsigned int) changePosition > origTx.
vout.size()))
4012 for (
unsigned int idx = 0; idx < subtractFeeFromOutputs.
size(); idx++) {
4013 int pos = subtractFeeFromOutputs[idx].
get_int();
4014 if (setSubtractFeeFromOutputs.count(pos))
4018 if (pos >=
int(origTx.
vout.size()))
4020 setSubtractFeeFromOutputs.insert(pos);
4025 std::string strFailReason;
4026 if(!pwallet->
FundTransaction(tx, nFeeOut, overrideEstimatedFeerate, feeRate,
4027 changePosition, strFailReason, includeWatching,
4028 lockUnspents, setSubtractFeeFromOutputs, changeAddress)) {
4034 result.
pushKV(
"changepos", changePosition);
4048 throw std::runtime_error(
4049 "lockunspent unlock transparent [{\"txid\":\"txid\",\"vout\":n},...]\n"
4050 "\nUpdates list of temporarily unspendable outputs.\n"
4051 "Temporarily lock (unlock=false) or unlock (unlock=true) specified transparent (transparent=true) or shielded (transparent=false) transaction outputs.\n"
4052 "A locked transaction output will not be chosen by automatic coin selection, when spending PIVs.\n"
4053 "Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list\n"
4054 "is always cleared (by virtue of process exit) when a node stops or fails.\n"
4055 "Also see the listunspent call\n"
4058 "1. unlock (boolean, required) Whether to unlock (true) or lock (false) the specified transactions\n"
4059 "2. transparent (boolean, required) Whether the given transaction outputs are transparent (true) or shielded (false)\n"
4060 "2. \"transactions\" (string, required) A json array of objects. Each object the txid (string) vout (numeric)\n"
4061 " [ (json array of json objects)\n"
4063 " \"txid\":\"id\", (string) The transaction id\n"
4064 " \"vout\": n (numeric) The output number\n"
4070 "true|false (boolean) Whether the command was successful or not\n"
4073 "\nList the unspent transactions\n" +
4075 "\nLock an unspent transaction\n" +
4076 HelpExampleCli(
"lockunspent",
"false true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
4077 "\nList the locked transactions\n" +
4079 "\nUnlock the transaction again\n" +
4080 HelpExampleCli(
"lockunspent",
"true true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
4081 "\nAs a json rpc call\n" +
4082 HelpExampleRpc(
"lockunspent",
"false false, \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\""));
4106 std::vector<COutPoint> outputs;
4107 std::vector<SaplingOutPoint> saplingOutputs;
4108 transparent ? outputs.reserve(output_request.
size()) : saplingOutputs.reserve(output_request.
size());
4110 for (
unsigned int idx = 0; idx < output_request.
size(); idx++) {
4111 const UniValue& output = output_request[idx];
4129 bool is_locked =
false;
4131 const auto it = pwallet->
mapWallet.find(txid);
4139 if (outpt.
n >= wtx.
tx->vout.size()) {
4149 if (op.
n >= wtx.
tx->sapData->vShieldedOutput.size()) {
4158 if (fUnlock && !is_locked) {
4162 if (!fUnlock && is_locked) {
4166 transparent ? outputs.push_back(
COutPoint(txid, nOutput)) : saplingOutputs.push_back(
SaplingOutPoint(txid, nOutput));
4170 for (
const COutPoint& outpt : outputs) {
4192 throw std::runtime_error(
4194 "\nReturns list of temporarily unspendable outputs.\n"
4195 "See the lockunspent call to lock and unlock transactions for spending.\n"
4199 " \"transparent\": [ (array of json objects)\n"
4201 " \"txid\": \"transactionid\" (string) The transaction id locked\n"
4202 " \"vout\": n (numeric) The vout value\n"
4206 " \"shielded\": [ (array of json objects)\n"
4208 " \"txid\": \"transactionid\" (string) The transaction id locked\n"
4209 " \"vShieldedOutput\": n (numeric) The vout value\n"
4216 "\nList the unspent transactions\n" +
4218 "\nLock an unspent transaction\n" +
4219 HelpExampleCli(
"lockunspent",
"false true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
4220 "\nList the locked transactions\n" +
4222 "\nUnlock the transaction again\n" +
4223 HelpExampleCli(
"lockunspent",
"true true \"[{\\\"txid\\\":\\\"a08e6907dbbd3d809776dbfc5d82e371b764ed838b5655e72f463568df1aadf0\\\",\\\"vout\\\":1}]\"") +
4224 "\nAs a json rpc call\n" +
4235 for (
const COutPoint& outpt : vOutpts) {
4238 o.
pushKV(
"txid", outpt.hash.GetHex());
4239 o.
pushKV(
"vout", (
int)outpt.n);
4247 o.
pushKV(
"txid", op.hash.GetHex());
4248 o.
pushKV(
"vShieldedOutput", (
int)op.n);
4251 ret.
pushKV(
"transparent", transparent);
4252 ret.
pushKV(
"shielded", shielded);
4264 throw std::runtime_error(
4266 "\nSet the transaction fee per kB.\n"
4269 "1. amount (numeric, required) The transaction fee in PIV/kB rounded to the nearest 0.00000001\n"
4272 "true|false (boolean) Returns true if successful\n"
4295 throw std::runtime_error(
4297 "Returns an object containing various wallet state info.\n"
4301 " \"walletname\": xxxxx, (string) the wallet name\n"
4302 " \"walletversion\": xxxxx, (numeric) the wallet version\n"
4303 " \"balance\": xxxxxxx, (numeric) the total PIV balance of the wallet (cold balance excluded)\n"
4304 " \"delegated_balance\": xxxxx, (numeric) the PIV balance held in P2CS (cold staking) contracts\n"
4305 " \"cold_staking_balance\": xx, (numeric) the PIV balance held in cold staking addresses\n"
4306 " \"unconfirmed_balance\": xxx, (numeric) the total unconfirmed balance of the wallet in PIV\n"
4307 " \"immature_delegated_balance\": xxxxxx, (numeric) the delegated immature balance of the wallet in PIV\n"
4308 " \"immature_cold_staking_balance\": xxxxxx, (numeric) the cold-staking immature balance of the wallet in PIV\n"
4309 " \"immature_balance\": xxxxxx, (numeric) the total immature balance of the wallet in PIV\n"
4310 " \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n"
4311 " \"autocombine_enabled\": true|false, (boolean) true if autocombine is enabled, otherwise false\n"
4312 " \"autocombine_threshold\": x.xxx, (numeric) the current autocombine threshold in PIV\n"
4313 " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n"
4314 " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated (only counts external keys)\n"
4315 " \"keypoolsize_hd_internal\": xxxx, (numeric) how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used)\n"
4316 " \"keypoolsize_hd_staking\": xxxx, (numeric) how many new keys are pre-generated for staking use (used for staking contracts, only appears if the wallet is using this feature)\n"
4317 " \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
4318 " \"paytxfee\": x.xxxx (numeric) the transaction fee configuration, set in PIV/kB\n"
4319 " \"hdseedid\": \"<hash160>\" (string, optional) the Hash160 of the HD seed (only present when HD is enabled)\n"
4320 " \"last_processed_block\": xxxxx, (numeric) the last block processed block height\n"
4352 obj.
pushKV(
"keypoolsize", (int64_t)kpExternalSize);
4376 throw std::runtime_error(
4378 "Returns a list of currently loaded wallets.\n"
4379 "For full information on the wallet, use \"getwalletinfo\"\n"
4381 "[ (json array of strings)\n"
4382 " \"walletname\" (string) the wallet name\n"
4412 throw std::runtime_error(
4413 "getstakingstatus\n"
4414 "\nReturns an object containing various staking information.\n"
4418 " \"staking_status\": true|false, (boolean) whether the wallet is staking or not\n"
4419 " \"staking_enabled\": true|false, (boolean) whether staking is enabled/disabled in pivx.conf\n"
4420 " \"coldstaking_enabled\": true|false, (boolean) whether cold-staking is enabled/disabled in pivx.conf\n"
4421 " \"haveconnections\": true|false, (boolean) whether network connections are present\n"
4422 " \"mnsync\": true|false, (boolean) whether the required masternode/spork data is synced\n"
4423 " \"walletunlocked\": true|false, (boolean) whether the wallet is unlocked\n"
4424 " \"stakeablecoins\": n (numeric) number of stakeable UTXOs\n"
4425 " \"stakingbalance\": d (numeric) PIV value of the stakeable coins (minus reserve balance, if any)\n"
4426 " \"stakesplitthreshold\": d (numeric) value of the current threshold for stake split\n"
4427 " \"lastattempt_age\": n (numeric) seconds since last stake attempt\n"
4428 " \"lastattempt_depth\": n (numeric) depth of the block on top of which the last stake attempt was made\n"
4429 " \"lastattempt_hash\": xxx (hex string) hash of the block on top of which the last stake attempt was made\n"
4430 " \"lastattempt_coins\": n (numeric) number of stakeable coins available during last stake attempt\n"
4431 " \"lastattempt_tries\": n (numeric) number of stakeable coins checked during last stake attempt\n"
4446 obj.
pushKV(
"coldstaking_enabled", fColdStaking);
4450 std::vector<CStakeableOutput> vCoins;
4452 obj.
pushKV(
"stakeablecoins", (
int)vCoins.size());
4475 throw std::runtime_error(
4476 "setstakesplitthreshold value\n\n"
4477 "This will set the stake-split threshold value.\n"
4478 "Whenever a successful stake is found, the stake amount is split across as many outputs (each with a value\n"
4479 "higher than the threshold) as possible.\n"
4480 "E.g. If the coinstake input + the block reward is 2000, and the split threshold is 499, the corresponding\n"
4481 "coinstake transaction will have 4 outputs (of 500 PIV each)."
4485 "1. value (numeric, required) Threshold value (in PIV).\n"
4486 " Set to 0 to disable stake-splitting\n"
4491 " \"threshold\": n, (numeric) Threshold value set\n"
4492 " \"saved\": true|false (boolean) 'true' if successfully saved to the wallet file\n"
4517 throw std::runtime_error(
4518 "getstakesplitthreshold\n"
4519 "Returns the threshold for stake splitting\n"
4522 "n (numeric) Threshold value\n"
4538 throw std::runtime_error(
4539 "setautocombinethreshold enable ( value )\n"
4540 "\nThis will set the auto-combine threshold value.\n"
4541 "\nWallet will automatically monitor for any coins with value below the threshold amount, and combine them if they reside with the same PIVX address\n"
4542 "When auto-combine runs it will create a transaction, and therefore will be subject to transaction fees.\n"
4545 "1. enable (boolean, required) Enable auto combine (true) or disable (false).\n"
4546 "2. threshold (numeric, optional. required if enable is true) Threshold amount. Must be greater than 1.\n"
4547 "3. frequency (numeric, optional. default value is 30 if not provided). Check for UTXOs to autocombine each N blocks where N is the frequency.\n"
4551 " \"enabled\": true|false, (boolean) true if auto-combine is enabled, otherwise false\n"
4552 " \"threshold\": n.nnn, (numeric) auto-combine threshold in PIV\n"
4553 " \"frequency\": n.nnn, (numeric) auto-combine frequency in blocks\n"
4554 " \"saved\": true|false (boolean) true if setting was saved to the database, otherwise false\n"
4571 if (nThreshold < COIN)
4575 if (frequency <= 0) {
4590 result.
pushKV(
"enabled", fEnable);
4592 result.
pushKV(
"frequency", frequency);
4594 result.
pushKV(
"saved",
"true");
4596 result.
pushKV(
"saved",
"false");
4611 throw std::runtime_error(
4612 "getautocombinethreshold\n"
4613 "\nReturns the current threshold and frequency for auto combining UTXOs, if any\n"
4617 " \"enabled\": true|false, (boolean) true if auto-combine is enabled, otherwise false\n"
4618 " \"threshold\": n.nnn (numeric) the auto-combine threshold amount in PIV\n"
4619 " \"frequency\": n.nnn (numeric) the auto-combine frequency in blocks\n"
4643 throw std::runtime_error(
4644 "getsaplingnotescount ( minconf )\n"
4645 "Returns the number of sapling notes available in the wallet.\n"
4648 "1. minconf (numeric, optional, default=1) Only include notes in transactions confirmed at least this many times.\n"
4651 "num (numeric) the number of sapling notes in the wallet\n"
4666 for (
const auto& wtx : pwallet->
mapWallet) {
4669 if (nd.second.IsMyNote()) count++;
4684 throw std::runtime_error(
4685 "rescanblockchain (start_height) (stop_height)\n"
4686 "\nRescan the local blockchain for wallet related transactions.\n"
4688 "1. start_height (numeric, optional) block height where the rescan should start\n"
4689 "2. stop_height (numeric, optional) the last block height that should be scanned\n"
4692 " start_height (numeric) The block height where the rescan has started. If omitted, rescan started from the genesis block.\n"
4693 " stop_height (numeric) The height of the last rescanned block. If omitted, rescan stopped at the chain tip.\n"
4738 stopBlock = pindexStop ? pindexStop : pChainTip;
4770 {
"wallet",
"getaddressinfo", &
getaddressinfo,
true, {
"address"} },
4774 {
"wallet",
"abortrescan", &
abortrescan,
false, {} },
4775 {
"wallet",
"addmultisigaddress", &
addmultisigaddress,
true, {
"nrequired",
"keys",
"label"} },
4776 {
"wallet",
"backupwallet", &
backupwallet,
true, {
"destination"} },
4777 {
"wallet",
"delegatestake", &
delegatestake,
false, {
"staking_addr",
"amount",
"owner_addr",
"ext_owner",
"include_delegated",
"from_shield",
"force"} },
4778 {
"wallet",
"dumpprivkey", &
dumpprivkey,
true, {
"address"} },
4779 {
"wallet",
"dumpwallet", &
dumpwallet,
true, {
"filename"} },
4780 {
"wallet",
"encryptwallet", &
encryptwallet,
true, {
"passphrase"} },
4781 {
"wallet",
"fundrawtransaction", &
fundrawtransaction,
false, {
"hexstring",
"options"} },
4782 {
"wallet",
"getbalance", &
getbalance,
false, {
"minconf",
"include_watchonly",
"include_delegated",
"include_shield"} },
4786 {
"wallet",
"sethdseed", &
sethdseed,
true, {
"newkeypool",
"seed"} },
4787 {
"wallet",
"getnewaddress", &
getnewaddress,
true, {
"label"} },
4792 {
"wallet",
"gettransaction", &
gettransaction,
false, {
"txid",
"include_watchonly"} },
4797 {
"wallet",
"importprivkey", &
importprivkey,
true, {
"privkey",
"label",
"rescan",
"is_staking_address"} },
4798 {
"wallet",
"importwallet", &
importwallet,
true, {
"filename"} },
4799 {
"wallet",
"importaddress", &
importaddress,
true, {
"address",
"label",
"rescan",
"p2sh"} },
4800 {
"wallet",
"importpubkey", &
importpubkey,
true, {
"pubkey",
"label",
"rescan"} },
4801 {
"wallet",
"importmulti", &
importmulti,
true, {
"requests",
"options"} },
4802 {
"wallet",
"keypoolrefill", &
keypoolrefill,
true, {
"newsize"} },
4804 {
"wallet",
"listdelegators", &
listdelegators,
false, {
"blacklist"} },
4806 {
"wallet",
"listcoldutxos", &
listcoldutxos,
false, {
"not_whitelisted"} },
4808 {
"wallet",
"listreceivedbyaddress", &
listreceivedbyaddress,
false, {
"minconf",
"include_empty",
"include_watchonly",
"filter"} },
4809 {
"wallet",
"listsinceblock", &
listsinceblock,
false, {
"blockhash",
"target_confirmations",
"include_watchonly"} },
4810 {
"wallet",
"listtransactions", &
listtransactions,
false, {
"dummy",
"count",
"from",
"include_watchonly",
"include_delegated",
"include_cold"} },
4811 {
"wallet",
"listunspent", &
listunspent,
false, {
"minconf",
"maxconf",
"addresses",
"watchonly_config",
"query_options",
"include_unsafe" } },
4812 {
"wallet",
"listwallets", &
listwallets,
true, {} },
4813 {
"wallet",
"lockunspent", &
lockunspent,
true, {
"unlock",
"transparent",
"transactions"} },
4814 {
"wallet",
"rawdelegatestake", &
rawdelegatestake,
false, {
"staking_addr",
"amount",
"owner_addr",
"ext_owner",
"include_delegated",
"from_shield",
"force"} },
4815 {
"wallet",
"sendmany", &
sendmany,
false, {
"dummy",
"amounts",
"minconf",
"comment",
"include_delegated",
"subtract_fee_from"} },
4816 {
"wallet",
"sendtoaddress", &
sendtoaddress,
false, {
"address",
"amount",
"comment",
"comment-to",
"subtract_fee"} },
4817 {
"wallet",
"settxfee", &
settxfee,
true, {
"amount"} },
4819 {
"wallet",
"signmessage", &
signmessage,
true, {
"address",
"message"} },
4820 {
"wallet",
"walletlock", &
walletlock,
true, {} },
4821 {
"wallet",
"walletpassphrasechange", &
walletpassphrasechange,
true, {
"oldpassphrase",
"newpassphrase"} },
4822 {
"wallet",
"walletpassphrase", &
walletpassphrase,
true, {
"passphrase",
"timeout",
"staking_only"} },
4823 {
"wallet",
"rescanblockchain", &
rescanblockchain,
true, {
"start_height",
"stop_height"} },
4824 {
"wallet",
"delegatoradd", &
delegatoradd,
true, {
"address",
"label"} },
4826 {
"wallet",
"bip38encrypt", &
bip38encrypt,
true, {
"address",
"passphrase"} },
4827 {
"wallet",
"bip38decrypt", &
bip38decrypt,
true, {
"encrypted_key",
"passphrase"} },
4832 {
"wallet",
"exportsaplingkey", &
exportsaplingkey,
true, {
"shield_addr"} },
4833 {
"wallet",
"importsaplingkey", &
importsaplingkey,
true, {
"key",
"rescan",
"height"} },
4836 {
"wallet",
"getshieldbalance", &
getshieldbalance,
false, {
"address",
"minconf",
"include_watchonly"} },
4837 {
"wallet",
"listshieldunspent", &
listshieldunspent,
false, {
"minconf",
"maxconf",
"include_watchonly",
"addresses"} },
4838 {
"wallet",
"rawshieldsendmany", &
rawshieldsendmany,
false, {
"fromaddress",
"amounts",
"minconf",
"fee"} },
4839 {
"wallet",
"shieldsendmany", &
shieldsendmany,
false, {
"fromaddress",
"amounts",
"minconf",
"fee",
"subtract_fee_from"} },
4847 {
"wallet",
"listlabels", &
listlabels,
false, {
"purpose"} },
4848 {
"wallet",
"listreceivedbylabel", &
listreceivedbylabel,
false, {
"minconf",
"include_empty",
"include_watchonly"} },
4849 {
"wallet",
"setlabel", &
setlabel,
true, {
"address",
"label"} },
4858 for (
unsigned int vcidx = 0; vcidx <
ARRAYLEN(commands); vcidx++) {
bool IsValidPaymentAddress(const libzcash::PaymentAddress &zaddr)
Check whether a PaymentAddress is not an InvalidEncoding.
int64_t CAmount
Amount in PIV (Can be negative)
const CChainParams & Params()
Return the currently selected parameters.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
void SetFilter(CTxDestination &filter)
void GetSaplingPaymentAddresses(std::set< libzcash::SaplingPaymentAddress > &setAddress) const
virtual bool GetCScript(const CScriptID &hash, CScript &redeemScriptOut) const
bool GetSaplingExtendedSpendingKey(const libzcash::SaplingPaymentAddress &addr, libzcash::SaplingExtendedSpendingKey &extskOut) const
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
CBlockIndex * Genesis() const
Returns the index entry for the genesis block of this chain, or nullptr if none.
CBlockIndex * Tip(bool fProofOfStake=false) const
Returns the index entry for the tip of this chain, or nullptr if none.
int Height() const
Return the maximal height in the chain.
const Consensus::Params & GetConsensus() const
bool fAllowWatchOnly
Includes watch only addresses which are solvable.
bool GetKey(const CKeyID &address, CKey &keyOut) const override
bool HaveKey(const CKeyID &address) const override
Check whether a key corresponding to a given address is present in the store.
Fee rate in PIV per kilobyte: CAmount / kB.
CAmount GetFeePerK() const
An encapsulated private key.
const unsigned char * end() const
bool IsValid() const
Check whether this private key is valid.
bool IsCompressed() const
Check whether the public key corresponding to this private key is (to be) compressed.
CPubKey GetPubKey() const
Compute the public key from a private key.
void Set(const T pbegin, const T pend, bool fCompressedIn)
Initialize using begin and end iterators to byte data.
const unsigned char * begin() const
A reference to a CKey: the Hash160 of its serialized public key.
static bool SignMessage(const std::string &strMessage, std::vector< unsigned char > &vchSigRet, const CKey &key)
Sign the message, returns true if successful.
An outpoint - a combination of a transaction hash and an index n into its vout.
An encapsulated public key.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
PIVX RPC command dispatcher.
bool appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
A key allocated from the key pool.
Serialized script, used inside transaction inputs and outputs.
bool IsPayToScriptHash() const
A reference to a CScript: the Hash160 of its serialization (see script.h)
bool IsSporkActive(SporkId nSporkID)
Record info about last stake attempt:
int64_t GetLastTime() const
uint256 GetLastHash() const
int GetLastHeight() const
The basic transaction that is broadcasted on the network and contained in blocks.
An output of a transaction.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
std::map< uint256, CWalletTx > mapWallet
const std::string & GetName() const
Get a name for this wallet for logging/debugging purposes.
CStakerStatus * pStakerStatus
int GetVersion()
get the current wallet format (the oldest client version guaranteed to understand this wallet)
CAddressBookIterator NewAddressBookIterator()
int64_t nRelockTime
Lock Wallet Holds a timestamp at which point the wallet is scheduled (externally) to be relocked.
CAmount nStakeSplitThreshold
static CAmount minStakeSplitThreshold
minimum accpeted value for stake split threshold
int GetLastBlockHeight() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Get last block processed height.
bool BackupWallet(const std::string &strDest)
Creates a wallet backup in strDest path.
bool CanSupportFeature(enum WalletFeature wf)
check whether we are allowed to upgrade (or already support) to the named feature
CAmount nAutoCombineThreshold
bool HaveSpendingKeyForPaymentAddress(const libzcash::SaplingPaymentAddress &zaddr) const
Returns true if the wallet contains the spending key.
unsigned int GetKeyPoolSize()
std::multimap< int64_t, CWalletTx * > TxItems
bool fWalletUnlockStaking
SaplingScriptPubKeyMan * GetSaplingScriptPubKeyMan() const
std::map< CKeyID, CKeyMetadata > mapKeyMetadata
unsigned int GetStakingKeyPoolSize()
libzcash::SaplingPaymentAddress GenerateNewSaplingZKey(std::string label="")
Generates new Sapling key.
CAmount GetStakeSplitThreshold() const
WalletDatabase & GetDBHandle() const
A transaction with a bunch of additional info that only the owner cares about.
int GetDepthInMainChain() const NO_THREAD_SAFETY_ANALYSIS
Return depth of transaction in blockchain: <0 : conflicts with a transaction this deep in the blockch...
bool IsFromMe(const isminefilter &filter) const
int GetBlocksToMaturity() const
mapSaplingNoteData_t mapSaplingNoteData
const uint256 & GetHash() const
unsigned int nTimeReceived
std::string getError() const
CTransaction getFinalTx()
SaplingOperation * setSelectShieldedCoins(const bool select)
void setFromAddress(const CTxDestination &)
OperationResult send(std::string &retTxHash)
SaplingOperation * setRecipients(std::vector< SendManyRecipient > &vec)
SaplingOperation * setMinDepth(int _mindepth)
SaplingOperation * setFee(CAmount _fee)
SaplingOperation * setSelectTransparentCoins(const bool select, const bool _fIncludeDelegated=false)
An outpoint - a combination of a transaction hash and an index n into its sapling output description ...
std::map< libzcash::SaplingIncomingViewingKey, CKeyMetadata > mapSaplingZKeyMetadata
bool IsNoteSaplingChange(const std::set< std::pair< libzcash::PaymentAddress, uint256 >> &nullifierSet, const libzcash::PaymentAddress &address, const SaplingOutPoint &entry) const
std::set< std::pair< libzcash::PaymentAddress, uint256 > > GetNullifiersForAddresses(const std::set< libzcash::PaymentAddress > &addresses) const
void SetHDSeed(const CPubKey &key, bool force=false, bool memonly=false)
void GetFilteredNotes(std::vector< SaplingNoteEntry > &saplingEntries, Optional< libzcash::SaplingPaymentAddress > &address, int minDepth=1, bool ignoreSpent=true, bool requireSpendingKey=true, bool ignoreLocked=true) const
Find notes in the wallet filtered by payment address, min depth and ability to spend and if the notes...
const CHDChain & GetHDChain() const
CPubKey DeriveNewSeed(const CKey &key)
bool NewKeyPool()
Key pool.
void SetHDSeed(const CPubKey &key, bool force=false, bool memOnly=false)
CPubKey GenerateNewSeed()
const std::string & get_str() const
int64_t get_int64() const
const UniValue & get_obj() const
const std::vector< UniValue > & getValues() 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)
bool push_backV(const std::vector< UniValue > &vec)
Access to the wallet database.
bool WriteAutoCombineSettings(bool fEnable, CAmount nCombineThreshold, int frequency)
RAII object to check and reserve a wallet rescan.
std::string GetHex() const
SaplingFullViewingKey full_viewing_key() const
SaplingIncomingViewingKey in_viewing_key() const
void push_back(const T &value)
std::string EncodeHexTx(const CTransaction &tx)
bool DecodeHexTx(CMutableTransaction &tx, const std::string &strHexTx)
boost::variant< CTxDestination, libzcash::SaplingPaymentAddress > CWDestination
const std::string CURRENCY_UNIT
void UnlockCoin(const COutPoint &output)
CAmount GetImmatureDelegatedBalance() const
int64_t GetOldestKeyPoolTime()
CAmount GetDelegatedBalance() const
CAmount GetLegacyBalance(const isminefilter &filter, int minDepth) const
void LockNote(const SaplingOutPoint &op)
CWallet::CommitResult CommitTransaction(CTransactionRef tx, CReserveKey &opReservekey, CConnman *connman)
size_t KeypoolCountExternalKeys()
CAmount GetImmatureColdStakingBalance() const
CAmount GetColdStakingBalance() const
bool CreateTransaction(const std::vector< CRecipient > &vecSend, CTransactionRef &txRet, CReserveKey &reservekey, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, const CCoinControl *coinControl=nullptr, bool sign=true, CAmount nFeePay=0, bool fIncludeDelegated=false, bool *fStakeDelegationVoided=nullptr, int nExtraSize=0, int nMinDepth=0)
Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also cr...
std::set< std::set< CTxDestination > > GetAddressGroupings()
CAmount GetImmatureBalance() const
bool IsLockedNote(const SaplingOutPoint &op) const
std::set< SaplingOutPoint > ListLockedNotes()
CAmount GetStakingBalance(const bool fIncludeColdStaking=true) const
bool FundTransaction(CMutableTransaction &tx, CAmount &nFeeRet, bool overrideEstimatedFeeRate, const CFeeRate &specificFeeRate, int &nChangePosInOut, std::string &strFailReason, bool includeWatching, bool lockUnspents, const std::set< int > &setSubtractFeeFromOutputs, const CTxDestination &destChange=CNoDestination())
bool AvailableCoins(std::vector< COutput > *pCoins, const CCoinControl *coinControl=nullptr, AvailableCoinsFilter coinsFilter=AvailableCoinsFilter()) const
populate vCoins with vector of available COutputs.
bool SetStakeSplitThreshold(const CAmount sst)
bool TopUpKeyPool(unsigned int kpSize=0)
std::string GetNameForAddressBookEntry(const CWDestination &address) const
bool HasAddressBook(const CWDestination &address) const
CAmount GetAvailableBalance(bool fIncludeDelegated=true, bool fIncludeShielded=true) const
std::set< COutPoint > ListLockedCoins()
bool SetAddressBook(const CWDestination &address, const std::string &strName, const std::string &purpose)
bool IsLockedCoin(const uint256 &hash, unsigned int n) const
bool GetReservedKey(CPubKey &pubkey, bool internal=false)
CAmount GetUnconfirmedBalance(isminetype filter=ISMINE_SPENDABLE_ALL) const
std::string ToString() const
void LockCoin(const COutPoint &output)
std::map< CTxDestination, CAmount > GetAddressBalances()
bool StakeableCoins(std::vector< CStakeableOutput > *pCoins=nullptr)
Available coins (staking)
Optional< AddressBook::CAddressBookData > GetAddressBookEntry(const CWDestination &address) const
std::set< CTxDestination > GetLabelAddresses(const std::string &label) const
void UnlockNote(const SaplingOutPoint &op)
bool IsSaplingSpent(const SaplingOutPoint &op) const
CallResult< CTxDestination > getNewAddress(const std::string &addressLabel, const std::string purpose, const CChainParams::Base58Type addrType=CChainParams::PUBKEY_ADDRESS)
bool AddCScript(const CScript &redeemScript) override
Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki.
bool SetMaxVersion(int nVersion)
change which version we're allowed to upgrade to (note that this does not immediately imply upgrading...
ScriptPubKeyMan * GetScriptPubKeyMan() const
Get spkm.
bool Upgrade(std::string &error, const int prevVersion)
Upgrade wallet to HD and Sapling if needed.
CAmount GetColdStakingCredit(bool fUseCache=true) const
bool ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
CBlockIndex * ScanForWalletTransactions(CBlockIndex *pindexStart, CBlockIndex *pindexStop, const WalletRescanReserver &reserver, bool fUpdate=false, bool fromStartup=false)
Scan the block chain (starting in pindexStart) for transactions from or to us.
isminetype IsMine(const CTxIn &txin) const
bool SetMinVersion(enum WalletFeature, WalletBatch *batch_in=nullptr, bool fExplicit=false)
signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVe...
bool Unlock(const SecureString &strWalletPassphrase, bool anonimizeOnly=false)
CAmount GetDebit(const isminefilter &filter) const
filter decides which addresses will count towards the debit
void BlockUntilSyncedToCurrentChain()
Blocks until the wallet state is up-to-date to /at least/ the current chain at the time this function...
bool AbandonTransaction(const uint256 &hashTx)
bool IsHDEnabled() const
Whether the wallet is hd or not //.
void GetAmounts(std::list< COutputEntry > &listReceived, std::list< COutputEntry > &listSent, CAmount &nFee, const isminefilter &filter) const
bool EncryptWallet(const SecureString &strWalletPassphrase)
int64_t GetTxTime() const
bool HasSaplingSPKM() const
bool IsChange(const CTxOut &txout) const
CAmount GetCredit(const isminefilter &filter, bool recalculate=false) const
std::set< uint256 > GetConflicts() const
CAmount GetStakeDelegationCredit(bool fUseCache=true) const
bool IsSpent(const COutPoint &outpoint) const
Outpoint is spent if any non-conflicted transaction spends it:
std::string urlDecode(const std::string &urlEncoded)
std::unique_ptr< CConnman > g_connman
isminetype IsMine(const CKeyStore &keystore, const CTxDestination &dest)
isminetype
IsMine() return codes.
@ ISMINE_COLD
Indicates that we have the staking key of a P2CS.
@ ISMINE_SPENDABLE_SHIELDED
Indicates that we have the spending key of a shielded spend/output.
@ ISMINE_SPENDABLE_DELEGATED
Indicates that we have the spending key of a P2CS.
uint8_t isminefilter
used for bitflags of isminetype
CMasternodeSync masternodeSync
const std::string DELEGABLE
const std::string DELEGATOR
const std::string RECEIVE
const std::string COLD_STAKING
bool IsExchangePurpose(const std::string &purpose)
bool IsColdStakingPurpose(const std::string &purpose)
std::string EncodePaymentAddress(const libzcash::PaymentAddress &zaddr)
CKey DecodeSecret(const std::string &str)
Optional< libzcash::SaplingPaymentAddress > DecodeSaplingPaymentAddress(const std::string &strAddress)
libzcash::PaymentAddress DecodePaymentAddress(const std::string &str)
const CTxDestination * GetTransparentDestination(const CWDestination &dest)
bool IsValidDestination(const CWDestination &address)
std::string EncodeDestination(const CWDestination &address, const CChainParams::Base58Type addrType)
CWDestination DecodeDestination(const std::string &strAddress)
const libzcash::SaplingPaymentAddress * GetShieldedDestination(const CWDestination &dest)
RecursiveMutex cs_main
Global state.
boost::optional< T > Optional
Substitute for C++17 std::optional.
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_WALLET_NOT_SPECIFIED
No wallet specified (error when there are multiple wallets loaded)
@ RPC_WALLET_INVALID_LABEL_NAME
Not enough funds in wallet.
@ RPC_WALLET_UNLOCK_NEEDED
Keypool ran out, call keypoolrefill first.
@ RPC_WALLET_ALREADY_UNLOCKED
Failed to encrypt the wallet.
@ RPC_MISC_ERROR
General application defined errors.
@ RPC_WALLET_INSUFFICIENT_FUNDS
Unspecified problem with wallet (key not found etc.)
@ RPC_WALLET_WRONG_ENC_STATE
The wallet passphrase entered was incorrect.
@ RPC_WALLET_ENCRYPTION_FAILED
Command given in wrong wallet encryption state (encrypting an encrypted wallet etc....
@ RPC_TYPE_ERROR
Server is in safe mode, and command is not allowed in safe mode.
@ RPC_INVALID_PARAMETER
Ran out of memory during operation.
@ RPC_IN_WARMUP
Transaction already in chain.
@ RPC_WALLET_ERROR
No valid connection manager instance found.
@ RPC_WALLET_NOT_FOUND
Wallet is already unlocked.
@ RPC_WALLET_KEYPOOL_RAN_OUT
Invalid label name.
@ RPC_CLIENT_IN_INITIAL_DOWNLOAD
PIVX is not connected.
@ RPC_DESERIALIZATION_ERROR
Database error.
@ RPC_WALLET_PASSPHRASE_INCORRECT
Enter the wallet passphrase with walletpassphrase first.
@ RPC_INVALID_ADDRESS_OR_KEY
Unexpected type was passed as parameter.
@ RPC_CLIENT_P2P_DISABLED
Invalid IP/Subnet.
UniValue listaddressgroupings(const JSONRPCRequest &request)
UniValue setlabel(const JSONRPCRequest &request)
UniValue rescanblockchain(const JSONRPCRequest &request)
CScript _createmultisig_redeemScript(CWallet *const pwallet, const UniValue ¶ms)
Used by addmultisigaddress / createmultisig:
UniValue listcoldutxos(const JSONRPCRequest &request)
UniValue delegatestake(const JSONRPCRequest &request)
UniValue rawdelegatestake(const JSONRPCRequest &request)
UniValue listreceivedbyshieldaddress(const JSONRPCRequest &request)
CWallet * GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
UniValue importpubkey(const JSONRPCRequest &request)
UniValue liststakingaddresses(const JSONRPCRequest &request)
UniValue getautocombinethreshold(const JSONRPCRequest &request)
UniValue lockunspent(const JSONRPCRequest &request)
UniValue listreceivedbyaddress(const JSONRPCRequest &request)
UniValue importprivkey(const JSONRPCRequest &request)
UniValue addmultisigaddress(const JSONRPCRequest &request)
std::string HelpRequiringPassphrase(CWallet *const pwallet)
UniValue listshieldunspent(const JSONRPCRequest &request)
UniValue viewshieldtransaction(const JSONRPCRequest &request)
UniValue getrawchangeaddress(const JSONRPCRequest &request)
UniValue delegatoradd(const JSONRPCRequest &request)
UniValue getaddressinfo(const JSONRPCRequest &request)
UniValue delegatorremove(const JSONRPCRequest &request)
UniValue getstakingstatus(const JSONRPCRequest &request)
UniValue walletlock(const JSONRPCRequest &request)
UniValue getshieldbalance(const JSONRPCRequest &request)
UniValue bip38decrypt(const JSONRPCRequest &request)
UniValue shieldsendmany(const JSONRPCRequest &request)
UniValue settxfee(const JSONRPCRequest &request)
UniValue getstakesplitthreshold(const JSONRPCRequest &request)
UniValue listshieldaddresses(const JSONRPCRequest &request)
UniValue sethdseed(const JSONRPCRequest &request)
UniValue fundrawtransaction(const JSONRPCRequest &request)
UniValue rawshieldsendmany(const JSONRPCRequest &request)
UniValue listdelegators(const JSONRPCRequest &request)
UniValue listreceivedbylabel(const JSONRPCRequest &request)
void RegisterWalletRPCCommands(CRPCTable &tableRPC)
UniValue listlockunspent(const JSONRPCRequest &request)
UniValue exportsaplingkey(const JSONRPCRequest &request)
UniValue abandontransaction(const JSONRPCRequest &request)
UniValue dumpwallet(const JSONRPCRequest &request)
UniValue listtransactions(const JSONRPCRequest &request)
UniValue keypoolrefill(const JSONRPCRequest &request)
UniValue exportsaplingviewingkey(const JSONRPCRequest &request)
UniValue getreceivedbyaddress(const JSONRPCRequest &request)
UniValue getwalletinfo(const JSONRPCRequest &request)
bool HaveKey(const CWallet *wallet, const CKey &key)
Checks if a CKey is in the given CWallet compressed or otherwise.
UniValue listlabels(const JSONRPCRequest &request)
UniValue signmessage(const JSONRPCRequest &request)
UniValue importwallet(const JSONRPCRequest &request)
UniValue listwallets(const JSONRPCRequest &request)
UniValue setautocombinethreshold(const JSONRPCRequest &request)
UniValue getnewstakingaddress(const JSONRPCRequest &request)
UniValue getdelegatedbalance(const JSONRPCRequest &request)
UniValue abortrescan(const JSONRPCRequest &request)
UniValue sendmany(const JSONRPCRequest &request)
UniValue gettransaction(const JSONRPCRequest &request)
UniValue sendtoaddress(const JSONRPCRequest &request)
UniValue getreceivedbylabel(const JSONRPCRequest &request)
UniValue dumpprivkey(const JSONRPCRequest &request)
UniValue importaddress(const JSONRPCRequest &request)
void EnsureWalletIsUnlocked(CWallet *const pwallet, bool fAllowAnonOnly)
UniValue getnewshieldaddress(const JSONRPCRequest &request)
UniValue importsaplingkey(const JSONRPCRequest &request)
UniValue walletpassphrasechange(const JSONRPCRequest &request)
UniValue setstakesplitthreshold(const JSONRPCRequest &request)
UniValue encryptwallet(const JSONRPCRequest &request)
UniValue importsaplingviewingkey(const JSONRPCRequest &request)
UniValue getunconfirmedbalance(const JSONRPCRequest &request)
UniValue walletpassphrase(const JSONRPCRequest &request)
bool EnsureWalletIsAvailable(CWallet *const pwallet, bool avoidException)
UniValue getbalance(const JSONRPCRequest &request)
UniValue getnewexchangeaddress(const JSONRPCRequest &request)
UniValue upgradewallet(const JSONRPCRequest &request)
UniValue listsinceblock(const JSONRPCRequest &request)
UniValue listunspent(const JSONRPCRequest &request)
UniValue getaddressesbylabel(const JSONRPCRequest &request)
UniValue getnewaddress(const JSONRPCRequest &request)
UniValue bip38encrypt(const JSONRPCRequest &request)
UniValue importmulti(const JSONRPCRequest &request)
UniValue getsaplingnotescount(const JSONRPCRequest &request)
UniValue backupwallet(const JSONRPCRequest &request)
std::string LabelFromValue(const UniValue &value)
UniValue getcoldstakingbalance(const JSONRPCRequest &request)
CPubKey parseWIFKey(std::string strKey, CWallet *pwallet)
OperationResult CheckTransactionSize(std::vector< SendManyRecipient > &recipients, bool fromTaddr)
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
void RPCTypeCheckArgument(const UniValue &value, const UniValueType &typeExpected)
Type-check one argument; throws JSONRPCError if wrong type given.
UniValue ValueFromAmount(const CAmount &amount)
void RPCRunLater(const std::string &name, std::function< void(void)> func, int64_t nSeconds)
Run func nSeconds from now.
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)
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.
CSporkManager sporkManager
@ SPORK_19_COLDSTAKING_MAINTENANCE
@ SPORK_20_SAPLING_MAINTENANCE
bool ExtractDestinations(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
Parse a standard scriptPubKey with one or more destination addresses.
CScript GetScriptForStakeDelegation(const CKeyID &stakingKey, const CKeyID &spendingKey)
Generate a P2CS script for the given staker and owner keys.
CScript GetScriptForStakeDelegationLOF(const CKeyID &stakingKey, const CKeyID &spendingKey)
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a PIVX scriptPubKey for the given CTxDestination.
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet, bool fColdStake)
Parse a standard scriptPubKey for the destination address.
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
A mutable version of CTransaction.
std::vector< CTxOut > vout
std::set< CTxDestination > * onlyFilteredDest
CAmount nMinimumSumAmount
unsigned int nMaximumCount
CWallet::CommitStatus status
Parameters that influence chain consensus.
bool NetworkUpgradeActive(int nHeight, Consensus::UpgradeIndex idx) const
Returns true if the given network upgrade is active as of the given block height.
unsigned char fingerprint[4]
First 32 bits of the Hash160 of the public key at the root of the path.
std::string pathToString() const
Sapling note, its location in a transaction, and number of confirmations.
Wrapper for UniValue::VType, which includes typeAny: Used to denote don't care type.
libzcash::SaplingExpandedSpendingKey expsk
std::vector< uint256 > txids
#define AssertLockHeld(cs)
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a Optional result.
#define EXCLUSIVE_LOCKS_REQUIRED(...)
std::shared_ptr< const CTransaction > CTransactionRef
bool IsFinalTx(const CTransactionRef &tx, int nBlockHeight, int64_t nBlockTime)
Check if transaction is final and can be included in a block with the specified height and time.
const uint256 UINT256_ZERO
constant uint256 instances
uint256 uint256S(const char *str)
const UniValue & find_value(const UniValue &obj, const std::string &name)
const UniValue NullUniValue
std::string FormatMoney(const CAmount &n, bool fPlus)
Money parsing/formatting utilities.
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 unsigned char > input)
bool IsValidUTF8(const std::string &str)
Checks for valid 4-byte UTF-8 encoding in a string.
T FindFirstNonZero(T itbegin, T itend)
int64_t GetTime()
DEPRECATED Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)
bool CheckFinalTx(const CTransactionRef &tx, int flags)
Check if transaction will be final in the next block to be created.
bool IsInitialBlockDownload()
Check whether we are doing an initial block download (synchronizing from disk or network)
std::unique_ptr< CCoinsViewCache > pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
CBlockIndex * LookupBlockIndex(const uint256 &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
std::vector< CWalletRef > vpwallets
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE)
Settings.
@ FEATURE_PRE_SPLIT_KEYPOOL