Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
misc.cpp
Go to the documentation of this file.
191 "1. \"command\" (string, required) 'show' to show all current spork values, 'active' to show which sporks are active\n"
195 " \"SPORK_NAME\" : spork_value, (number) The value of the specific spork with the name SPORK_NAME\n"
200 " \"SPORK_NAME\" : true|false, (boolean) 'true' for time-based sporks if spork is active and 'false' otherwise\n"
213 throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
224 "\nUpdate the value of the specific spork. Requires \"-sporkkey\" to be set to sign the message.\n"
248 " \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n"
254 " \"script\" : \"type\" (string, optional) The output script type. Possible types: nonstandard, pubkey, pubkeyhash, scripthash, multisig, nulldata\n"
261 " \"sigsrequired\" : xxxxx (numeric, optional) Number of signatures required to spend multisig output\n"
264 " \"account\" : \"account\" (string) DEPRECATED. The account associated with the address, \"\" is the default account\n"
265 " \"timestamp\" : timestamp, (number, optional) The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT)\n"
266 " \"hdkeypath\" : \"keypath\" (string, optional) The HD keypath if the key is HD and available\n"
346 "to the wallet before upgrading to v0.17. To use the deprecated functionality, start dashd with -deprecatedrpc=createmultisig\n"
348 "1. nrequired (numeric, required) The number of required signatures out of the n keys or addresses.\n"
358 " \"redeemScript\":\"script\" (string) The string value of the hex-encoded redemption script.\n"
363 + HelpExampleCli("createmultisig", "2 \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"") +
365 + HelpExampleRpc("createmultisig", "2, \"[\\\"03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd\\\",\\\"03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626\\\"]\"")
376 if (IsHex(keys[i].get_str()) && (keys[i].get_str().length() == 66 || keys[i].get_str().length() == 130)) {
385 throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Invalid public key: %s\nNote that from v0.16, createmultisig no longer accepts addresses."
386 " Clients must transition to using addmultisigaddress to create multisig addresses with addresses known to the wallet before upgrading to v0.17."
387 " To use the deprecated functionality, start dashd with -deprecatedrpc=createmultisig", keys[i].get_str()));
410 "2. \"signature\" (string, required) The signature provided by the signer in base 64 encoding (see signmessage).\n"
420 + HelpExampleCli("verifymessage", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" \"signature\" \"my message\"") +
422 + HelpExampleRpc("verifymessage", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\", \"signature\", \"my message\"")
473 + HelpExampleCli("verifymessage", "\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwG\" \"signature\" \"my message\"") +
553 bool getAddressesFromParams(const UniValue& params, std::vector<std::pair<uint160, int> > &addresses)
624 + HelpExampleCli("getaddressmempool", "'{\"addresses\": [\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"]}'")
625 + HelpExampleRpc("getaddressmempool", "{\"addresses\": [\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"]}")
644 for (std::vector<std::pair<CMempoolAddressDeltaKey, CMempoolAddressDelta> >::iterator it = indexes.begin();
694 + HelpExampleCli("getaddressutxos", "'{\"addresses\": [\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"]}'")
695 + HelpExampleRpc("getaddressutxos", "{\"addresses\": [\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"]}")
706 for (std::vector<std::pair<uint160, int> >::iterator it = addresses.begin(); it != addresses.end(); it++) {
716 for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) {
763 + HelpExampleCli("getaddressdeltas", "'{\"addresses\": [\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"]}'")
764 + HelpExampleRpc("getaddressdeltas", "{\"addresses\": [\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"]}")
778 throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "End value is expected to be greater than start");
790 for (std::vector<std::pair<uint160, int> >::iterator it = addresses.begin(); it != addresses.end(); it++) {
804 for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) {
843 + HelpExampleCli("getaddressbalance", "'{\"addresses\": [\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"]}'")
844 + HelpExampleRpc("getaddressbalance", "{\"addresses\": [\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"]}")
855 for (std::vector<std::pair<uint160, int> >::iterator it = addresses.begin(); it != addresses.end(); it++) {
864 for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) {
901 + HelpExampleCli("getaddresstxids", "'{\"addresses\": [\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"]}'")
902 + HelpExampleRpc("getaddresstxids", "{\"addresses\": [\"XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg\"]}")
924 for (std::vector<std::pair<uint160, int> >::iterator it = addresses.begin(); it != addresses.end(); it++) {
939 for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++) {
953 for (std::set<std::pair<int, std::string> >::const_iterator it=txids.begin(); it!=txids.end(); it++) {
980 + HelpExampleCli("getspentinfo", "'{\"txid\": \"0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9\", \"index\": 0}'")
981 + HelpExampleRpc("getspentinfo", "{\"txid\": \"0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9\", \"index\": 0}")
1051 "1. \"mode\" (string, optional, default: \"stats\") Determines what kind of information is returned.\n"
1053 " - \"mallocinfo\" returns an XML string describing low-level heap state (only available if compiled with glibc 2.10+).\n"
1060 " \"locked\": xxxxxx, (numeric) Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk.\n"
1081 throw JSONRPCError(RPC_INVALID_PARAMETER, "mallocinfo is only available when compiled with glibc 2.10+");
1111 "When called without an argument, returns the list of categories with status that are currently being debug logged or not.\n"
1112 "When called with arguments, adds or removes categories from debug logging and return the lists above.\n"
1122 "1. \"include\" (array of strings, optional) A json array of categories to add debug logging\n"
1127 "2. \"exclude\" (array of strings, optional) A json array of categories to remove debug logging\n"
1162 throw JSONRPCError(RPC_INVALID_PARAMETER, "libevent logging cannot be updated when using libevent before v2.1.1.");
1182 "\nThe difference between echo and echojson is that echojson has argument conversion enabled in the client-side table in"
1195 "- getnetworkinfo: version, protocolversion, timeoffset, connections, proxy, relayfee, warnings\n"
1196 "- getwalletinfo: balance, privatesend_balance, keypoololdest, keypoolsize, paytxfee, unlocked_until, walletversion\n"
1226 { "hidden", "echo", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
1227 { "hidden", "echojson", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
void SwitchToNextAsset(CConnman &connman)
Definition: masternode-sync.cpp:53
CTxMemPool mempool
CScript CreateMultisigRedeemscript(const int required, const std::vector< CPubKey > &pubkeys)
Definition: util.cpp:48
CPubKey AddrToPubKey(CKeyStore *const keystore, const std::string &addr_in)
Definition: util.cpp:27
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:80
std::string ListActiveLogCategoriesString()
Returns a string with the list of active log categories.
Definition: util.cpp:352
bool UpdateSpork(SporkId nSporkID, int64_t nValue, CConnman &connman)
UpdateSpork is used by the spork RPC command to set a new spork value, sign and broadcast the spork m...
Definition: spork.cpp:185
bool getAddressIndex(std::vector< std::pair< uint160, int > > &addresses, std::vector< std::pair< CMempoolAddressDeltaKey, CMempoolAddressDelta > > &results)
Definition: txmempool.cpp:525
std::vector< unsigned char > DecodeBase64(const char *p, bool *pfInvalid)
Definition: utilstrencodings.cpp:177
Definition: walletdb.h:59
bool GetAddressUnspent(uint160 addressHash, int type, std::vector< std::pair< CAddressUnspentKey, CAddressUnspentValue > > &unspentOutputs)
Definition: validation.cpp:934
static LockedPoolManager & Instance()
Return the current instance, or create it once.
Definition: lockedpool.h:213
std::map< CTxDestination, CAddressBookData > mapAddressBook
Definition: wallet.h:906
Definition: util.h:107
bool EnsureWalletIsAvailable(CWallet *const pwallet, bool avoidException)
Definition: rpcwallet.cpp:66
bool GetCScript(const CScriptID &hash, CScript &redeemScriptOut) const override
Definition: keystore.cpp:90
SporkId GetSporkIDByName(const std::string &strName)
GetSporkIDByName returns the internal Spork ID given the spork name.
Definition: spork.cpp:235
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
Definition: standard.cpp:281
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
Definition: utilstrencodings.h:100
Definition: univalue.h:20
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
Definition: server.cpp:583
Definition: univalue.h:22
Definition: standard.h:67
bool appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
Definition: server.cpp:353
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
Definition: pubkey.h:149
Definition: util.h:127
void RPCTypeCheck(const UniValue ¶ms, const std::list< UniValue::VType > &typesExpected, bool fAllowNull)
Type-check arguments; throws JSONRPCError if wrong type given.
Definition: server.cpp:54
Definition: ismine.h:19
std::map< CScriptID, CKeyMetadata > m_script_metadata
Definition: wallet.h:856
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded Values (throws error if not hex).
Definition: server.cpp:121
const UniValue & find_value(const UniValue &obj, const std::string &name)
Definition: univalue.cpp:236
bool SignCompact(const uint256 &hash, std::vector< unsigned char > &vchSig) const
Create a compact signature (65 bytes), which allows reconstructing the used public key...
Definition: key.cpp:221
bool ExtractDestinations(const CScript &scriptPubKey, txnouttype &typeRet, std::vector< CTxDestination > &addressRet, int &nRequiredRet)
Parse a standard scriptPubKey with one or more destination addresses.
Definition: standard.cpp:188
Definition: univalue.h:22
Definition: spork.h:32
bool GetLogCategory(uint64_t *f, const std::string *str)
Return true if str parses as a log category and set the flags in f.
Definition: util.cpp:291
std::atomic< uint64_t > logCategories
bool RecoverCompact(const uint256 &hash, const std::vector< unsigned char > &vchSig)
Recover a public key from a compact signature.
Definition: pubkey.cpp:186
static UniValue getinfo_deprecated(const JSONRPCRequest &request)
Definition: misc.cpp:1189
virtual bool GetHDChain(CHDChain &hdChainRet) const override
Definition: crypter.cpp:539
Definition: standard.h:63
const char * GetTxnOutputType(txnouttype t)
Get the name of a txnouttype as a C string, or nullptr if unknown.
Definition: standard.cpp:21
Definition: util.h:109
int64_t GetSporkValue(SporkId nSporkID)
GetSporkValue returns the spork value given a Spork ID.
Definition: spork.cpp:217
bool pushKV(const std::string &key, const UniValue &val)
Definition: univalue.cpp:135
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
Definition: standard.cpp:256
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
Definition: server.cpp:578
bool GetSpentIndex(CSpentIndexKey &key, CSpentIndexValue &value)
Definition: validation.cpp:908
static std::pair< std::string, UniValue > Pair(const char *cKey, const char *cVal)
Definition: univalue.h:185
bool IsDeprecatedRPCEnabled(const std::string &method)
Definition: server.cpp:447
Definition: spentindex.h:42
UniValue signmessagewithprivkey(const JSONRPCRequest &request)
Definition: misc.cpp:458
bool heightSort(std::pair< CAddressUnspentKey, CAddressUnspentValue > a, std::pair< CAddressUnspentKey, CAddressUnspentValue > b)
Definition: misc.cpp:587
Definition: hdchain.h:28
std::string EncodeDestination(const CTxDestination &dest)
Definition: base58.cpp:329
Definition: ismine.h:25
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:947
void RegisterMiscRPCCommands(CRPCTable &t)
Register miscellaneous RPC commands.
Definition: misc.cpp:1231
Definition: ismine.h:24
Definition: protocol.h:40
Definition: server.h:37
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:715
CWallet * GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
Definition: rpcwallet.cpp:45
Definition: spentindex.h:14
bool GetAddressIndex(uint160 addressHash, int type, std::vector< std::pair< CAddressIndexKey, CAmount > > &addressIndex, int start, int end)
Definition: validation.cpp:922
A reference to a CScript: the Hash160 of its serialization (see script.h)
Definition: standard.h:22
bool getAddressFromIndex(const int &type, const uint160 &hash, std::string &address)
Definition: misc.cpp:527
bool IsSporkActive(SporkId nSporkID)
IsSporkActive returns a bool for time-based sporks, and should be used to determine whether the spork...
Definition: spork.cpp:211
bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
GetPubKey implementation that also checks the mapHdPubKeys.
Definition: wallet.cpp:286
bool getAddressesFromParams(const UniValue ¶ms, std::vector< std::pair< uint160, int > > &addresses)
Definition: misc.cpp:553
isminetype IsMine(const CKeyStore &keystore, const CTxDestination &dest)
Definition: ismine.cpp:28
std::vector< CLogCategoryActive > ListActiveLogCategories()
Returns a vector of the active log categories.
Definition: util.cpp:337
bool getIndexKey(const std::string &str, uint160 &hashBytes, int &type)
Definition: misc.cpp:539
bool timestampSort(std::pair< CMempoolAddressDeltaKey, CMempoolAddressDelta > a, std::pair< CMempoolAddressDeltaKey, CMempoolAddressDelta > b)
Definition: misc.cpp:592
Definition: serialize.h:162
std::string EncodeBase64(const unsigned char *pch, size_t len)
Definition: utilstrencodings.cpp:126
bool UpdateHTTPServerLogging(bool enable)
Change logging level for libevent.
Definition: httpserver.cpp:413
void Reset(bool fForce=false, bool fNotifyReset=true)
Definition: masternode-sync.cpp:19
Definition: server.h:128