Skip to content

Instantly share code, notes, and snippets.

@brossi
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brossi/3b80af2ddc186d3f4d87 to your computer and use it in GitHub Desktop.
Save brossi/3b80af2ddc186d3f4d87 to your computer and use it in GitHub Desktop.
Nu RPC Commands (API v0.3.0)

Nu RPC Commands

 API version 0.3.0

Nu Network Ports

PROTOCOL PORT 7890
// Base RPC port used by the NuShares RPC server. 
// Other unit RPC servers listen on RPC_PORT+1, RPC_PORT+2, etc.
RPC PORT 14001 
RPC PORT 14002     // NuBits

// Same rules apply to testnet, but on different ports
TESTNET PORT 7895
TESTNET RPC PORT 15001     // NuShares
TESTNET RPC PORT 15002     // NuBits

// Peercoin ports used when communicating with the Peercoin wallet for dividend distributions
PEERCOIN RPC PORT 9902
PEERCOIN TESTNET RPC PORT 9904

Methods

addmultisigaddress

addmultisigaddress <nrequired> <'["key","key"]'> [account]

Add a nrequired-to-sign multisignature address to the wallet each key is a peercoin address or hex-encoded public key If [account] is specified, assign address to [account].

backupwallet

backupwallet <destination>

Safely copies wallet.dat to destination, which can be a directory or a path with filename.

checkwallet

checkwallet

Check portfolio for integrity.

distribute

distribute <cutoff timestamp> <amount> [<proceed>]

Cutoff is date and time at which the share balances should be considered. Format is unix time. amount is the the number of peercoins to distribute, in double-precision floating point number. If proceed is not true the peercoins are not sent and the details of the distribution are returned.

dumpprivkey

dumpprivkey <ppcoinaddress>

Reveals the private key corresponding to .

exportpeercoinkeys

exportpeercoinkeys

Add the Peercoin keys associated with the NuShares addresses to the Peercoin wallet. Peercoin must be running and accept RPC commands. The Peercoin wallet must also be unlocked (completely, not just for minting) to be able to accept the incoming address keys.

getaccount

getaccount <address>

Returns the account associated with the given address.

getaccountaddress

getaccountaddress <account>

Returns the current Nu address for receiving payments to this account.

getaddressesbyaccount

getaddressesbyaccount <account>

Returns the list of addresses for the given account.

getbalance

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

getblock <hash> [txinfo]

txinfo optional to print more detailed tx info Returns details of a block with given block-hash.

getblockcount

getblockcount

Returns the number of blocks in the longest block chain.

getblockhash

getblockhash <index>

Returns hash of block in best-block-chain at .

getblocktemplate

getblocktemplate [params]

Returns data needed to construct a block to work on: "version" : block version "previousblockhash" : hash of current highest block "transactions" : contents of non-coinbase transactions that should be included in the next block "coinbaseaux" : data that should be included in coinbase "coinbasevalue" : maximum allowable input to coinbase transaction, including the generation award and transaction fees "target" : hash target "mintime" : minimum timestamp appropriate for next block "curtime" : current timestamp "mutable" : list of ways the block template may be changed "noncerange" : range of valid nonces "sigoplimit" : limit of sigops in blocks "sizelimit" : limit of block size "bits" : compressed target of next block "height" : height of the next block See https://en.bitcoin.it/wiki/BIP_0022 for full specification.

getcheckpoint

getcheckpoint

Show info of synchronized checkpoint.

getconnectioncount

getconnectioncount

Returns the number of connections to other nodes.

getdifficulty

getdifficulty

Returns difficulty as a multiple of the minimum difficulty.

getgenerate

getgenerate

Returns true or false. DEPRECATED

gethashespersec

gethashespersec

Returns a recent hashes per second performance measurement while generating. DEPRECATED

getinfo

getinfo

Returns an object containing various state info.

getliquidityinfo

getliquidityinfo <currency>

Currency is the single letter of the currency (currently only 'B' for NuBits)

getmininginfo

getmininginfo

Returns an object containing mining-related information. DEPRECATED

getmotions

getmotions [<block height>] [<block quantity>]

Returns an object containing the motion vote results.

getnetworkghps

getnetworkghps

Returns a recent Ghash/second network mining estimate. DEPRECATED

getnewaddress

getnewaddress [account]

Returns a new Nu address for receiving payments. If [account] is specified (recommended), it is added to the address book so payments received with the address will be credited to [account].

getparkrates

getparkrates [<currency>]

Returns an object containing the park rates. The default is the currency of the RPC server's wallet.

getpeercoinaddresses

getpeercoinaddresses <account>

Returns the list of addresses and the associated Peercoin address for the given account.

getpeerinfo

getpeerinfo

Returns data about each connected network node.

getreceivedbyaccount

getreceivedbyaccount <account> [minconf=1]

Returns the total amount received by addresses with in transactions with at least [minconf] confirmations.

getreceivedbyaddress

getreceivedbyaddress <address> [minconf=1]

Returns the total amount received by

in transactions with at least [minconf] confirmations.

gettransaction

gettransaction <txid>

Get detailed information about

getvote

getvote

Returns the vote that will be inserted in the next proof of stake block.

