58 static const std::map<ProRegParam, std::string> mapParamHelp = {
60 "%d. \"collateralAddress\" (string, required) The PIVX address to send the collateral to.\n"
63 "%d. \"collateralHash\" (string, required) The collateral transaction hash.\n"
66 "%d. collateralIndex (numeric, required) The collateral transaction output index.\n"
69 "%d. \"ipAndPort\" (string, required) IP and port in the form \"IP:PORT\".\n"
70 " Must be unique on the network. Can be set to 0, which will require a ProUpServTx afterwards.\n"
73 "%d. \"ipAndPort\" (string, required) IP and port in the form \"IP:PORT\".\n"
74 " If set to an empty string, the currently active ip is reused.\n"
77 "%d. \"operatorPubKey\" (string, required) The operator BLS public key. The BLS private key does not have to be known.\n"
78 " It has to match the BLS private key which is later used when operating the masternode.\n"
81 "%d. \"operatorPubKey\" (string, required) The operator BLS public key. The BLS private key does not have to be known.\n"
82 " It has to match the BLS private key which is later used when operating the masternode.\n"
83 " If set to an empty string, the currently active operator BLS public key is reused.\n"
86 "%d. \"operatorKey\" (string, optional) The operator BLS private key associated with the\n"
87 " registered operator public key. If not specified, or set to an empty string, then this command must\n"
88 " be performed on the active masternode with the corresponding operator key.\n"
91 "%d. \"operatorPayoutAddress\" (string, optional) The address used for operator reward payments.\n"
92 " Only allowed when the ProRegTx had a non-zero operatorReward value.\n"
93 " If set to an empty string, the operatorPubKey is used.\n"
96 "%d. \"operatorPayoutAddress\" (string, optional) The address used for operator reward payments.\n"
97 " Only allowed when the ProRegTx had a non-zero operatorReward value.\n"
98 " If set to an empty string, the currently active one is reused.\n"
101 "%d. \"operatorReward\" (numeric, optional) The fraction in %% to share with the operator. The value must be\n"
102 " between 0.00 and 100.00. If not set, it takes the default value of 0.0\n"
105 "%d. \"ownerAddress\" (string, required) The PIVX address to use for payee updates and proposal voting.\n"
106 " The private key belonging to this address must be known in your wallet, in order to send updates.\n"
107 " The address must not be already registered, and must differ from the collateralAddress\n"
110 "%d. \"ownerKey\" (string, optional) The owner key associated with the operator address of the masternode.\n"
111 " If not specified, or set to an empty string, then the mn key must be known by your wallet, in order to sign the tx.\n"
114 "%d. \"payoutAddress\" (string, required) The PIVX address to use for masternode reward payments.\n"
117 "%d. \"payoutAddress\" (string, required) The PIVX address to use for masternode reward payments.\n"
118 " If set to an empty string, the currently active payout address is reused.\n"
121 "%d. \"proTxHash\" (string, required) The hash of the initial ProRegTx.\n"
124 "%d. reason (numeric, optional) The reason for masternode service revocation. Default: 0.\n"
125 " 0=not_specified, 1=service_termination, 2=compromised_keys, 3=keys_change.\n"
128 "%d. \"votingAddress\" (string, required) The voting key address. The private key does not have to be known by your wallet.\n"
129 " It has to match the private key which is later used when voting on proposals.\n"
130 " If set to an empty string, ownerAddress will be used.\n"
133 "%d. \"votingAddress\" (string, required) The voting key address. The private key does not have to be known by your wallet.\n"
134 " It has to match the private key which is later used when voting on proposals.\n"
135 " If set to an empty string, the currently active voting key address is reused.\n"
141 auto it = mapParamHelp.find(p);
142 if (it == mapParamHelp.end())
143 throw std::runtime_error(
strprintf(
"FIXME: WRONG PARAM: %d!", (
int)p));
153 if (!pwallet->
GetKey(keyID, key)) {
161 static void CheckEvoUpgradeEnforcement()
170 static CKey ParsePrivKey(
CWallet* pwallet,
const std::string &strKeyOrAddress,
bool allowAddresses =
true) {
171 bool isStaking{
false}, isShield{
false}, isExchange{
false};
183 throw std::runtime_error(
"addresses not supported when wallet is disabled");
186 const CKeyID* keyID = boost::get<CKeyID>(dest);
187 assert (keyID !=
nullptr);
188 return GetKeyFromWallet(pwallet, *keyID);
190 throw std::runtime_error(
"addresses not supported in no-wallet builds");
199 static CKeyID ParsePubKeyIDFromAddress(
const std::string& strAddress)
201 bool isStaking{
false}, isShield{
false}, isExchange{
false};
236 if (!hexKey.empty()) {
237 return ParseBLSSecretKey(params, hexKey);
265 template<
typename SpecialTxPayload>
271 std::vector<CRecipient> vecSend;
272 bool dummyTxOutAdded =
false;
274 if (tx.
vout.empty()) {
276 tx.
vout.emplace_back(dummyTxOut);
277 dummyTxOutAdded =
true;
283 std::string strFailReason;
284 std::set<int> setSubtractFeeFromOutputs;
285 if (!pwallet->
FundTransaction(tx, nFee,
false, feeRate, nChangePos, strFailReason,
false,
false, {}))
288 if (dummyTxOutAdded && tx.
vout.size() > 1) {
291 auto it = std::find(tx.
vout.begin(), tx.
vout.end(), dummyTxOut);
292 assert(it != tx.
vout.end());
296 UpdateSpecialTxInputsHash(tx, payload);
301 template<
typename SpecialTxPayload>
302 static void UpdateSpecialTxInputsHash(
const CMutableTransaction& tx, SpecialTxPayload& payload)
307 template<
typename SpecialTxPayload>
308 static void SignSpecialTxPayloadByHash(
const CMutableTransaction& tx, SpecialTxPayload& payload,
const CKey& key)
310 payload.vchSig.clear();
318 template<
typename SpecialTxPayload>
322 if (!payload.sig.IsValid()) {
327 template<
typename SpecialTxPayload>
328 static void SignSpecialTxPayloadByString(SpecialTxPayload& payload,
const CKey& key)
330 payload.vchSig.clear();
332 std::string m = payload.MakeSignString();
338 static std::string TxInErrorToString(
int i,
const CTxIn& txin,
const std::string& strError)
349 for (
unsigned int i = 0; i < tx.
vin.size(); i++) {
353 return errorOut(TxInErrorToString(i, txin,
"not found or already spent"));
360 return errorOut(TxInErrorToString(i, txin,
"signature failed"));
367 template<
typename SpecialTxPayload>
390 static ProRegPL ParseProRegPLParams(
const UniValue& params,
unsigned int paramIdx)
392 assert(params.
size() > paramIdx + 4);
393 assert(params.
size() < paramIdx + 8);
394 const auto& chainparams =
Params();
398 const std::string& strIpPort = params[paramIdx].
get_str();
399 if (!strIpPort.empty()) {
400 if (!
Lookup(strIpPort, pl.
addr, chainparams.GetDefaultPort(),
false)) {
406 const std::string& strAddOwner = params[paramIdx + 1].
get_str();
407 const std::string& strPubKeyOperator = params[paramIdx + 2].
get_str();
408 const std::string& strAddVoting = params[paramIdx + 3].
get_str();
409 pl.
keyIDOwner = ParsePubKeyIDFromAddress(strAddOwner);
410 pl.
pubKeyOperator = ParseBLSPubKey(chainparams, strPubKeyOperator);
412 if (!strAddVoting.empty()) {
413 pl.
keyIDVoting = ParsePubKeyIDFromAddress(strAddVoting);
417 const std::string& strAddPayee = params[paramIdx + 4].
get_str();
422 if (params.
size() > paramIdx + 5) {
423 int64_t operReward = 0;
424 if (!
ParseFixedPoint(params[paramIdx + 5].getValStr(), 2, &operReward)) {
427 if (operReward < 0 || operReward > 10000) {
431 if (params.
size() > paramIdx + 6) {
433 const std::string& strAddOpPayee = params[paramIdx + 6].
get_str();
436 }
else if (!strAddOpPayee.empty()) {
453 throw std::runtime_error(
455 "protx_register \"collateralHash\" collateralIndex \"ipAndPort\" \"ownerAddress\" \"operatorPubKey\" \"votingAddress\" \"payoutAddress\" (operatorReward \"operatorPayoutAddress\")\n"
456 "The collateral is specified through \"collateralHash\" and \"collateralIndex\" and must be an unspent\n"
457 "transaction output spendable by this wallet. It must also not be used by any other masternode.\n"
459 "protx_register_prepare \"collateralHash\" collateralIndex \"ipAndPort\" \"ownerAddress\" \"operatorPubKey\" \"votingAddress\" \"payoutAddress\" (operatorReward \"operatorPayoutAddress\")\n"
460 "\nCreates an unsigned ProTx and returns it. The ProTx must be signed externally with the collateral\n"
461 "key and then passed to \"protx_register_submit\".\n"
462 "The collateral is specified through \"collateralHash\" and \"collateralIndex\" and must be an unspent transaction output.\n"
477 "\"txid\" (string) The transaction id.\n"
479 +
HelpExampleCli(
"protx_register",
"\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\" 0 \"168.192.1.100:51472\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"")
482 " \"tx\" : (string) The serialized ProTx in hex format.\n"
483 " \"collateralAddress\" : (string) The collateral address.\n"
484 " \"signMessage\" : (string) The string message that needs to be signed with the collateral key\n"
487 +
HelpExampleCli(
"protx_register_prepare",
"\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\" 0 \"168.192.1.100:51472\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"")
492 if (fSignAndSend) CheckEvoUpgradeEnforcement();
511 tx.
nType = CTransaction::TxType::PROREG;
523 const CKeyID* keyID = boost::get<CKeyID>(&txDest);
528 if (fSignAndSend && !pwallet->
GetKey(*keyID, keyCollateral)) {
535 FundSpecialTx(pwallet, tx, pl);
538 SignSpecialTxPayloadByString(pl, keyCollateral);
540 return SignAndSendSpecialTx(pwallet, tx, pl);
554 return ProTxRegister(request,
true);
559 return ProTxRegister(request,
false);
570 throw std::runtime_error(
571 "protx_register_submit \"tx\" \"sig\"\n"
572 "\nSubmits the specified ProTx to the network. This command will also sign the inputs of the transaction\n"
573 "which were previously added by \"protx_register_prepare\" to cover transaction fees\n"
576 "1. \"tx\" (string, required) The serialized transaction previously returned by \"protx_register_prepare\"\n"
577 "2. \"sig\" (string, required) The signature signed with the collateral key. Must be in base64 format.\n"
579 "\"txid\" (string) The transaction id.\n"
584 CheckEvoUpgradeEnforcement();
595 if (tx.
nType != CTransaction::TxType::PROREG) {
609 return SignAndSendSpecialTx(pwallet, tx, pl);
620 throw std::runtime_error(
621 "protx_register_fund \"collateralAddress\" \"ipAndPort\" \"ownerAddress\" \"operatorPubKey\" \"votingAddress\" \"payoutAddress\" (operatorReward \"operatorPayoutAddress\")\n"
622 "\nCreates, funds and sends a ProTx to the network. The resulting transaction will move 10000 PIV\n"
623 "to the address specified by collateralAddress and will then function as masternode collateral.\n"
635 "\"txid\" (string) The transaction id.\n"
637 +
HelpExampleCli(
"protx_register_fund",
"\"DKHHBsuU9zfxxxVaqqqQqK4MxZg6vzpf8\" \"168.192.1.100:51472\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"")
640 CheckEvoUpgradeEnforcement();
656 tx.
nType = CTransaction::TxType::PROREG;
657 tx.
vout.emplace_back(collAmt, collateralScript);
659 FundSpecialTx(pwallet, tx, pl);
661 for (uint32_t i = 0; i < tx.
vout.size(); i++) {
662 if (tx.
vout[i].nValue == collAmt && tx.
vout[i].scriptPubKey == collateralScript) {
671 return SignAndSendSpecialTx(pwallet, tx, pl);
676 static bool CheckWalletOwnsScript(
CWallet* pwallet,
const CScript& script)
684 const CKeyID* keyID = boost::get<CKeyID>(&dest);
685 if (keyID && pwallet->
HaveKey(*keyID))
687 const CScriptID* scriptID = boost::get<CScriptID>(&dest);
701 auto lastAttempt = info->GetLastOutboundAttempt();
702 auto lastSuccess = info->GetLastOutboundSuccess();
703 ret.
pushKV(
"last_outbound_attempt", lastAttempt);
704 ret.
pushKV(
"last_outbound_attempt_elapsed", now - lastAttempt);
705 ret.
pushKV(
"last_outbound_success", lastSuccess);
706 ret.
pushKV(
"last_outbound_success_elapsed", now - lastSuccess);
712 assert(!fFromWallet || pwallet);
715 bool hasOwnerKey{
false};
716 bool hasVotingKey{
false};
717 bool ownsCollateral{
false};
718 bool ownsPayeeScript{
false};
721 bool skipWalletCheck = !fFromWallet && !fVerbose;
723 if (pwallet && !skipWalletCheck) {
725 hasOwnerKey = pwallet->
HaveKey(dmn->pdmnState->keyIDOwner);
726 hasVotingKey = pwallet->
HaveKey(dmn->pdmnState->keyIDVoting);
727 ownsPayeeScript = CheckWalletOwnsScript(pwallet, dmn->pdmnState->scriptPayout);
730 if (
GetTransaction(dmn->collateralOutpoint.hash, collTx, hashBlock,
true)) {
731 ownsCollateral = CheckWalletOwnsScript(pwallet, collTx->vout[dmn->collateralOutpoint.n].scriptPubKey);
735 if (fFromWallet && !hasOwnerKey && !hasVotingKey && !ownsCollateral && !ownsPayeeScript) {
743 o.
pushKV(
"confirmations", confs);
744 o.
pushKV(
"has_owner_key", hasOwnerKey);
745 o.
pushKV(
"has_voting_key", hasVotingKey);
746 o.
pushKV(
"owns_collateral", ownsCollateral);
747 o.
pushKV(
"owns_payee_script", ownsPayeeScript);
750 if (metaInfo) o.
pushKV(
"metaInfo", ToJson(metaInfo));
753 ret.
push_back(dmn->proTxHash.ToString());
760 throw std::runtime_error(
761 "protx_list (detailed wallet_only valid_only height)\n"
762 "\nLists all ProTxs.\n"
764 "1. \"detailed\" (bool, optional, default=true) Return detailed information about each protx.\n"
765 " If set to false, return only the list of txids.\n"
766 "2. \"wallet_only\" (bool, optional, default=false) If set to true, return only protx which involves\n"
767 " keys from this wallet (collateral, owner, operator, voting, or payout addresses).\n"
768 "3. \"valid_only\" (bool, optional, default=false) If set to true, return only ProTx which are active/valid\n"
769 " at the height specified.\n"
770 "4. \"height\" (numeric, optional) If height is not specified, it defaults to the current chain-tip.\n"
772 "[...] (list) List of protx txids or, if detailed=true, list of json objects.\n"
779 CheckEvoUpgradeEnforcement();
784 CWallet*
const pwallet =
nullptr;
791 if (fFromWallet && !pwallet) {
802 if (height <= 0 || height > pindexTip->
nHeight) {
816 AddDMNEntryToList(ret, pwallet, dmn, fVerbose, fFromWallet);
830 throw std::runtime_error(
831 "protx_update_service \"proTxHash\" \"ipAndPort\" (\"operatorPayoutAddress\" \"operatorKey\")\n"
832 "\nCreates and sends a ProUpServTx to the network. This will update the IP address\n"
833 "of a masternode, and/or the operator payout address.\n"
834 "If the IP is changed for a masternode that got PoSe-banned, the ProUpServTx will also revive this masternode.\n"
842 "\"txid\" (string) The transaction id.\n"
844 +
HelpExampleCli(
"protx_update_service",
"\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\" \"168.192.1.100:51472\"")
847 CheckEvoUpgradeEnforcement();
862 const auto& chainparams =
Params();
864 if (!addrStr.empty()) {
865 if (!
Lookup(addrStr.c_str(), pl.
addr, chainparams.GetDefaultPort(),
false)) {
869 pl.
addr = dmn->pdmnState->addr;
873 const std::string& strAddOpPayee = request.
params[2].
get_str();
874 if (!strAddOpPayee.empty()) {
875 if (dmn->nOperatorReward > 0) {
888 tx.
nType = CTransaction::TxType::PROUPSERV;
890 FundSpecialTx(pwallet, tx, pl);
893 return SignAndSendSpecialTx(pwallet, tx, pl);
904 throw std::runtime_error(
905 "protx update_registrar \"proTxHash\" \"operatorPubKey\" \"votingAddress\" \"payoutAddress\" (\"ownerKey\")\n"
906 "\nCreates and sends a ProUpRegTx to the network. This will update the operator key, voting key and payout\n"
907 "address of the masternode specified by \"proTxHash\".\n"
908 "The owner key of this masternode must be known to your wallet.\n"
917 "\"txid\" (string) The transaction id.\n"
919 +
HelpExampleCli(
"protx_update_registrar",
"\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\" \"DMJRSsuU9zfyrvxVaAEFQqK4MxZg6vgeS6\"")
922 CheckEvoUpgradeEnforcement();
932 const auto& chainparams =
Params();
942 const std::string& strPubKeyOperator = request.
params[1].
get_str();
943 pl.
pubKeyOperator = strPubKeyOperator.empty() ? dmn->pdmnState->pubKeyOperator.Get()
944 : ParseBLSPubKey(chainparams, strPubKeyOperator);
946 const std::string& strVotingAddress = request.
params[2].
get_str();
947 pl.
keyIDVoting = strVotingAddress.empty() ? dmn->pdmnState->keyIDVoting
948 : ParsePubKeyIDFromAddress(strVotingAddress);
955 const CKey&
ownerKey = strOwnKey.empty() ? GetKeyFromWallet(pwallet, dmn->pdmnState->keyIDOwner)
956 : ParsePrivKey(pwallet, strOwnKey,
false);
960 tx.
nType = CTransaction::TxType::PROUPREG;
964 FundSpecialTx(pwallet, tx, pl);
965 SignSpecialTxPayloadByHash(tx, pl,
ownerKey);
967 return SignAndSendSpecialTx(pwallet, tx, pl);
978 throw std::runtime_error(
979 "protx_update_revoke \"proTxHash\" (\"operatorKey\" reason)\n"
980 "\nCreates and sends a ProUpRevTx to the network. This will revoke the operator key of the masternode and\n"
981 "put it into the PoSe-banned state. It will also set the service field of the masternode\n"
982 "to zero. Use this in case your operator key got compromised or you want to stop providing your service\n"
983 "to the masternode owner.\n"
990 "\"txid\" (string) The transaction id.\n"
992 +
HelpExampleCli(
"protx_revoke",
"\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\"")
993 +
HelpExampleCli(
"protx_revoke",
"\"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\" \"\" 2")
996 CheckEvoUpgradeEnforcement();
1002 const auto& chainparams =
Params();
1016 pl.
nReason = ProUpRevPL::RevocationReason::REASON_NOT_SPECIFIED;
1019 if (nReason < 0 || nReason > ProUpRevPL::RevocationReason::REASON_LAST) {
1021 nReason, ProUpRevPL::RevocationReason::REASON_LAST));
1023 pl.
nReason = (uint16_t)nReason;
1028 tx.
nType = CTransaction::TxType::PROUPREV;
1030 FundSpecialTx(pwallet, tx, pl);
1033 return SignAndSendSpecialTx(pwallet, tx, pl);
1040 throw std::runtime_error(
1041 "generateblskeypair\n"
1042 "\nReturns a BLS secret/public key pair.\n"
1045 " \"secret\": \"xxxx\", (string) BLS secret key\n"
1046 " \"public\": \"xxxx\", (string) BLS public key\n"
1054 const auto& params =
Params();
1068 {
"evo",
"protx_list", &
protx_list,
true, {
"detailed",
"wallet_only",
"valid_only",
"height"} },
1069 #ifdef ENABLE_WALLET
1070 {
"evo",
"protx_register", &protx_register,
true, {
"collateralHash",
"collateralIndex",
"ipAndPort",
"ownerAddress",
"operatorPubKey",
"votingAddress",
"payoutAddress",
"operatorReward",
"operatorPayoutAddress"} },
1071 {
"evo",
"protx_register_fund", &protx_register_fund,
true, {
"collateralAddress",
"ipAndPort",
"ownerAddress",
"operatorPubKey",
"votingAddress",
"payoutAddress",
"operatorReward",
"operatorPayoutAddress"} },
1072 {
"evo",
"protx_register_prepare", &protx_register_prepare,
true, {
"collateralHash",
"collateralIndex",
"ipAndPort",
"ownerAddress",
"operatorPubKey",
"votingAddress",
"payoutAddress",
"operatorReward",
"operatorPayoutAddress"} },
1073 {
"evo",
"protx_register_submit", &protx_register_submit,
true, {
"tx",
"sig"} },
1074 {
"evo",
"protx_revoke", &protx_revoke,
true, {
"proTxHash",
"operatorKey",
"reason"} },
1075 {
"evo",
"protx_update_registrar", &protx_update_registrar,
true, {
"proTxHash",
"operatorPubKey",
"votingAddress",
"payoutAddress",
"ownerKey"} },
1076 {
"evo",
"protx_update_service", &protx_update_service,
true, {
"proTxHash",
"ipAndPort",
"operatorPayoutAddress",
"operatorKey"} },
1083 for (
const auto& command : commands) {
bool GetActiveDMNKeys(CBLSSecretKey &key, CTxIn &vin)
int64_t CAmount
Amount in PIV (Can be negative)
const CChainParams & Params()
Return the currently selected parameters.
std::string ToStringShort() const
CBLSPublicKey GetPublicKey() const
CBLSSignature Sign(const uint256 &hash) const
virtual bool HaveCScript(const CScriptID &hash) const
The block chain is a tree shaped structure starting with the genesis block at the root,...
uint256 GetBlockHash() const
int nHeight
height of the entry in the chain. The genesis block has height 0
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.
CChainParams defines various tweakable parameters of a given instance of the PIVX system.
const Consensus::Params & GetConsensus() const
CCoinsView that adds a memory cache for transactions to another CCoinsView.
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.
void ForEachMN(bool onlyValid, Callback &&cb) const
Fee rate in PIV per kilobyte: CAmount / kB.
static bool SignHash(const uint256 &hash, const CKey &key, std::vector< unsigned char > &vchSigRet)
Sign the hash, returns true if successful.
An encapsulated private key.
bool IsValid() const
Check whether this private key is valid.
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.
static constexpr unsigned int COMPACT_SIGNATURE_SIZE
PIVX RPC command dispatcher.
bool appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
Serialized script, used inside transaction inputs and outputs.
A reference to a CScript: the Hash160 of its serialization (see script.h)
The basic transaction that is broadcasted on the network and contained in blocks.
An input of a transaction.
An output of a transaction.
Capture information about block/transaction validation.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
CTxOut out
unspent transaction output
std::string getError() const
static const uint16_t CURRENT_VERSION
CScript scriptOperatorPayout
COutPoint collateralOutpoint
CBLSPublicKey pubKeyOperator
std::vector< unsigned char > vchSig
std::string MakeSignString() const
std::vector< unsigned char > vchSig
CBLSPublicKey pubKeyOperator
static const uint16_t CURRENT_VERSION
CScript scriptOperatorPayout
const std::string & get_str() const
bool push_back(const UniValue &val)
bool pushKV(const std::string &key, const UniValue &val)
std::string ToString() const
std::string GetHex() const
std::string EncodeHexTx(const CTransaction &tx)
bool DecodeHexTx(CMutableTransaction &tx, const std::string &strHexTx)
boost::variant< CTxDestination, libzcash::SaplingPaymentAddress > CWDestination
std::unique_ptr< CDeterministicMNManager > deterministicMNManager
std::shared_ptr< const CDeterministicMN > CDeterministicMNCPtr
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())
void BlockUntilSyncedToCurrentChain()
Blocks until the wallet state is up-to-date to /at least/ the current chain at the time this function...
uint256 SerializeHash(const T &obj, int nType=SER_GETHASH, int nVersion=PROTOCOL_VERSION)
Compute the 256-bit hash of an object's serialization.
CKey DecodeSecret(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)
Optional< CBLSSecretKey > DecodeSecret(const CChainParams ¶ms, const std::string &keyStr)
std::string EncodeSecret(const CChainParams ¶ms, const CBLSSecretKey &key)
Optional< CBLSPublicKey > DecodePublic(const CChainParams ¶ms, const std::string &keyStr)
std::string EncodePublic(const CChainParams ¶ms, const CBLSPublicKey &pk)
RecursiveMutex cs_main
Global state.
bool Lookup(const std::string &name, std::vector< CService > &vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
OperationResult errorOut(const std::string &errorStr)
void TryATMP(const CMutableTransaction &mtx, bool fOverrideFees)
void RelayTx(const uint256 &hashTx)
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_MISC_ERROR
General application defined errors.
@ RPC_INVALID_PARAMETER
Ran out of memory during operation.
@ RPC_INVALID_ADDRESS_OR_KEY
Unexpected type was passed as parameter.
UniValue generateblskeypair(const JSONRPCRequest &request)
@ operatorPayoutAddress_update
@ operatorPayoutAddress_register
@ operatorPubKey_register
void RegisterEvoRPCCommands(CRPCTable &_tableRPC)
Register Evo RPC commands.
UniValue protx_list(const JSONRPCRequest &request)
std::string GetHelpString(int nParamNum, ProRegParam p)
CWallet * GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
std::string HelpRequiringPassphrase(CWallet *const pwallet)
void EnsureWalletIsUnlocked(CWallet *const pwallet, bool fAllowAnonOnly)
bool EnsureWalletIsAvailable(CWallet *const pwallet, bool avoidException)
std::string HelpExampleCli(std::string methodname, std::string args)
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 UpdateTransaction(CMutableTransaction &tx, unsigned int nIn, const SignatureData &data)
bool ProduceSignature(const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata, SigVersion sigversion, bool fColdStake, ScriptError *serror)
Produce a script signature using a generic signature creator.
bool CheckSpecialTx(const CTransaction &tx, const CBlockIndex *pindexPrev, const CCoinsViewCache *view, CValidationState &state)
Payload validity checks (including duplicate unique properties against list at pindexPrev)
uint256 CalcTxInputsHash(const CTransaction &tx)
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.
uint256 GetHash() const
Compute the hash of this CMutableTransaction.
SigVersion GetRequiredSigVersion() const
std::vector< CTxOut > vout
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
#define AssertLockHeld(cs)
int64_t GetAdjustedTime()
void SetTxPayload(CMutableTransaction &tx, const T &payload)
bool GetTxPayload(const std::vector< unsigned char > &payload, T &obj)
std::shared_ptr< const CTransaction > CTransactionRef
const UniValue NullUniValue
bool NetworkUpgradeActive(int nHeight, const Consensus::Params ¶ms, Consensus::UpgradeIndex idx)
Returns true if the given network upgrade is active as of the given block height.
std::string FormatStateMessage(const CValidationState &state)
Convert CValidationState to a human-readable message for logging.
std::vector< unsigned char > DecodeBase64(const char *p, bool *pfInvalid)
bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out)
Parse number as fixed point according to JSON number syntax.
bool GetTransaction(const uint256 &hash, CTransactionRef &txOut, uint256 &hashBlock, bool fAllowSlow, CBlockIndex *blockIndex)
Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock.
std::unique_ptr< CCoinsViewCache > pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
CBlockIndex * GetChainTip()
Return a reliable pointer (in mapBlockIndex) to the chain's tip index.
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).