Skip to content

API Calls List

Alex Ash edited this page May 28, 2019 · 3 revisions

PIVX API call list (as of version 3.0.6)

Table of Contents

Common operations

Listing my PIVX addresses

Listing the PIVX addresses in your wallet is easily done via listreceivedbyaddress. It normally lists only addresses which already have received transactions, however you can list all the addresses by setting the first argument to 0, and the second one to true.

Accounts are used to organize addresses.

Full list

Required arguments are denoted inside < and > Optional arguments are inside [and].

Command Parameters Description Requires unlocked wallet?
Blockchain
getbestblockhash   Returns the hash of the best (tip) block in the longest block chain. N
getblock <hash> [verbose] Returns information about the block with the given hash. N
getblockchaininfo   Returns an object containing various state info regarding block chain processing. N
getblockcount   Returns the number of blocks in the longest block chain. N
getblockhash <index> Returns hash of block in best-block-chain at index provided. N
getblockheader <hash> [verbose] If verbose is false, returns a string that is serialized, hex-encoded data for block 'hash' header. If verbose is true, returns an Object with information about block <hash> header. N
getchaintips   Return information about all known tips in the block tree, including the main chain as well as orphaned branches. N
getdifficulty   Returns the proof-of-work difficulty as a multiple of the minimum difficulty. N
getmempoolinfo   Returns details on the active state of the TX memory pool. N
getrawmempool [verbose] Returns all transaction ids in memory pool as a json array of string transaction ids. N
gettxout <txid> <n> [includemempool=true] Returns details about an unspent transaction output. N
gettxoutsetinfo   Returns statistics about the unspent transaction output set. N
invalidateblock <hash> Permanently marks a block as invalid, as if it violated a consensus rule. N
reconsiderblock <hash> Removes invalidity status of a block and its descendants, reconsider them for activation. This can be used to undo the effects of invalidateblock. N
verifychain [numblocks=288] Verifies blockchain database. N
Control
getinfo   Returns an object containing various state info. N
help [command] List all commands, or get help for a specified command. N
stop   Stop PIVX server. N
Generating
getgenerate   PoW Only Return if the server is set to generate coins or not. The default is false. It is set with the command line argument -gen (or pivx.conf setting gen) It can also be set with the setgenerate call. N
setgenerate <generate> [genproclimit] PoW Only Set 'generate' true or false to turn generation on or off. Generation is limited to 'genproclimit' processors, -1 is unlimited. See the getgenerate call for the current setting. N
Mining
getblocktemplate [jsonrequestobject] PoW Only Returns data needed to construct a block to work on. N
getmininginfo   PoW Only Returns a json object containing mining-related information. N
getnetworkhashps [blocks] [height] PoW Only Returns the estimated network hashes per second based on the last n blocks. N
prioritisetransaction <txid> <priority delta> <fee delta> Accepts the transaction into mined blocks at a higher (or lower) priority N
reservebalance [reserve] [amount] Show or set the reserve amount not participating in network protection. If no parameters provided current setting is printed. Y
submitblock <hexdata> [jsonparamatersobject] PoW Only Attempts to submit new block to network. N
Network
addnode <node> <add|remove|onetry> Attempts add or remove a node from the addnode list. Or try a connection to a node once. N
clearbanned   version 3.1.0 Clear all banned IPs. N
disconnectnode <node> version 3.1.0 Immediately disconnects from the specified node. N
getaddednodeinfo <dns> [node] Returns information about the given added node, or all added nodes. (note that onetry addnodes are not listed here) If dns is false, only a list of added nodes will be provided, otherwise connected information will also be available. N
getconnectioncount   Returns the number of connections to other nodes. N
getnettotals   Returns information about network traffic, including bytes in, bytes out, and current time. N
getnetworkinfo   Returns an object containing various state info regarding P2P networking. N
getpeerinfo   Returns data about each connected network node as a json array of objects. N
listbanned   version 3.1.0 List all banned IPs/Subnets. N
ping   Requests that a ping be sent to all other nodes, to measure ping time. N
setban <ip(/netmask)> <add|remove> [bantime] [absolute] version 3.1.0 Attempts add or remove a IP/Subnet from the banned list. N
PIVX
checkbudgets   Initiates a buddget check cycle manually. N
createmasternodekey   Create a new masternode private key. N
getbudgetinfo [proposal] Show current masternode budgets with optional filter by proposal name. N
getbudgetprojection   Show the projection of which proposals will be paid the next cycle. N
getbudgetvotes <proposal> Print vote information for a budget proposal. N
getmasternodecount   Get masternode count values. N
getmasternodeoutputs   Print all masternode transaction outputs. N
getmasternodescores [blocks=10] Print list of winning masternode by score. N
getmasternodestatus   Print masternode status. N
getmasternodewinners [blocks=10] [filter] Print the masternode winners for the last n blocks N
getnextsuperblock   Print the next super block height N
getpoolinfo   Depreciated in version 3.0.0 Returns anonymous pool-related information N
listmasternodeconf [filter] Print masternode.conf in JSON format. N
listmasternodes [filter] Get a ranked list of masternodes. Optional filter by txhash, status, or payment address. N
masternode <command> Depreciated in version 2.3.1 Set of commands to execute masternode related actions. Y/N
masternodeconnect <address> Attempts to connect to specified masternode address. N
masternodecurrent &nbsp Get current masternode winner. N
masternodedebug &nbsp Print masternode status. N
mnbudget <command> [passphrase] Depreciated in version 2.3.1 Vote or show current budgets. N
mnbudgetrawvote <masternode-tx-hash> <masternode-tx-index> <proposal-hash> <yes|no> <time> <vote-sig> Compile and relay a proposal vote with provided external signature instead of signing vote internally. N
mnbudgetvote <local|many|alias> <votehash> <yes|no> [alias] Vote on a budget proposal. N
mnfinalbudget <command> [passphrase] Vote or show current budgets. Y/N
mnsync <status|reset> Returns the sync status or resets sync. N
preparebudget <proposal-name> <url> <payment-count> <block-start> <pivx-address> <monthly-payment> Prepare proposal for network by signing and creating tx. Y
spork <show|active> Print raw value or active status of sporks. N
startmasternode <local|all|many|missing|disabled|alias> <lockwallet> [alias] Attempts to start one or more masternode(s). Y/N
submitbudget <proposal-name> <url> <payment-count> <block-start> <pivx-address> <monthly-payment> <fee-tx> Submit proposal to the network. N
Raw Transactions
createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...} Creates a raw transaction spending given inputs. N
decoderawtransaction <hex string> Produces a human-readable JSON object for a raw transaction. N
decodescript <hex> Decode a hex-encoded script. N
getrawtransaction <txid> [verbose=0] Returns raw transaction representation for given transaction id. N
sendrawtransaction <hexstring> [allowhighfees=false] [swiftx=false] Submits raw transaction (serialized, hex-encoded) to local node and network. N
signrawtransaction <hexstring&rt; [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [<privatekey1>,...] [sighashtype=ALL] Adds signatures to a raw transaction and returns the resulting raw transaction. Y/N
Utility
createmultisig <nrequired> <'["key",...]'> Creates a multi-signature address with n signature of m keys required. N
estimatefee <nblocks> Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within nblocks blocks. N
estimatepriority <nblocks> Estimates the approximate priority a zero-fee transaction needs to begin confirmation within nblocks blocks. N
validateaddress <pivxaddress> Return information about the given pivx address. N
verifymessage <pivxaddress> <signature> <message> Verify a signed message. N
Wallet
addmultisigaddress <nrequired> <'["key",...]'> [account] Add a nrequired-to-sign multisignature address to the wallet. Each key is a PIVX address or hex-encoded public key. If 'account' is specified, assign address to that account. Y/N
autocombinerewards <true|false> [threshold] Wallet will automatically monitor for any coins with value below the threshold amount, and combine them if they reside with the same PIVX address. Y
backupwallet <destination> Safely copies wallet.dat to destination, which can be a directory or a path with filename. N
bip38decrypt <pivxaddress> <passphrase> Decrypts and then imports password protected private key. Y
bip38encrypt <pivxaddress> <passphrase> Encrypts a private key corresponding to 'pivxaddress'. Y
dumpprivkey <pivxaddress> Reveals the private key corresponding to 'pivxaddress'. Y
dumpwallet <filename> Dumps all wallet keys in a human-readable format. Y
encryptwallet <passphrase> Encrypts the wallet with <passphrase>. N
getaccount <pivxaddress> Returns the account associated with the given address. N
getaccountaddress <account> Returns the current bitcoin address for receiving payments to this account. If <account> does not exist, it will be created along with an associated new address that will be returned. N
getaddressesbyaccount <account> Returns the list of addresses for the given account. N
getbalance [account] [minconf=1] [includeWatchonly=false] If [account] is not specified, returns the server's total available balance.
If [account] is specified, returns the balance in the account.
N
getnewaddress [account] Returns a new PIVX address for receiving payments. If [account] is specified payments received with the address will be credited to [account]. Y
getrawchangeaddress   Returns a new PIVX address, for receiving change. This is for use with raw transactions, NOT normal use. N
getreceivedbyaccount [account] [minconf=1] Returns the total amount received by addresses with [account] in transactions with at least [minconf] confirmations. If [account] not provided return will include all transactions to all accounts. N
getreceivedbyaddress <pivxaddress> [minconf=1] Returns the amount received by <pivxaddress> in transactions with at least [minconf] confirmations. It correctly handles the case where someone has sent to the address in multiple transactions. Keep in mind that addresses are only ever used for receiving transactions. Works only for addresses in the local wallet, external addresses will always show 0. N
getstakesplitthreshold &nbsp Returns the threshold for stake splitting. N
getstakingstatus &nbsp Returns an object containing various staking information. N
gettransaction <txid> [includeWatchonly] Get detailed information about in-wallet transaction <txid>. N
getunconfirmedbalance   Returns the server's total unconfirmed balance . N
getwalletinfo   Returns an object containing various wallet state info. N
importaddress <address> [label] [rescan=true] Adds an address or script (in hex) that can be watched as if it were in your wallet but cannot be used to spend. Y
importprivkey <pivxprivkey> [label] [rescan=true] Adds a private key (as returned by dumpprivkey) to your wallet. Y
importwallet <filename> Imports keys from a wallet dump file (see dumpwallet). Y
keypoolrefill <newsize> Fills the keypool. Y
listaccounts [minconf] [includeWatchonly=false] Returns Object that has account names as keys, account balances as values. N
listaddressgroupings   Returns all addresses in the wallet and info used for coincontrol. N
listlockunspent   Returns list of temporarily unspendable outputs. N
listreceivedbyaccount [minconf=1] [includeempty=false] [includeWatchonly=false] List balances by account. N
listreceivedbyaddress [minconf=1] [includeempty=false] [includeWatchonly=false] List balances by receiving address. N
listsinceblock [blockhash] [target-confirmations] [includeWatchonly=false] Get all transactions in blocks since block [blockhash], or all transactions if omitted. N
listtransactions [account] [count=10] [from=0] [includeWatchonly=false] Returns up to [count] most recent transactions skipping the first [from] transactions for account [account]. If [account] not provided it'll return recent transactions from all accounts. N
listunspent [minconf=1] [maxconf=9999999] ['["addresses",...]'] Returns array of unspent transaction outputs with between minconf and maxconf (inclusive) confirmations. Optionally filter to only include txouts paid to specified addresses. N
lockunspent <unlock> <'[{"txid":"txid","vout":n},...]'> Updates list of temporarily unspendable outputs. Y
move <fromaccount> <toaccount> <amount> [minconf=1] [comment] Move from one account in your wallet to another N
sendfrom <fromaccount> <topivxaddress> <amount> [minconf=1] [comment] [comment-to] <amount> is a real and is rounded to 8 decimal places. Will send the given amount to the given address, ensuring the account has a valid balance using [minconf] confirmations. Returns the transaction ID if successful (not in JSON object). Y
sendmany <fromaccount> {address:amount,...} [minconf=1] [comment] Send multiple times. Amounts are double-precision floating point numbers Y
sendtoaddress <pivxaddress> <amount> [comment] [comment-to] Send an amount to a given address. <amount> is a real and is rounded to 8 decimal places. Returns the transaction ID <txid> if successful. Y
sendtoaddressix <pivxaddress> <amount> [comment] [comment-to] Send an amount to a given address using SwiftX. <amount> is a real and is rounded to 8 decimal places. Returns the transaction ID <txid> if successful. Y
setaccount <pivxaddress> <account> Sets the account associated with the given address. Assigning address that is already assigned to the same account will create a new address associated with that account. N
setstakesplitthreshold <value> This will set the output size of your stakes to never be below the given value. Y
settxfee <amount> Set the transaction fee per kB. N
signmessage <pivxaddress> <message> Sign a message with the private key of an address. Y
walletlock   Removes the wallet encryption key from memory, locking the wallet. Y
walletpassphrase <passphrase> <timeout> [anonymizeonly=false] Stores the wallet decryption key in memory for 'timeout' seconds. N
walletpassphrasechange <oldpassphrase> <newpassphrase> Changes the wallet passphrase from 'oldpassphrase' to 'newpassphrase'. N
Zerocoin
exportzerocoins <include_spent> [denomination] Exports zerocoin mints that are held by this wallet.dat Y
getarchivedzerocoin   Display zerocoins that were archived because they were believed to be orphans. Y
getspentzerocoinamount <hexstring> <index> Returns value of spent zerocoin output designated by transaction hash and input index. N
getzerocoinbalance   Returns the balance of all unspent zerocoins in this wallet. Y
importzerocoins <importdata> Import zerocoin mints. Adds raw zerocoin mints to the wallet.dat. Note it is recommended to use the json export created from the exportzerocoins RPC call Y
listmintedzerocoins   Return an array of zerocoin mints. Y
listspentzerocoins   Return an array of spent zerocoins. Y
listzerocoinamounts   List the denomination amounts held in this wallet. Y
mintzerocoin <amount> Mint given amount from PIV to zPIV. Y
reconsiderzerocoins   Check archived zPiv list to see if any mints were added to the blockchain.. Y
resetmintzerocoin [extended_search] Scan the blockchain for all of the zerocoins that are held in the wallet.dat. Update any meta-data that is incorrect. Y
resetspentzerocoin   Scan the blockchain for all of the zerocoins that are held in the wallet.dat. Reset mints that are considered spent that did not make it into the blockchain. Y
spendzerocoin <amount> <mintchange> <minimizechange> <seclevel> <address> Spend zPIV to given address with optional reminting of change. Y

Error Codes

See rpcprotocol.h for the list of error codes and their meanings.

See Also

References