JSON-RPC is a stateless, light-weight remote procedure call (RPC) protocol. Primarily this specification defines several data structures and the rules around their processing. It is transport agnostic, meaning that the concepts can be used within the same process, over sockets, over HTTP, or in many various message passing environments. It uses JSON (RFC 4627) as data format.
--no-jsonrpcDo not run jsonrpc.
--jsonrpc-port <PORT>Listen for rpc connections on PORT. [default: 8080]
In the current version, it's only supported through HTTP.
A XXX-bit hexadecimal string. (e.g. H160: 160-bit hexadecimal string)
A hexadecimal string for XXX-bit unsigned integer
A two-letter string to denote a network. For example, "cc" is for the main network, and "wc" is for the Corgi test network. See the specification.
A printable encoding of a public key. The network id is at the end of the address. See the specification.
- author:
PlatformAddress - extraData:
any[] - hash:
H256 - number:
number - transactions:
Transaction[] - transactionsRoot:
H256 - parentHash:
H256 - seal:
string[] - stateRoot:
H256 - timestamp:
number
- blockHash:
H256 - blockNumber:
number - fee:
U64 - hash:
H256 - networkId:
NetworkID - seq:
number - transactionIndex:
number - sig:
Signature - action:
Action
- fee:
U64 - networkId:
NetworkID - seq:
number|null - action:
Action
- type: "pay"
- networkId:
NetworkID - receiver:
PlatformAddress - quantity:
U64
- type: "custom"
- networkId:
NetworkID - handlerId:
number - bytes:
string
When Transaction is included in any response, there will be an additional field hash in the data, which is the hash value of the given transaction. This decreases the time to calculate the transaction hash when it is needed from the response.
H512 for Ed25519 Signatures
- maxExtraDataSize:
U64 - networkID:
string - maxBodySize:
U64 - snapshotPeriod:
U64
| Code | Message | Description |
|---|---|---|
| -32002 | No Author |
No author is configured |
| -32004 | No Work Required |
No work is required |
| -32005 | No Work Found |
No work is found |
| -32009 | Invalid RLP |
Failed to decode the RLP string |
| -32011 | KVDB Error |
Failed to access the state (Internal error of CodeChain) |
| -32010 | Execution Failed |
Failed to execute the transactions |
| -32030 | Verification Failed |
The signature is invalid |
| -32031 | Already Imported |
The same transaction is already imported |
| -32032 | Not Enough Balance |
The signer's balance is insufficient |
| -32033 | Too Low Fee |
The fee is lower than the minimum required |
| -32034 | Too Cheap to Replace |
The fee is lower than the existing one in the queue |
| -32035 | Invalid Seq |
The signer's seq is invalid to import |
| -32036 | Invalid NetworkId |
The network id does not match |
| -32040 | Keystore Error |
Failed to access the key store (Internal error of CodeChain) |
| -32041 | Key Error |
The key is invalid |
| -32042 | Already Exists |
The account already exists |
| -32043 | Wrong Password |
The password does not match |
| -32044 | No Such Account |
There is no such account in the key store |
| -32045 | Not Unlocked |
The account is not unlocked |
| -32099 | Unknown Error |
An unknown error occurred |
| -32602 | Invalid Params |
At least one of the parameters is invalid |
- chain_getBestBlockNumber
- chain_getBestBlockId
- chain_getBlockHash
- chain_getBlockByNumber
- chain_getBlockByHash
- chain_getBlockTransactionCountByHash
- chain_getTransaction
- chain_containsTransaction
- chain_getSeq
- chain_getBalance
- chain_getMinTransactionFee
- chain_getCommonParams
- chain_getNetworkId
- chain_getPossibleAuthors
- mempool_sendSignedTransaction
- mempool_getErrorHint
- mempool_getPendingTransactions
- mempool_getPendingTransactionsCount
- mempool_getMachineMinimumFees
- net_localKeyFor
- net_registerRemoteKeyFor
- net_connect
- net_isConnected
- net_disconnect
- net_getPeerCount
- net_getEstablishedPeers
- net_getPort
- net_addToWhitelist
- net_removeFromWhitelist
- net_addToBlacklist
- net_removeFromBlacklist
- net_enableWhitelist
- net_disableWhitelist
- net_enableBlacklist
- net_disableBlacklist
- net_getWhitelist
- net_getBlacklist
- net_recentNetworkUsage
- account_getList
- account_create
- account_importRaw
- account_unlock
- account_sign
- account_sendTransaction
- account_changePassword
- devel_getStateTrieKeys
- devel_getStateTrieValue
- devel_snapshot
- devel_startSealing
- devel_stopSealing
- devel_getBlockSyncPeers
- devel_getPeerBestBlockHashes
- devel_getTargetBlockHashes
Sends ping to check whether CodeChain's RPC server is responding or not.
No parameters
string - "pong"
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "ping", "params": [], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":"pong",
"id":null
}
Gets the version of CodeChain.
No parameters
string - e.g. 0.1.0
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "version", "params": [], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":"0.1.0",
"id":null
}
Gets the commit hash of the repository upon which the CodeChain executable was built.
No parameters
string - the commit hash
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "commitHash", "params": [], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": "361a36fe20900f15e71148a615b25978652bfe90",
"id":null
}
Gets the number of the best block.
No parameters
number
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getBestBlockNumber", "params": [], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":1,
"id":null
}
Gets the number and the hash of the best block.
No parameters
{ hash: H256, number: number }
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getBestBlockId", "params": [], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":{
"hash":"0x7f7104b580f9418d444560009e5a92a4573d42d2c51cd0c6045afdc761826249",
"number":1
},
"id":null
}
Gets the hash of the block with given number.
- n -
number
null | H256
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getBlockHash", "params": [1], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":"0x56642f04d519ae3262c7ba6facf1c5b11450ebaeb7955337cfbc45420d573077",
"id":null
}
Gets the block with the given number.
- number:
number
null | Block
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getBlockByNumber", "params": [5], "id": null}' \
http://localhost:8080
{
"jsonrpc":"2.0",
"result":{
"author":"sccqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz6sxn0",
"extraData":[
],
"hash":"0x0e9cbbe0ecc774de3b5d05827ffb5c541bc7b7ff63de253d17272cf0fea1b7af",
"number":5,
"transactions":[
{
"action":{
"type":"pay",
"quantity":"0x3b9aca00",
"receiver":"sccqra5felweesff3epv9wfu05a47sxh89yuvzw7mqd"
},
"blockHash":"0x0e9cbbe0ecc774de3b5d05827ffb5c541bc7b7ff63de253d17272cf0fea1b7af",
"blockNumber":5,
"fee":"0x5f5e100",
"hash":"0x3ff9b02427ac04c06260928168775bca5a3da96ae6995041e197d42e71ab68b6",
"networkId":"sc",
"seq": 4,
"transactionIndex":0,
"sig":"0x4621da0344d8888c5076cc0a3cc7fd7a7e3a761ba812c95f807c050a4e5ec6b7120fa99fdf502ed088ed61eb6d5fe44f44c280e97c7702d5127640d7a8a6d7e401"
}
],
"transactionsRoot":"0xa4a8229a90d91e9a38b17f95c9ac2d01f46b10553e62c68df5bbfe1cc5b3e164",
"parentHash":"0xbc4f7e7b1dded863c500147243d78436ca297bfae64e1ec2d17396286cf14b6e",
"seal":[
],
"stateRoot":"0x4cdbde0340558aa7116975a170f004af3b6343f5bf0354dadd1815d22ed12da7",
"timestamp":1536924583
},
"id":null
}
Gets the block with the given hash.
- hash:
H256
null | Block
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getBlockByHash", "params": ["0xfc196ede542b03b55aee9f106004e7e3d7ea6a9600692e964b4735a260356b50"], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":{
"author":"cccqzzpxln6w5zrhmfju3zc53w6w4y6s95mf5lfasfn",
"extraData":[
],
"hash":"0xfc196ede542b03b55aee9f106004e7e3d7ea6a9600692e964b4735a260356b50",
"number":5,
"transactions":[
{
"action":{
"type":"pay",
"quantity":"0xa",
"receiver": "cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7"
},
"blockHash":"0xfc196ede542b03b55aee9f106004e7e3d7ea6a9600692e964b4735a260356b50",
"blockNumber":5,
"fee":"0xa",
"hash":"0xdb7c705d02e8961880783b4cb3dc051c41e551ade244bed5521901d8de190fc6",
"networkId":"cc",
"seq": 4,
"transactionIndex":0,
"sig":"0x291d932e55162407eb01915923d68cf78df4815a25fc6033488b644bda44b02251123feac3a3c56a399a2b32331599fd50b7a39ec2c1a2325e37f383c6aeedc301"
}
],
"transactionsRoot":"0x0270d11d2bd21a0ec8e78d1c4e918103d7c4b02fdf734051231cb9eea90ae88e",
"parentHash":"0xddf9fece0c6dee067a409e73a299bca21cec2d8300dff45739a5b76c680f378d",
"seal":[
],
"stateRoot":"0x898961f82629a47ade064f15d3902a455379cb082e62d3995f21050df3f553dc",
"timestamp":1531583888
}
"id":null
}
Gets the number of transactions within a block that corresponds with the given hash.
- hash:
H256
null | number
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getBlockTransactionCountByHash", "params": ["0xfc196ede542b03b55aee9f106004e7e3d7ea6a9600692e964b4735a260356b50"], "id": null}' \
localhost:8080
{"jsonrpc":"2.0","result":1,"id":null}
Gets a transaction with the given hash.
- transaction hash -
H256
null or Transaction
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getTransaction", "params": ["0xdb7c705d02e8961880783b4cb3dc051c41e551ade244bed5521901d8de190fc6"], "id": null}' \
localhost:8080
{
"jsonrpc": "2.0",
"result": {
"action": {
"type":"pay",
"quantity":"0xa",
"receiver": "cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7"
},
"blockHash": "0xfc196ede542b03b55aee9f106004e7e3d7ea6a9600692e964b4735a260356b50",
"blockNumber": 5,
"fee": "0xa",
"hash": "0xdb7c705d02e8961880783b4cb3dc051c41e551ade244bed5521901d8de190fc6",
"networkId": "cc",
"seq": 4,
"transactionIndex": 0,
"sig":"0x291d932e55162407eb01915923d68cf78df4815a25fc6033488b644bda44b02251123feac3a3c56a399a2b32331599fd50b7a39ec2c1a2325e37f383c6aeedc301"
}
"id": null,
}
Returns true if the transaction with the given hash is in the chain.
- transaction hash -
H256
boolean
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_containsTransaction", "params": ["0xad708d48755ac36685280a45ec213941e21c41644c781bf2f487fd6c7e4b2ebb"], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": true,
"id":null
}
Gets a seq of an account of the given address, at state of the given blockNumber.
- address:
PlatformAddress - block number:
number|null
null | number - It returns null when the given block number is invalid.
Errors: KVDB Error, Invalid Params, Invalid NetworkId
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getSeq", "params": ["cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7", null], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": 84,
"id":null
}
Gets a balance of an account of the given address, at the state of the given blockNumber.
- address:
PlatformAddress - block number:
number|null
null | U64 - It returns null when the given block number is invalid.
Errors: KVDB Error, Invalid Params, Invalid NetworkId
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getBalance", "params": ["cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7", null], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":"0xe8d4a50dd0",
"id":null
}
Gets the min cost of the transaction. It returns null if the first parameter is an invalid transaction type or the second parameter is larger than the current best block.
- transaction type -
string - block number -
number|null
number | null
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getMinTransactionFee", "params": ["pay", 3], "id": 7}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":100,
"id":7
}
Gets the common parameters. It returns null if the block number parameter is larger than the current best block.
- block number -
number|null
CommonParams | null
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getCommonParams", "params": [3], "id": 7}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":{
"maxExtraDataSize":"0x20",
"networkID":"tc",
"maxBodySize":4194304,
"snapshotPeriod":16384
},
"id":7
}
Return the nework id that is used in this chain.
No parameters
number
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getNetworkId", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": 17,
"id":6
}
Returns the list of accounts that can generate the blocks at the given block number.
It returns null if anyone can generate the block.
Only PoW and Solo chains can return null. Other chains never return null.
The possible authors of the genesis block are always in the list that contains only the author of the genesis block, regardless of the chain types.
- block number:
number|null
null | PlatformAddress[]
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "chain_getPossibleAuthors", "params": [null], "id": "who-can-be-authors"}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": ["tccq94guhkrfndnehnca06dlkxcfuq0gdlamvw9ga4f", "tccq8p9hr53lnxnhzcn0d065lux7etz22azaca786tt", "tccq8fj6lxn9tchqdqqe93yaga6fzxh5rndzu8k2gdw", "tccq9y6e0k6af9058qq4h4ffpt9xmat2vkeyue23j8y"],
"id": "who-can-be-authors"
}
Sends a signed transaction, returning its hash.
- bytes:
hexadecimal string- RLP encoded hex string of SignedTransaction
H256 - transaction hash
Errors: Invalid RLP, Verification Failed, Already Imported, Not Enough Balance, Too Low Fee, Too Cheap to Replace, Invalid Seq, Invalid Params, Invalid NetworkId
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "mempool_sendSignedTransaction", "params": ["0xf85e040a11d70294a6594b7196808d161b6fb137e781abbc251385d90ab841291d932e55162407eb01915923d68cf78df4815a25fc6033488b644bda44b02251123feac3a3c56a399a2b32331599fd50b7a39ec2c1a2325e37f383c6aeedc301"], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":"0xdb7c705d02e8961880783b4cb3dc051c41e551ade244bed5521901d8de190fc6",
"id":null
}
Gets a hint to find out why the transaction failed.
- transaction hash -
H256
null | string - null if there is no hint, string if the transaction failed.
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "mempool_getErrorHint", "params": ["0x31de93320082d6d5f0026fca4fe513cb76197dd2ad99cb0802040801148ec717"], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":"Text verification has failed: Invalid Signature",
"id":null
}
Deletes all pending transactions in both current and future queues.
No parameters.
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "mempool_deleteAllPendingTransactions", "params": [], "id": null}' \
localhost:8080
{"jsonrpc":"2.0","result":null,"id":null}
Gets transactions that have insertion_timestamps within the given range from the current transaction queue.
- from:
number | null- The lower bound of collected pending transactions. If null, there is no lower bound. - to:
number | null- The upper bound of collected pending transactions. If null, there is no upper bound. - future_included:
boolean- The parameter to include future transactions. If true, future transactions are included.
{ transactions: Transaction[], lastTimestamp: number }
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "mempool_getPendingTransactions", "params": [null, null,true], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":{
"lastTimestamp": null,
"transactions": [{
"blockHash":null,
"blockNumber":null,
"fee":"0xa",
"hash":"0x8ae3363ccdcc02d8d662d384deee34fb89d1202124e8065f0d6c84ab31e68d8a",
"networkId":"cc",
"seq":"0x0",
"transactionIndex":null,
"r":"0x22605d6b9fb713d3a415e02eeed8b4a630e0d867c91bf7d9b7721f94159c0fe1",
"s":"0x772f19f1c27f1db8b28289caa9e99ad756878fd56b2415c25cd47cc737f7e0c2",
"transactions":[
{
"pay":{
"seq": 1,
"receiver": "cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7",
"value":"0x0"
}
}
],
"v":0
}]
},
"id":null
}
Returns a count of the transactions that have insertion_timestamps within the given range from the transaction queues.
- from:
number | null- The lower bound of collected pending transactions. If null, there is no lower bound. - to:
number | null- The upper bound of collected pending transactions. If null, there is no upper bound. - future_included:
boolean- The parameter to count future transactions. If true, future transactions are also counted.
number
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "mempool_getPendingTransactionsCount", "params": [null, null,true], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":4,
"id":null
}
Gets custom action data for given custom action handler id and rlp encoded key.
- handlerId:
number - bytes:
string - blockNumber:
number|null
string
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "engine_getCustomActionData", "params": [1,"0xcd8c6d6574616461746120686974",null], "id": 411}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":"0c",
"id":411
}
Get a key to communicate with the given address
- address:
string - port:
number
The 256-bit public key.
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_localKeyFor", "params": ["192.168.0.3", 3485], "id": 5}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": "0x0b3f1e817ced530a586f029e66831f4d47b8fffa5eef0ba118f0e9dc1dd9b698",
"id":5
}
Register the remote public key to communicate with the given address
- address:
string - port:
number - remote_public_key:
string
The 256-bit local public key.
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_registerRemoteKeyFor", "params": ["192.168.0.3", 3485, "0x0b3f1e817ced530a586f029e66831f4d47b8fffa5eef0ba118f0e9dc1dd9b698"], "id": 5}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": "0x46f85ec82c7859c29b0e51a412a3842b1f360f8983a66038bc37b37872f144b1",
"id":5
}
Connect to the given address.
- address:
string - port:
number
null
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_connect", "params": ["192.168.0.3", 3485], "id": 5}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":null,
"id":5
}
Check whether the connection is established.
- address:
string - port:
number
bool
Errors: Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_isConnected", "params": ["192.168.0.3", 3485], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":true,
"id":6
}
Disconnect the connection from the given address.
- address:
string - port:
number
null
Errors: Not Conntected, Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_disconnect", "params": ["192.168.0.3", 3485], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":null,
"id":6
}
Return the count of peers which the client is connected to.
No parameters
number
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_getPeerCount", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": 34,
"id":6
}
Return the socket addresses of established peers.
No parameters
string[]
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_getEstablishedPeers", "params": [], "id": 3}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": ["1.2.3.4:3485", "1.2.3.5:3485"],
"id":3
}
Return the port number on which the client is listening for peers.
No parameters
number
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_getPort", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": 3485,
"id":6
}
Adds the CIDR block address to the whitelist.
- address:
string - tag:
null|string
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_addToWhitelist", "params": ["1.2.3.0/24", "tag"], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": null,
"id":6
}
Removes the CIDR block address from the whitelist.
- address:
string
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_removeFromWhitelist", "params": ["1.2.3.0/24"], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": null,
"id":6
}
Adds the CIDR block address to the blacklist.
- address:
string - tag:
null|string
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_addToBlacklist", "params": ["1.2.3.4", "tag"], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": null,
"id":6
}
Removes the CIDR block address from the blacklist.
- address:
string
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_removeFromBlacklist", "params": ["1.2.3.4"], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": null,
"id":6
}
Enables whitelist.
No parameters
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_enableWhitelist", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": null,
"id":6
}
Disables whitelist.
No parameters
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_disableWhitelist", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": null,
"id":6
}
Enables blacklist.
No parameters
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_enableBlacklist", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": null,
"id":6
}
Disables blacklist.
No parameters
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_disableBlacklist", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": null,
"id":6
}
Gets the CIDR block addresses in the whitelist.
No parameters
{ list: string[][], enabled: bool }
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_getWhitelist", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": { "list": [["1.2.3.0/24", "tag1"], ["1.2.3.5/32", "tag2"], ["1.2.3.6/32", "tag3"]], "enabled": true },
"id":6
}
Gets the CIDR block addresses in the blacklist.
No parameters
{ list: string[][], enabled: bool }
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_getBlacklist", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": { "list": [["1.2.3.0/22", "tag1"], ["1.2.3.5/32", "tag2"], ["1.2.3.6/32", "tag3"]], "enabled": false },
"id":6
}
Gets the recent network usage. The return type is an object. The key of the object is a string, but what the keys are depend on the implementation. The value of the object is the size of bytes that the node sent in the recent period. The exact timespan of the recent is also an implementation dependent.
No parameters
{ string: number }
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "net_recentNetworkUsage", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":{"::handshake":750,"::negotiation":2210,"block-propagation":13445,"discovery":1667,"tendermint":164},
"id":6
}
Gets a list of accounts.
No parameters
PlatformAddress[]
Errors: Keystore Error
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "account_getList", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":["cccqqccmmu8mrwq7lxzz72d4ukaxemzmv3tvues8uwy"],
"id":6
}
Creates a new account.
- password:
string|null
PlatformAddress
Errors: Keystore Error, Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "account_create", "params": [], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":"cccqqccmmu8mrwq7lxzz72d4ukaxemzmv3tvues8uwy",
"id":6
}
Imports a secret key and add the corresponding account.
- secret:
H512 - password:
string|null
PlatformAddress
Errors: Keystore Error, Key Error, Already Exists, Invalid Params
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "account_importRaw", "params": ["5c681224c650e9c96af5239991d38cc3ba2abba6b43926c35fc5c0439c7b9efa0b3f1e817ced530a586f029e66831f4d47b8fffa5eef0ba118f0e9dc1dd9b698"], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":"cccq99c90k2lmu3l5e6z5hajhvwsh57v60845sfdk74",
"id":6
}
Unlocks the specified account for use.
It will default to 300 seconds. Passing 0 unlocks the account indefinitely.
- account:
PlatformAddress - password:
string - duration:
number|null
null
Errors: Keystore Error, Wrong Password, No Such Account, Invalid Params, Invalid NetworkId
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "account_unlock", "params": ["cccqqccmmu8mrwq7lxzz72d4ukaxemzmv3tvues8uwy", "1234", 0], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": null,
"id":6
}
Calculates the account's signature for a given message.
- message:
H256 - account:
PlatformAddress - password:
string|null
Signature
Errors: Keystore Error, Wrong Password, No Such Account, Not Unlocked, Invalid Params, Invalid NetworkId
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "account_sign", "params": ["0000000000000000000000000000000000000000000000000000000000000000", "cccqqfz3sx7fr7uxqa5kl63qjdw9zrntru5kcdsjywj"], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":"0xff7e8928f7758a64b9ea6c53f9945cdd223740675ac6ac6da625306d3966f8197523e00d56844ddb70631d44f045f4d83cc183a267c3182ab04c2f459c8289f501",
"id":6
}
Sends a transaction by signing it with the account’s private key. It automatically fills the seq if the seq is not given.
- transction:
UnsignedTransaction - account:
PlatformAddress - passphrase:
string|null
{ hash: H256, seq: number } - the hash and seq of the transaction
Errors: Keystore Error, Wrong Password, No Such Account, Not Unlocked, Invalid Params, Invalid NetworkId
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "account_sendTransaction", "params": [{"action":{ "type":"pay", "quantity":"0x3b9aca00", "receiver":"sccqra5felweesff3epv9wfu05a47sxh89yuvzw7mqd" }, "fee":"0x5f5e100", "networkId":"sc", "seq": null}, "cccqqfz3sx7fr7uxqa5kl63qjdw9zrntru5kcdsjywj", null], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": {"seq": 999999999440, "hash":"0x8ae3363ccdcc02d8d662d384deee34fb89d1202124e8065f0d6c84ab31e68d8a"},
"id":6
}
Changes the account's password.
- account:
PlatformAddress - old_password:
String - new_password:
String
null
Errors: Keystore Error, Wrong Password, No Such Account, Invalid Params, Invalid NetworkId
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "account_changePassword", "params": ["cccqqccmmu8mrwq7lxzz72d4ukaxemzmv3tvues8uwy", "1234", "5678"], "id": 6}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":null,
"id":6
}
Gets keys of the state trie with the given offset and limit.
- offset:
number - limit:
number
H256[] with maximum length limit
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "devel_getStateTrieKeys", "params": [0, 1], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":[
"0x00acf5cba5c53e11f1512b8b480521cb546e7a17a96235a9282f6253b90de043"
],
"id":null
}
Gets the value of the state trie with the given key.
- key:
string
string[] - each string is RLP encoded
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "devel_getStateTrieValue", "params": ["0x00acf5cba5c53e11f1512b8b480521cb546e7a17a96235a9282f6253b90de043"], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":[
"0x20d560025f3a1c6675cb32384355ae05b224a3473ae17d3d15b6aa164af7d717",
"0xf84541a053000000000000002ab33f741ba153ff1ffdf1107845828637c864d5360e4932a00000000000000000000000000000000000000000000000000000000000000000c06f"
],
"id":null
}
Snapshot the state of the given block hash.
- key:
H256
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "devel_snapshot", "params": ["0xfc196ede542b03b55aee9f106004e7e3d7ea6a9600692e964b4735a260356b50"], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":[],
"id":null
}
Starts and enables sealing blocks by the miner.
No parameters
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "devel_startSealing", "params": [], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":null,
"id":null
}
Stops and disables sealing blocks by the miner.
No parameters
null
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "devel_stopSealing", "params": [], "id": null}' \
localhost:8080
{
"jsonrpc":"2.0",
"result":null,
"id":null
}
Get peers in Block Sync module.
No parameters
string[]
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "devel_getBlockSyncPeers", "params": [], "id": 3}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": ["1.2.3.4:3485", "1.2.3.5:3485"],
"id":3
}
Get IP address and best block hash of each peer.
No parameters
[ 'string', 'H256' ][]
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "devel_getPeerBestBlockHashes", "params": [], "id": 3}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": [
["1.2.3.4:3485", "0x56642f04d519ae3262c7ba6facf1c5b11450ebaeb7955337cfbc45420d573077"],
["1.2.3.5:3485", "0x7f7104b580f9418d444560009e5a92a4573d42d2c51cd0c6045afdc761826249"]
],
"id":3
}
Get hashes of target blocks
No parameters
'H256[]
curl \
-H 'Content-Type: application/json' \
-d '{"jsonrpc": "2.0", "method": "devel_getTargetBlockHashes", "params": [], "id": 3}' \
localhost:8080
{
"jsonrpc":"2.0",
"result": [
"0x56642f04d519ae3262c7ba6facf1c5b11450ebaeb7955337cfbc45420d573077",
"0x7f7104b580f9418d444560009e5a92a4573d42d2c51cd0c6045afdc761826249"
],
"id":3
}