RPC commands

From Gridcoin
Jump to: navigation, search

Enter RPC commands in the console visible at menu help - debug window - console. In windows debug console you can type commands from below to get textual answers. Assuming you are running the daemon, typing gridcoinresearchd COMMAND may do the trick.

Help Commands

  • help wallet
    • Returns help for blockchain related commands.
  • help mining
    • Returns help for neural network/cpid/beacon related commands.
  • help developer
    • Returns help for developer commands.
  • help network
    • Returns help for network related commands.

Project / Network Information

  • projects
    • This command will list all the BOINC projects that are available and valid for Gridcoin Magnitude and PoR (White-Listed Projects).
    • Consult http://boinc.berkeley.edu/projects.php if the output from 'projects' contains some non-verified (information NOT researched and confirmed) BOINC projects.
  • network
    • Gets the current BOINC projects list and network magnitude (sums of every valid CPIDs magnitude)
    • With this command you can see if network averages are increasing/decreasing for a single project. E.g.: if Avg RAC is increasing for a project, it will drop your mag over time as competition heats up for that particular project.
  • magnitude
    • List magnitude (and more) for every CPID the network knows.
    • Here is the list of info shown for every cpid:
      • CPID
      • Magnitude
      • Payment Magnitude
      • Payment Timespan (Days)
      • Magnitude Accuracy
      • Long Term Owed (14 day projection)
      • Long Term Daily Owed (1 day projection)
      • Payments
      • InterestPayments
      • Last Payment Time
      • Current Daily Projection
      • Next Expected Payment
      • Avg Daily Payments

CPID Related

  • cpids
    • Shows ALL the BOINC projects you have contributed to, even ones that are no longer valid
  • validcpids
    • Shows ONLY your BOINC projects that are valid, in order to filter down the report to valid cpid projects with Verified RAC > 100 and Verified Team = Gridcoin
  • explainmagnitude
    • This command breaks down how your CPID's magnitude is calculated.
  • rsa
    • "rsa" = "mymagnitude"
  • mymagnitude
    • The list rsa / list mymagnitude commands looks at the last 1440 blocks in the chain and reports the total payments for your CPID. So that is where "Payments:" come from and THAT is why it changes.
    • Long Term Owed: The projected amount of your magnitude * mag multipler * 14.
      • This changes as time goes on as your mag gets to be higher accuracy with us (we used weighted square of time to determine your mag). The numbers in the RSA are consensus numbers for your CPID, with more weight placed on the most recent verified mag by the node.
      • long_term_owed = payment_timespan * Cap(research_magnitude*GetMagnitudeMultiplier(locktime), GetMaximumBoincSubsidy(locktime));
    • Payment Magnitude Entry: This is only useful if you have a Magnitude > Maxblocksubsidy*.90 (IE 1800 today). This shows your adjusted lederstrumpf magnitude used in payment calculations.
    • Accuracy: That should be the amount of blocks in the chain for this CPID.
    • Last Payment Time: The last time the CPID was paid PoR in a block.
    • Long Term Owed (14 days) is what you would earn if all things remain the same, i.e. magnitude, etc. It's a guesstimate, as nothing remains totally constant.
    • Next Expected Payment is usually half of your total owed up to the daily maximum of 400GRC, in order to break up payments across blocks.
  • rsaweight
    • retrieve "RSA Weight", "Remote Magnitude", "RSA Owed"
  • magnitudecsv
    • Creates a magnitude report CSV in %appdata%\GridcoinResearch\Reports or ~/.GridcoinResearch/Reports/
  • resetcpids
    • Gridcoin will reload CPIDs from the local BOINC client. If any new projects are detected, they will then be looked up in the Netsoft XML. This happens automatically after about 25 minutes, but this can speed up the process.


  • reservebalance true AMOUNT
    • By default your client will try to stake with all available coins that have matured for 16 hours in your wallet.
    • This command allows you to reserve a set amount of coins that do not stake and are therefore always available for spending.
    • Example: reservebalance true 455

Network/Peer Information

  • getinfo
    • Information about the current wallet version, balance and network state.
  • getpeerinfo
    • Lists connected peers and their block heights.

