Cloakcoin API

From CloakCoin Wiki
Revision as of 01:15, 3 December 2018 by Shibob (talk | contribs)
Jump to: navigation, search

CloakCoin cung cấp giao diện gọi thủ tục từ xa (RPC) cho nhiều tác vụ quản trị khác nhau, hoạt động ví và truy vấn về dữ liệu blockchain và mạng.

Nếu bạn khởi tạo CloakCoin bằng cloakcoind, giao diện RPC được thiết lập theo mặc định.

Bạn có thể kiểm soát cloakcoind bằng lệnh JSON-RPC.

Chương trình được cài đặt từ cloakcoin.conf trong thư mục ứng dụng CloakCoin:

$HOME/.bitcoin/

Giao diện yêu cầu người dùng cung cấp mật khẩu để xác thực các yêu cầu RPC.

Mật khẩu này có thể được thiết lập trong cloakcoin.conf, tạo tệp cấu hình cloakcoin.conf và cài đặt rpcuser và rpcpassword để bảo mật API JSON-RPC.

Ví dụ cloakcoin.conf:

rpcuser=bitcoind

rpcpassword=change_this_to_a_long_random_password

Theo mặc định, dịch vụ được kết nối với cổng 29662, bạn có thể thay đổi nó trong cloakcoin.conf bằng:

rpcport=new_port_here

Để khởi động:

$./cloakcoind -daemon

Nếu bạn biết API, bạn nên sử dụng mạng thử nghiệm.

cloakcoind -testnet

CloakCoin - Lệnh RPC


help [command]

Danh sách lệnh, hoặc trợ giúp lệnh.


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
Không Hạn chế Bản quyền