Difference between revisions of "Cloakcoin API"

From CloakCoin Wiki
Jump to: navigation, search
Line 26: Line 26:
  
 
<code>
 
<code>
rpcpassword=change_this_to_a_long_random_password
+
rpcpassword=<translate>change_this_to_a_long_random_password</translate>
 
</code>
 
</code>
  

Revision as of 15:32, 2 December 2018

CloakCoin provides a remote procedure call (RPC) interface for various administrative tasks, wallet operations, and queries about network and block chain data.

If you start CloakCoin using cloakcoind, the RPC interface is enabled by default.

You can control cloakcoind by JSON-RPC commands.

The program gets is settings from cloakcoin.conf in the CloakCoin application directory:

$HOME/.bitcoin/

The interface requires the user to provide a password for authenticating RPC requests.

This password can be set in cloakcoin.conf, create the cloakcoin.conf configuration file and set an rpcuser and rpcpassword to secure the JSON-RPC API.

cloakcoin.conf example:

rpcuser=bitcoind

rpcpassword=change_this_to_a_long_random_password

By default the service is bound to port 29662 you can change it in cloakcoin.conf with the:

rpcport=new_port_here

To start run:

$./cloakcoind -daemon

If you are learning the API, it is a very good idea to use the test network.

cloakcoind -testnet

CloakCoin - RPC Commands


help [command]

List commands, or get help for a command.


stop <detach>

<detach> is [true] to detach the database, [false] to stop only Stop CloakCoin server (and possibly override the detachdb config value).


getblockcount

Returns the number of blocks in the longest block chain.


getconnectioncount

Returns the number of connections to other nodes.


getpeerinfo

Returns data about each connected network node.


getdifficulty

Returns the difficulty as a multiple of the minimum difficulty.


getgenerate

Returns true or false to indicate if currently mining.


setgenerate <generate> [genproclimit]

<generate> is true or false to turn mining on or off.

Generation is limited to [genproclimit] processors, -1 for unlimited.


gethashespersec

Returns a recent hashes per second performance measurement while generating.


getinfo

Returns an object containing various state info.


getmininginfo

Returns an object containing mining-related information.


getnewaddress [account]

Returns a new CloakCoin 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].


getnewpubkey [account]

Returns new public key for coinbase generation.


getaccountaddress <account>

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


setaccount <CloakCoinaddress> <account>

Sets the account associated with the given address.


getaccount <CloakCoinaddress>

Returns the account associated with the given address.


getaddressesbyaccount <account>

Returns the list of addresses for the given account.


sendtoaddress <CloakCoinaddress> <amount> [comment] [comment-to] [narration]

<amount> is a real and is rounded to the nearest 0.000001

coins can be anonymized via Enigma by appending :posa to the destination address, which will cloak the address you sent them from.

requires wallet passphrase to be set with walletpassphrase first


sendcloakedtoaddress <CloakCoinaddress> <amount> [numCloakers] [timeoutMins] [comment] [comment-to]

<amount> is a real and is rounded to the nearest 0.000001

requires wallet passphrase to be set with walletpassphrase first.


getreceivedbyaddress <CloakCoinaddress> [minconf=1]

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


getreceivedbyaccount <account> [minconf=1]

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


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


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


backupwallet <destination>

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


keypoolrefill

Fills the keypool.

requires wallet passphrase to be set with walletpassphrase first


walletpassphrase <passphrase> <timeout> [mintonly]

Stores the wallet decryption key in memory for <timeout> seconds.

mintonly is optional true/false allowing only block minting.


walletpassphrasechange <oldpassphrase> <newpassphrase>

Changes the wallet passphrase from <oldpassphrase> to <newpassphrase>.


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.


validateaddress <CloakCoinaddress>

Return information about <CloakCoinaddress>.


validatepubkey <CloakCoinpubkey>

Return information about <CloakCoinpubkey>.


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.


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

Move from one account in your wallet to another.


sendfrom <fromaccount>[:posa] <toCloakCoinaddress> <amount> [minconf=1] [comment] [comment-to] [narration]

<amount> is a real and is rounded to the nearest 0.000001

coins can be anonymized via Enigma by appending :posa to the account name, which will cloak the address you sent them from.

requires wallet passphrase to be set with walletpassphrase first


C0.png
Free of Copyright Restrictions.