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

  • list help
    • Displays help on various available list commands
  • execute help
    • Displays help on various available execute commands

Project / Network Information

  • list 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 'list projects' contains some non-verified (information NOT researched and confirmed) BOINC projects.
  • list 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.
  • list 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

  • list cpids
    • Shows ALL the BOINC projects you have contributed to, even ones that are no longer valid
  • list 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
  • list explainmagnitude
    • This command breaks down how your CPID's magnitude is calculated.
  • list rsa
    • "list rsa" = "list mymagnitude"
  • list 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.
  • list rsaweight
    • retrieve "RSA Weight", "Remote Magnitude", "RSA Owed"
  • list magnitudecsv
    • Creates a magnitude report CSV in %appdata%\GridcoinResearch\Reports or ~/.GridcoinResearch/Reports/
  • execute 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.

Staking

  • reservebalance true AMOUNT
    • The wallet tries to allocate every coin that is over 4 hours old unless the coin was already staked in the last 7 days; but in general, it will usually allocated about 25% of your coins most of the time.
    • Unless you reserve the balance with this command. Then you can spend all of it.
    • 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.
  • execute reboot
    • Reboots the Gridcoin client.

Disable Windows Error Reporting

  • execute 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.
N
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

N
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"
N
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.

N
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
N
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

N
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

N
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. 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.
N
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

  • execute commands
    • Usage: execute <string::itemname> <string::parameter>
    • Found in code: https://github.com/gridcoin/Gridcoin-Research/blob/733c1078253e4e17d43c256cb15e730ea73c9b9a/src/rpcblockchain.cpp#L1411
    • list of Commands
      • restorepoint
      • reboot
      • neuralrequest
      • advertisebeacon
      • syncdpor2
      • gatherneuralhashes
      • beaconstatus
      • beaconreport
      • neuralreport
      • myneuralhash
      • superblockage
      • unusual - not finished
      • neuralhash
      • vote <title> <answer>
      • addpoll <title> <days> <question> <answer1;answer2;answer#> <ShareType>
        • Sharetype - 1=Magnitude,2=Balance,3=Both,4=CPIDCount,5=ParticipantCount
        • note that you must use underscores in place of spaces
      • votedetails <title>
      • listpolls
      • listpolldetails
      • listpollresults <title>
      • staketime
      • testnewcontract
      • rac <cpid>
      • encrypt <passphrase>
      • testboinckey
      • genboinckey
      • encryptphrase <phrase> - not working that I can tell
      • decryptphrase <phrase> - not working that I can tell
      • contract - not finished
      • wcgtest - a testing command
      • syncrac
      • dportally
      • superblockaverage
      • getlistof <keytype>
        • beacon
        • neuralsecurity
        • poll
        • project
        • vote
        • superblock
      • listdata <key>
      • chainrsa <cpid>- not working that I can tell
      • testcpidv2
      • testcpidv2
      • DISABLE_WINDOWS_ERROR_REPORTING
      • testcpid
      • reindex
      • downloadblocks
      • executecode
      • volatilecode
      • startwireframe
      • tally
      • testhash
      • resetcpids
      • backupwallet
      • restorewallet
      • resendwallettx
      • postcpid
      • encrypt_deprecated
      • findrac
  • list commands