Block/Transaction Information

  • getblockhash <blockID>
    • Returns a hash to identify the specific block. This can be used to determine whether you are on the same fork as someone else.
  • getblockbynumber [blockID]
    • Returns information related to the specified block
  • getbalance
    • Displays the total balance of the loaded wallet.
  • getreceivedbyaddress
    • Displays the total number of coins received by a Gridcoin address.
  • listtransactions
    • Displays all transactions associated with the loaded wallet.
  • createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...}
    • Create a raw transaction using specified inputs
  • signrawtransaction <hex string> [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [<privatekey1>,...] [sighashtype="ALL"]
    • Sign a raw transaction

Wallet Related

  • checkwallet
    • Checks wallet for corruption.
  • repairwallet
    • Attempts to repair a corrupted wallet if corruption is detected.
  • walletpassphrase YOURPASSWORD TIMEOUT true
    • Unlock encrypted wallet for staking only

Halt / Reboot

  • stop
    • Terminate the Gridcoin client.
  • reboot
    • Reboots the Gridcoin client.

Disable Windows Error Reporting

    • Optional feature for windows users : Suppress Windows Error Reporting Dialog : to set this key execute this command from the rpc. This means that when an app crashes on the node, you will not receive the Windows Error Reporting Dialog - Would you like to check the internet for solutions or Debug this program? The program will just end.
    • Note: Crash dumps will still be created and stored in the standard location if you set this key.
    • This feature was requested August/September 2014 in testnet - its not really needed with a stable client, but may be useful when we go back to testnet.

gridcoinresearchd commands

Command Parameters Description Requires unlocked wallet?
addmultisigaddress <nrequired> <'["key","key"]'> [account] Add a nrequired-to-sign multisignature address to the wallet. Each key is a Gridcoin address or hex-encoded public key. If [account] is specified, assign address to [account]. Returns a string containing the address. N
addnode <node> <add/remove/onetry> Attempts add or remove <node> from the addnode list or try a connection to <node> once. N
backupwallet <destination> Safely copies wallet.dat to destination, which can be a directory or a path with filename. N
createmultisig <nrequired> <'["key,"key"]'> Creates a multi-signature address and returns a json object
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
dumpprivkey <Gridcoinaddress> Reveals the private key corresponding to <Gridcoinaddress> Y
encryptwallet <passphrase> Encrypts the wallet with <passphrase>. 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

getbalance [account] [minconf=1] If [account] is not specified, returns the server's total available balance.
If [account] is specified, returns the balance in the account.
getblock <hash> Returns information about the block with the given hash. 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> N
getconnectioncount Returns the number of connections to other nodes. N
getdifficulty Returns the proof-of-work difficulty as a multiple of the minimum difficulty. N
getinfo Returns an object containing various state info. N
getmininginfo Returns an object containing mining-related information:

blocks currentblocksize currentblocktx difficulty stakeweight stakeinterest testnet Mininginfo

getnewaddress [account] Returns a new Gridcoin address for receiving payments. If [account] is specified payments received with the address will be credited to [account]. N
getpeerinfo Returns data about each connected node. N
getrawchangeaddress [account] Returns a new Gridcoin address, for receiving change. This is for use with raw transactions, NOT normal use. N
getrawmempool Returns all transaction ids in memory pool N
getrawtransaction <txid> [verbose=0] Returns raw transaction representation for given transaction id. 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. (version 0.3.24) N
getreceivedbyaddress <Gridcoinaddress> [minconf=1] Returns the amount received by <Gridcoinaddress> 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
gettransaction <txid> Returns an object about the given transaction containing:
  • "amount" : total amount of the transaction
  • "confirmations" : number of confirmations of the transaction
  • "txid" : the transaction ID
  • "time" : time associated with the transaction<ref>From block timestamp, unless transaction was already in memory pool then the local time when the client added the transaction to its memory pool</ref>.
  • "details" - An array of objects containing:
    • "address"
    • "category"
    • "amount"
    • "fee"
gettxout <txid> <n> [includemempool=true] Returns details about an unspent transaction output (UTXO) N
gettxoutsetinfo Returns statistics about the unspent transaction output (UTXO) set N
getwork [data] If [data] is not specified, returns formatted hash data to work on:
  • "midstate" : precomputed hash state after hashing the first half of the data
  • "data" : block data
  • "hash1" : formatted hash buffer for second hash
  • "target" : little endian hash target

If [data] is specified, tries to solve the block and returns true if it was successful.

help [command] List commands, or get help for a command. N
importprivkey <Gridcoinprivkey> [label] [rescan=true] Adds a private key (as returned by dumpprivkey) to your wallet. This may take a while, as a rescan is done, looking for existing transactions. Optional [rescan] parameter added in 0.8.0. Note: There's no need to import public key, as in ECDSA (unlike RSA) this can be computed from private key. Y
listaddressgroupings Returns all addresses in the wallet and info used for coincontrol. N
listreceivedbyaccount [minconf=1] [includeempty=false] Returns an array of objects containing:
  • "account" : the account of the receiving addresses
  • "amount" : total amount received by addresses with this account
  • "confirmations" : number of confirmations of the most recent transaction included
listreceivedbyaddress [minconf=1] [includeempty=false] Returns an array of objects containing:
  • "address" : receiving address
  • "account" : the account of the receiving address
  • "amount" : total amount received by the address
  • "confirmations" : number of confirmations of the most recent transaction included

To get a list of accounts on the system, execute:

$ gridcoinresearchd listreceivedbyaddress 0 true

listsinceblock [blockhash] [target-confirmations] Get all transactions in blocks since block [blockhash], or all transactions if omitted. [target-confirmations] intentionally does not affect the list of returned transactions, but only affects the returned "lastblock" value.[1] N
listtransactions [account] [count=10] [from=0] 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.

Example, to show 100 transactions for the default account, skipping the last 20:

$ gridcoinresearchd listtransactions "" 100 20

listunspent [minconf=1] [maxconf=999999] Returns array of unspent transaction inputs in the wallet. N
listlockunspent Returns list of temporarily unspendable outputs
lockunspent <unlock?> [array-of-objects] Updates list of temporarily unspendable outputs
sendrawtransaction <hexstring> Submits raw transaction (serialized, hex-encoded) to local node and network. N
sendtoaddress <Gridcoinaddress> <amount> [comment] [comment-to] <amount> is a real and is rounded to 8 decimal places. Returns the transaction ID <txid> if successful. Comment fields are for sending wallet only and are not sent with the transaction. Y
setaccount <Gridcoinaddress> <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
setgenerate <generate> [genproclimit] <generate> is true or false to turn generation on or off.
Generation is limited to [genproclimit] processors, -1 is unlimited.
settxfee <amount> <amount> is a real and is rounded to the nearest 0.00000001 N
signmessage <Gridcoinaddress> <message> Sign a message with the private key of an address. Y
signrawtransaction <hexstring> [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [<privatekey1>,...] Adds signatures to a raw transaction and returns the resulting raw transaction. Y/N
stop Stop Gridcoin server. N
validateaddress <Gridcoinaddress> Return information about <Gridcoinaddress>. N
verifymessage <Gridcoinaddress> <signature> <message> Verify a signed message. N
walletlock Removes the wallet encryption key from memory, locking the wallet. After calling this method, you will need to call walletpassphrase again before being able to call any methods which require the wallet to be unlocked. N
walletpassphrase <passphrase> <timeout> Stores the wallet decryption key in memory for <timeout> seconds. N
walletpassphrasechange <oldpassphrase> <newpassphrase> Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>. N

Generic List of Commands

  • addmultisigaddress <nrequired> <'["key","key"]'> [account]
  • addpoll <title> <days> <question> <answer1;answer2...> <sharetype> <url>
    • Sharetype - 1=Magnitude,2=Balance,3=Both,4=CPIDCount,5=ParticipantCount
    • note that you must use underscores in place of spaces
  • addredeemscript <redeemScript> [account]
  • advertisebeacon
  • askforoutstandingblocks
  • backupprivatekeys
  • backupwallet
  • beaconreport
  • beaconstatus [cpid]
  • burn <amount> [hex string]
  • burn2 <burnaddress> <burnamount> <burnkey> <burndetail>
  • checkwallet
  • cpids
  • createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,"data":"hex",...}
  • currentcontractaverage # Note: This command is windows only.
  • currentneuralhash
  • currentneuralreport
  • currenttime
  • debug <bool>
  • debug10 <bool>
  • debug2 <bool>
  • debug3 <bool>
  • debug4 <bool>
  • debugnet <bool>
  • decoderawtransaction <hex string>
  • decodescript <hex string>
  • decryptphrase <phrase>
  • dportally
  • dumpprivkey <gridcoinaddress>
  • dumpwallet <filename>
  • encrypt <walletpassphrase>
  • encryptphrase <phrase>
  • encryptwallet <passphrase>
  • explainmagnitude [bool:force]
  • exportstats1 [maxblocks agregate [endblock]]
  • forcequorom
  • gatherneuralhashes
  • genboinckey
  • getaccount <gridcoinaddress>
  • getaccountaddress <account>
  • getaddednodeinfo <dns> [node]
  • getaddressesbyaccount <account>
  • getbalance ( "account" minconf includeWatchonly )
  • getbestblockhash
  • getblock <hash> [bool:txinfo]
  • getblockbynumber <number> [bool:txinfo]
  • getblockchaininfo
  • getblockcount
  • getblockhash <index>
  • getblockstats mode [startheight [endheight]]
  • getcheckpoint
  • getconnectioncount
  • getdifficulty
  • getinfo
  • getlistof <keytype>
    • beacon
    • neuralsecurity
    • poll
    • project
    • vote
    • superblock
  • getmininginfo
  • getnettotals
  • getnetworkinfo
  • getnewaddress [account]
  • getnewpubkey [account]
  • getnextproject
  • getpeerinfo
  • getrawmempool
  • getrawtransaction <txid> [verbose=bool]
  • getreceivedbyaccount <account> [minconf=1]
  • getreceivedbyaddress <Gridcoinaddress> [minconf=1]
  • getrecentblocks detail count
  • getsupervotes mode superblock
  • gettransaction "txid"
  • getwalletinfo
  • importprivkey <gridcoinprivkey> [label] [bool:rescan]
  • importwallet <filename>
  • keypoolrefill [new-size]
  • lifetime
  • listaccounts ( minconf includeWatchonly)
  • listaddressgroupings
  • listallpolldetails
  • listallpolls
  • listdata <keytype>
  • listpolldetails
  • listpollresults <pollname> [bool:showexpired]
  • listpolls
  • listreceivedbyaccount ( minconf includeempty includeWatchonly)
  • listreceivedbyaddress ( minconf includeempty includeWatchonly)
  • listsinceblock ( "blockhash" target-confirmations includeWatchonly)
  • listtransactions ( "account" count from includeWatchonly)
  • listunspent [minconf=1] [maxconf=9999999] ["address",...]
  • magnitude <cpid>
  • makekeypair [prefix]
  • memorizekeys
  • memorypool
  • move <fromaccount> <toaccount> <amount> [minconf=1] [comment]
  • mymagnitude
  • myneuralhash # Note: This command is windows only as of this date. It will probably be available on other platforms once the NeuralNetwork is ported.
  • network
  • networktime
  • neuralhash # Note: This command is windows only as of this date. It will probably be available on other platforms once the NeuralNetwork is ported.
  • neuralreport
  • neuralrequest
  • newburnaddress [burntemplate]
  • ping
  • projects
  • proveownership
  • rain [UniValue](UniValue::VARR)
  • readconfig
  • readdata <key>
  • refhash <walletaddress>
  • reorganize <hash>
  • repairwallet
  • resendtx
  • reservebalance [<reserve> [amount]]
  • resetcpids
  • rsa
  • rsaweight
  • sendalert <message> <privatekey> <minver> <maxver> <priority> <id> [cancelupto]
  • sendalert2 <privatekey> <id> <subverlist> <cancellist> <expire> <priority> <message>
  • sendblock <blockhash>
  • sendfrom <fromaccount> <toGridcoinaddress> <amount> [minconf=1] [comment] [comment-to]
  • sendmany <fromaccount> {address:amount,...} [minconf=1] [comment]
  • sendrawcontract <contract>
  • sendrawtransaction <hex string>
  • sendtoaddress <gridcoinaddress> <amount> [comment] [comment-to]
  • setaccount <gridcoinaddress> <account>
  • settxfee <amount>
  • showblock <index>
  • signmessage <Gridcoinaddress> <message>
  • signrawtransaction <hex string> [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [<privatekey1>,...] [sighashtype="ALL"]
  • staketime
  • stop
  • superblockage
  • superblockaverage
  • superblocks [cpid]
  • syncdpor2
  • tally
  • tallyneural
  • testnewcontract # Note: This command is windows only.
  • unspentreport
  • updatequoromdata
  • upgradedbeaconreport
  • validateaddress <gridcoinaddress>
  • validatepubkey <gridcoinpubkey>
  • validcpids
  • validcpidsaddkey <action> <keytype> <keyname> <keyvalue>
  • verifymessage <Gridcoinaddress> <signature> <message>advertisebeacon
  • versionreport
  • vote <title> <answer1;answer2...>
  • votedetails <pollname>
  • writedata <key> <value>addnode <node> <add|remove|onetry>