getwork

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 (DEPRECATED) "data" : block data "hash1" : formatted hash buffer for second hash (DEPRECATED) "target" : little endian hash target If [data] is specified, tries to solve the block and returns true if it was successful.

help

help [command]

List commands, or get help for a command.

importprivkey

importprivkey <nuprivkey> [label]

Adds a private key (as returned by dumpprivkey) to your wallet.

keypoolrefill

keypoolrefill

Fills the keypool, requires portfolio passphrase to be set.

liquidityinfo

liquidityinfo <currency> <buyamount> <sellamount> <grantaddress>

Broadcast liquidity information. currency is the single letter of the currency (currently only 'B') grantaddress is the custodian address that was granted. The private key of this address must be in the wallet.

listaccounts

listaccounts [minconf=1]

Returns Object that has account names as keys, account balances as values.

listparked

listparked [account]

Returns the list of parked coins.

listreceivedbyaccount

listreceivedbyaccount [minconf=1] [includeempty=false]

[minconf]is the minimum number of confirmations before payments are included. [includeempty] whether to include accounts that haven't received any payments. 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

listreceivedbyaddress [minconf=1] [includeempty=false]

[minconf] is the minimum number of confirmations before payments are included. [includeempty] whether to include addresses that haven't received any payments. 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

listsinceblock

listsinceblock [blockhash] [target-confirmations]

Get all transactions in blocks since block [blockhash], or all transactions if omitted

listtransactions

listtransactions [account] [count=10] [from=0]

Returns up to [count] most recent transactions skipping the first [from] transactions for account [account].

makekeypair

makekeypair [prefix]

Make a public/private key pair. [prefix] is optional preferred prefix for the public key.

move

move <fromaccount> <toaccount> <amount> [minconf=1] [comment]

Move from one account in your portfolio to another.

park

park <amount> <duration> [account=""] [unparkaddress] [minconf=1]

is a real and is rounded to the nearest 0.000001 is the number of blocks during which the amount will be parked is the address to which the amount will be returned when they are unparked (default is the main address of the account) requires wallet passphrase to be set with walletpassphrase first

repairwallet

repairwallet

Repair portfolio if checkwallet reports any problem.

reservebalance

reservebalance [<reserve> [amount]]

is true or false to turn balance reserve on or off. is a real and rounded to cent. Set reserve amount not participating in network protection. If no parameters provided current setting is printed.

sendalert

sendalert <message> <privatekey> <minver> <maxver> <priority> <id> [cancelupto]

is the alert text message is hex string of alert master private key is the minimum applicable internal client version is the maximum applicable internal client version is integer priority number is the alert id [cancelupto] cancels all alert id's up to this number Returns true or false.

sendfrom

sendfrom <fromaccount> <toaddress> <amount> [minconf=1] [comment] [comment-to]

is a real and is rounded to the nearest 0.000001 requires portfolio passphrase to be set with walletpassphrase first

sendmany

sendmany <fromaccount> {address:amount,...} [minconf=1] [comment]

amounts are double-precision floating point numbers requires portfolio passphrase to be set with walletpassphrase first

sendtoaddress

sendtoaddress <address> <amount> [comment] [comment-to]

is a real and is rounded to the nearest 0.000001 requires portfolio passphrase to be set with walletpassphrase first

setaccount

setaccount <address> <account>

Sets the account associated with the given address.

setgenerate

setgenerate <generate> [genproclimit]

is true or false to turn generation on or off. Generation is limited to [genproclimit] processors, -1 is unlimited. DEPRECATED

setmotionvote

setmotionvote <motion hash>

is the hash of the motion to vote for.

setvote

setvote <vote>

is the complete vote in JSON. Example:

{
  "custodians":[
  {"address":"bPwdoprYd3SRHqUCG5vCcEY68g8UfGC1d9","amount":100.00000000},
  {"address":"bxmgMJVaniUDbtiMVC7g5RuSy46LTVCLBT","amount":5.50000000
  }],
  "parkrates":[
  {"unit":"B",
    "rates":[
    {"blocks":8192,"rate":0.00030000},
    {"blocks":16384,"rate":0.00060000},
    {"blocks":32768,"rate":0.00130000}
    ]}
  ],
  "motionhash":"8151325dcdbae9e0ff95f9f9658432dbedfdb209"
}



signmessage

signmessage <address> <message>

Sign a message with the private key of an address

stop

stop

Stop Nu server.

submitblock

submitblock <hex data> [optional-params-obj]

[optional-params-obj] parameter is currently ignored. Attempts to submit new block to network. See https://en.bitcoin.it/wiki/BIP_0022 for full specification.

unpark

unpark

unpark all transaction that have reached duration

validateaddress

validateaddress <address>

Return information about the specified address address.

verifymessage

verifymessage <address> <signature> <message>

Verify a signed message

walletlock

walletlock

Removes the portfolio encryption key from memory, locking the portfolio. After calling this method, you will need to call walletpassphrase again before being able to call any methods which require the portfolio to be unlocked.

walletpassphrase

walletpassphrase <passphrase> <timeout> [mintonly]

Stores the portfolio decryption key in memory for seconds. mintonly is optional true/false allowing only block minting.

walletpassphrasechange

walletpassphrasechange <oldpassphrase> <newpassphrase>

Changes the portfolio passphrase from to .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment