Skip to content

IPChain RPC API

summerxue1992 edited this page Sep 21, 2018 · 8 revisions

Information query and tools

DecodeRawTransaction

Decodes the serialized transaction hexadecimal string into a JSON object.

Return value: the json format of the transaction.

Demo: ./ipchain-cli decoderawtransaction 0100000001236d526f912ada9ee952265bec406a3bcddd482cfa2a86926fe9c65149d5572600000000fc0047304402204dac94acb35ee80681f6c37524ffc19b5572caf17ea18726b8233e37141fa2f50220271c4c9a58b2c4b7efea770d85421b7cbb36809755203bf670a7d0abac054d5901473044022021b3b3f067c07c492335ecfc373b48433f5ea72c865e67ef66616504abeea2470220244f583f33db060f44697228875c3086ca7464903fba300f637425d36adc1409014c69522102c5e5562c3ad429f4c29a802e89caa0df6c5916a60180ff8918f0250d036374bc2103ffffd432c4526a635598366dd056719443b8a3b19c4c090dbab4f4db7698dcca210316f564435a9a76daeaf645619e7423be8beb8ab3838457aa98efb3d2d71efeac53aeffffffff01e0f08c06000000001976a9140d074bc86bd388a45f1c8911a41b8f0705d9058b88ac00000000

DecodeScript

Decodes a hexadecimal encoded P2SH exchange script.

Return value: a script with multiple signatures.

DumpPrivKey

Displays the private key of the specified address in the specified local wallet.

Return value: the private key corresponding to the address of the wallet. The interface with similar functionality is also decodeinfobyaddress.

DecodeInfoByAddress

Obtain the corresponding public key hash and private key according to the address of this wallet.

Return value: the public key hash corresponding to the wallet address, the information of the private key.

GetAccountAddress

Gets the current address of the wallet specified Account (Account).

Return value: returns an address, the current account's address, and if the account is not used, a new one is created and returned.

GetAddressesByAccount

Gets the address list of the wallet's specified Account (Account).

Return value: returns the list of addresses on the specified account. Returns an empty list if the specified account is not available.

GetAccount

Get the account name according to the wallet address.

Return value: returns the account name corresponding to the address.

GetBalance

Get the IPC balance of the current account.

Return value: returns the value of the available balance of the current wallet (8 blocks confirmed). Unit: ipc.

GetBestBlockHash

Gets the Block header HASH of the current best chain.

Return value: returns blockhash of the current highest ## block.

GetBlock

Gets a block with a specific header hash from the local block database, which can be used as a JSON object or a serializer block.

Return value: when verbose is false, return the hexstring of block. The verbose default parameter is true, returning the JSON information for the block that specifies blockhash.

GetBlockCount

The Height of the Block on the local optimal chain.

Return value: the height of the latest block of the current chain.

GetBlockHash

Returns the head hash of a given height in the local best block chain.

Return value: returns the bulk hash of the specified height block of the current chain. Usually used with getblock.

GetConnectionCount

Gets the number of connections to the current node.

Return value: the number of connections to the current node.

GetInfo

Output current node and network information.

Return value: returns information about the current node. As follows:

GetNewAddress

Create a new receive address.

Return value: returns the newly created address.

GetRawTransaction

Obtain an HEX encoded serialized transaction data or specify the transaction details of the data.

Return value: verbose defaults to false and returns a hexstring. Verbose is true and returns the transaction data information in JSON format, including the hexstring.

GetReceivedByAddress

Returns the total amount of the address received in the transaction with the specified number of acknowledgements.

Return value: returns the total amount received by the address of the wallet address in a transaction that is confirmed by the ncount. Unit: ipc.

GetUnconfirmedBalance

Obtain the unrecognized balance in the local wallet.

Return value: returns the balance of the current wallet that was not validated (not 8 confirmed). Unit: ipc.

listunspentNormal

Returns an array of unspent and available common ipc COINS belonging to the wallet.

Return value: UTXO will return the ipc currency type after the default of 8 blocks.

listunspentIPC

Returns an output array of the unspent and available knowledge output belonging to the wallet.

Return value: UTXO will return with a default of 8 blocks confirmed.

listunspentToken

Returns an output array of unspent and available tokens belonging to the wallet.

Return value: UTXO will return by default of 8 blocks confirmed.

listtokencoins

Returns the available balance of the specified token.

Return value: returns the available balance information for the token that specifies the tokensymbol type.

Create a trading

DecodeRawTransaction

Decodes the serialized transaction hexadecimal string into a JSON object.

Return value: the json format of the transaction.

CreateMultiSig

Generate a multiple signature address.

cli-cmd Example: ./ipchain-cli createmultisig [nrequired] [keys]

Parameters:

nrequired: specifies the number of addresses used for multiple signatures;

Keys: the address keys specified. The number can't be greater than 16.

Return value: returns the generated multiple signature address and the corresponding signature script.

CreateRawTransaction

Create a serialized transaction that can be sent to the network for confirmation.

cli-cmd Example: ./ipchain-cli createrawtransaction [inputs] [outputs] [txtype]

parameters:

Inputs: the combination of inputs in the proposed transaction;

Output: the combination of the output in the proposed transaction, note that the ordinary currency change in the output cannot be written into the combination, which will be automatically filled up;

Txtype: when the token is registered, it should be noted that this one is 4 and the other transaction type is omitted.

Return value: a successful return of the hexstring that builds a successful transaction. Failure returns the cause of failure.

SignRawTransaction

Use the private key provided in the wallet to sign the serialized transaction.

cli-cmd Example: ./ipchain-cli signrawtransaction [hexstring]

Parameters:

hexstring: createrawtransaction hexstring returns.

Return value: successfully returns the sign's hexstring. Failure returns the cause of failure.

FundRawTransaction

Add Input to the transaction until the value of the transaction output is satisfied. Note that the input is not signed and must have a corresponding front-end output in the local wallet. 

Send a deal

SendFrom

A transaction is issued from the local wallet Account (Account).。

cli-cmd Example: ./ipchain-cli sendfrom [fromaccount] [toaddress] [amount] [minconf] [comment] [comment_to]

parameters:

Fromaccount: sent from the address of the selected account;

toaddress: address of recipient;

amount: amount;

Minconf: minimum confirmation number (temporarily unused, can be ignored, default 8);

comment: notes on the transaction;

comment_to:the wallet stores the comment for the receiver.

Return value: success returns txid. Failure returns information about the cause of failure.

SendMany

Create transactions that send output to multiple addresses and broadcast to the network.

cli-cmd Example: ./ipchain-cli sendmany [fromaccount] [amounts]

parameters:

fromaccount:The designated account of the sender;

amounts:Send to the specified address and the corresponding numeric value. Unit of ipc.

Return value: txid

SendTokenMany

Create transactions that send the token output to multiple addresses and broadcast to the network.

cli-cmd Example: ./ipchain-cli sendtokenmany [fromaccount] [symbol] [amounts]

parameters:

fromaccount:The designated account of the sender;

symbol: The type of token sent ;

amounts:Send to the specified address and the corresponding numeric value.

Return value: txid。

SendRawTransaction

Verify transactions and send them to P2P networks.

cli-cmd Example: ./ipchain-cli sendrawtransaction hexstring[ The results of the signrawtransaction]

Return value: success returns the txid of the transaction, and failure returns the cause of the transaction validation failure.

SendToAddress

Issue a transaction to the specified address.

cli-cmd Example: ./ipchain-cli sendtoaddress [address] [amount] [comment] [comment_to] [subtractfeefromamount]

parameters:

address:The designated recipient address;

amount:The number of ipc sent, unit ipc;

comment:Notes of this transaction are stored in the wallet only;

comment_to:Notes to the receiving party;

subtractfeefromamount:The default is false, and the sender pays the poundage, true for the receiving party.

The last three parameters can be ignored.

Return value: success returns the txid of the transaction, and failure returns the cause of the transaction validation failure.

NormalSendToAddress

Issuing a transaction toa specified address is equivalent to sendtoaddress.

cli-cmd Example: ./ipchain-cli NormalSendToAddress [address] [amount] comment] [comment_to] [subtractfeefromamount]

IPCRegisterToAddress

Register a known product at the specified address.

cli-cmd Example: ./ipchain-cli IPCRegisterToAddress [address] [ipcLabel]

parameters:

address:Registered address;

ipcLabel:Knowledge of the field data information for registration.

Note: the known hash cannot be re-registered, and the registered one will be rejected by the network.

Return value: success returns txid, and failure returns the cause of failure.

IPCSendToAddress

Transfer the knowledge to the specified address.

cli-cmd Example: ./ipchain-cli IPCSendToAddress [txid] [index] [address]

parameters: txid index:Specifies the knowledge to be transferred;

address:Know the address to be transferred to.

Return value: success returns txid, and failure returns the cause of failure.

IPCAuthorToAddress

Delegate the knowledge to the specified address.

cli-cmd Example: ./ipchain-cli IPCAuthorToAddress [txid] [index] [address] [ipcLabel] parameters: txid index: Specifies the knowledge production to initiate the authorization transaction;

address: Acceptance of the IP address.;

ipcLabel: The related field data information for the knowledge production of the authorization type.

Note: the time period of the authorization start time to the end time is within the effective time period of the known production of the authorization.

Return value: success returns txid, and failure returns the cause of failure.

IPCTokenRegToAddress

Register a token with the specified address.。

cli-cmd Example: ./ipchain-cli IPCTokenRegToAddress [address] [tokenLabel]

parameters:

address:Know the registered address.;

tokenLabel:Field data information for token registration.

Note: the tokensymbol field and the label field cannot contain the IPC\RMB\USD\EUR, and are not case sensitive.

TotalCount is the actual currency multiplied by 10 to the 'precision bit'. The total number of tokens issued in the example is 100,000. The total amount should not exceed 10000000000(10 billion).

Return value: success returns txid, and failure returns the cause of failure.

IPCTokenSendToAddress

Send tokens to the specified address.

cli-cmd Example: ./ipchain-cli IPCTokenSendToAddress [tokensymbol] [address] [nvalue]

parameters:

tokensymbol:The type of token to be sent;

address:Send address;

nvalue:Number of deliveries.

Note: the number of tokens to be sent should be filled according to the accuracy of such tokens. If the precision is 2, you cannot send 0.001.

Return value: success returns txid, and failure returns the cause of failure.

Import data

IportAddress

Add the wallet address or public key script to the wallet without the associated private key, allowing you to monitor transactions that affect the address or pubkey script without having to spend any of its output.

ImportMulti

Import multiple addresses or scripts (using the private key, public key or P2SH exchange script), and optionally perform a minimal re-scan of all imports.

ImportPrivKey

Import the private key.

cli-cmd Example: ./ipchain-cli importprivkey [privkey] [label] [rescan]

parameters:

privkey: The corresponding private key for the address to be imported;

label:Put this imported private key and its corresponding address under the specified account. If not specified, the default is "" account;

rescan:By default, true loads the transaction associated with this address, or false does not load.

Return value: successfully returns null, and error information is returned when failure.

ImportWallet

Import the wallet file with the private key information.

cli-cmd Example: ./ipchain-cli importwallet [filename]

parameters:

filename:The file that dumpwallet gets.

Return value: successfully returns null, failure returns the cause of failure

AddMultiSigAddress

Add multiple signature addresses to your wallet.

P2P Network

AddNode

Adds or removes the node of the connection.

cli-cmd Example: ./ipchain-cli addnode 192.168.60.116 add/remove

Return value:

addnode IP add is a connection that adds a node, and success returns "add success! Failure returns the cause of failure;

Addnode IP remove is a link to remove a node, and success returns "remove success!" Failure returns the cause of failure.

DisconnectNode

Disconnect from the specified node.

cli-cmd Example: ./ipchain-cli disconnectnode 192.168.60.116:25166

parameters:Specifies the IP and corresponding port number to disconnect from.

Return value: successfully returns null, failure returns the cause of failure.

GetPeerInfo

Gets the information of the connected network node (peer).

cli-cmd Example: ./ipchain-cli getpeerinfo

Return value: information about the network node that the node is connected to.

GetAddedNodeInfo

Gets the information that is connected to the node using the addnode command.

cli-cmd Example: ./ipchain-cli getaddednodeinfo

Return value: the connection information of the node added by addnode. The format is as follows:

The Wallet Safe

WalletLock

Lock a wallet.

cli-cmd Example: ./ipchain-cli walletlock

Note: this interface is for an encrypted wallet, and an unencrypted wallet can be used to perform this command.

Return value: success returns null, failure returns the cause of failure.

EncryptWallet

Set the lock password for your wallet.

cli-cmd Example: ./ipchain-cli encrywallet [psword]

Return value: success returns null, failure returns the cause of failure.

WalletPassphrase

Decrypt the wallet with a locking pin.

cli-cmd Example: ./ipchain-cli walletpassphrase [psword] [timeout]

Note: timeout is in seconds.

Return value: successful return null, failed to return the cause.

WalletPassphraseChange

Change the wallet lock password.

cli-cmd Example: ./ipchain-cli walletpassphrasechange [oldpsword] [newpsword]

parameters:

oldpsword: old password;

newpsword: new password.

Return value: successful return null, failed to return the cause.

GetWalletInfo

Get information about your local wallet.

cli-cmd Example: ./ipchain-cli getwalletinfo

Return value: wallet information.

BackupWallet

Back up your wallet.

cli-cmd Example: ./ipchain-cl backupwallet [path]

parameters:

path: target directory or file.

Return value: successful return null, failed to return the cause. Success will generate a backup file, wallet. dat, in the destination directory or folder.

DumpWallet

Create or override files that have a readability format containing all wallet keys.

cli-cmd Example: ./ipchain-cli dumpwallet filename

parameters:

filename: specifies the name of the generated file.

Return value: successful return null, failed to return the cause. Success produces the specified destination file filename under the specified path. #Wallet blacklist

ListBanned

List all the IP addresses that are blacklisted.

cli-cmd Example: ./ipchain-cli listbanned

Return value: the list of IP addresses that return the current node's blacklist.

ClearBanned

Banlist that clears the local node (records the list of IP addresses that are blacklisted).

cli-cmd Example: ./ipchain-cli clearbanned

Return value: clear blacklist list. 

Return value: clear blacklist list. 

Message signatures

SignMessage

Sign the message with the private key of the address.

cli-cmd Example: ./ipchain-cli signmessage [address] [message]

parameters:

address:The private key corresponding to the address is signed;

message: Sign the information.

Return value: the string after the signature is returned.

SignMessageWithPrivKey

Use the specified private key to sign the message.

cli-cmd Example: ./ipchain-cli signmessagewithprivkey [privkey] [message]

parameters:

privkey:Specify the private key to sign;

message: Sign the information.

Return value: the string after the signature is returned.

VerifyMessage

Verify a signed message. The interface to verify the signature corresponding to the signmessage.

cli-cmd Example: ./ipchain-cli verifymessage [address] [signedmessage] [message]

parameters:

address:The signature address used when signing;

signedmessage:The string that is obtained with the signmessage signature;

message:Information that is signed when it is signed.

Return value: verify that by returning true; Failure returns false.