**Contents** - [JSON RPC API](#json-rpc-api) - [JavaScript API](#javascript-api) - [JSON-RPC Endpoint](#json-rpc-endpoint) - [Go](#go) - [JSON-RPC support](#json-rpc-support) - [The default block parameter](#the-default-block-parameter) - [Curl Examples Explained](#curl-examples-explained) - [JSON-RPC methods](#json-rpc-methods) - [JSON RPC API Reference](#json-rpc-api-reference) - [web3_clientVersion](#web3_clientversion) - [Parameters](#parameters) - [Returns](#returns) - [Example](#example) - [web3_sha3](#web3_sha3) - [Parameters](#parameters-1) - [Returns](#returns-1) - [Example](#example-1) - [net_version](#net_version) - [Parameters](#parameters-2) - [Returns](#returns-2) - [Example](#example-2) - [net_listening](#net_listening) - [Parameters](#parameters-3) - [Returns](#returns-3) - [Example](#example-3) - [net_peerCount](#net_peercount) - [Parameters](#parameters-4) - [Returns](#returns-4) - [Example](#example-4) - [etrue_protocolVersion](#etrue_protocolversion) - [Parameters](#parameters-5) - [Returns](#returns-5) - [Example](#example-5) - [etrue_syncing](#etrue_syncing) - [Parameters](#parameters-6) - [Returns](#returns-6) - [Example](#example-6) - [etrue_coinbase](#etrue_coinbase) - [Parameters](#parameters-7) - [Returns](#returns-7) - [Example](#example-7) - [etrue_mining](#etrue_mining) - [Parameters](#parameters-8) - [Returns](#returns-8) - [Example](#example-8) - [etrue_hashrate](#etrue_hashrate) - [Parameters](#parameters-9) - [Returns](#returns-9) - [Example](#example-9) - [etrue_gasPrice](#etrue_gasprice) - [Parameters](#parameters-10) - [Returns](#returns-10) - [Example](#example-10) - [etrue_accounts](#etrue_accounts) - [Parameters](#parameters-11) - [Returns](#returns-11) - [Example](#example-11) - [etrue_blockNumber](#etrue_blocknumber) - [Parameters](#parameters-12) - [Returns](#returns-12) - [Example](#example-12) - [etrue_getBalance](#etrue_getbalance) - [Parameters](#parameters-13) - [Returns](#returns-13) - [Example](#example-13) - [etrue_getStorageAt](#etrue_getstorageat) - [Parameters](#parameters-14) - [Returns](#returns-14) - [Example](#example-14) - [etrue_getTransactionCount](#etrue_gettransactioncount) - [Parameters](#parameters-15) - [Returns](#returns-15) - [Example](#example-15) - [etrue_getBlockTransactionCountByHash](#etrue_getblocktransactioncountbyhash) - [Parameters](#parameters-16) - [Returns](#returns-16) - [Example](#example-16) - [etrue_getBlockTransactionCountByNumber](#etrue_getblocktransactioncountbynumber) - [Parameters](#parameters-17) - [Returns](#returns-17) - [Example](#example-17) - [etrue_getCode](#etrue_getcode) - [Parameters](#parameters-18) - [Returns](#returns-18) - [Example](#example-18) - [etrue_sign](#etrue_sign) - [Parameters](#parameters-19) - [Returns](#returns-19) - [Example](#example-19) - [etrue_sendTransaction](#etrue_sendtransaction) - [Parameters](#parameters-20) - [Returns](#returns-20) - [Example](#example-20) - [etrue_sendRawTransaction](#etrue_sendrawtransaction) - [Parameters](#parameters-21) - [Returns](#returns-21) - [Example](#example-21) - [etrue_call](#etrue_call) - [Parameters](#parameters-22) - [Returns](#returns-22) - [Example](#example-22) - [etrue_estimateGas](#etrue_estimategas) - [Parameters](#parameters-23) - [Returns](#returns-23) - [Example](#example-23) - [etrue_getBlockByHash](#etrue_getblockbyhash) - [Parameters](#parameters-24) - [Returns](#returns-24) - [Example](#example-24) - [etrue_getBlockByNumber](#etrue_getblockbynumber) - [Parameters](#parameters-25) - [Returns](#returns-25) - [Example](#example-25) - [etrue_getTransactionByHash](#etrue_gettransactionbyhash) - [Parameters](#parameters-26) - [Returns](#returns-26) - [Example](#example-26) - [etrue_getTransactionByBlockHashAndIndex](#etrue_gettransactionbyblockhashandindex) - [Parameters](#parameters-27) - [Returns](#returns-27) - [Example](#example-27) - [etrue_getTransactionByBlockNumberAndIndex](#etrue_gettransactionbyblocknumberandindex) - [Parameters](#parameters-28) - [Returns](#returns-28) - [Example](#example-28) - [etrue_getTransactionReceipt](#etrue_gettransactionreceipt) - [Parameters](#parameters-29) - [Returns](#returns-29) - [Example](#example-29) - [etrue_newFilter](#etrue_newfilter) - [A note on specifying topic filters:](#a-note-on-specifying-topic-filters) - [Parameters](#parameters-30) - [Returns](#returns-30) - [Example](#example-30) - [etrue_newBlockFilter](#etrue_newblockfilter) - [Parameters](#parameters-31) - [Returns](#returns-31) - [Example](#example-31) - [etrue_newPendingTransactionFilter](#etrue_newpendingtransactionfilter) - [Parameters](#parameters-32) - [Returns](#returns-32) - [Example](#example-32) - [etrue_uninstallFilter](#etrue_uninstallfilter) - [Parameters](#parameters-33) - [Returns](#returns-33) - [Example](#example-33) - [etrue_getFilterChanges](#etrue_getfilterchanges) - [Parameters](#parameters-34) - [Returns](#returns-34) - [Example](#example-34) - [etrue_getFilterLogs](#etrue_getfilterlogs) - [Parameters](#parameters-35) - [Returns](#returns-35) - [Example](#example-35) - [etrue_getLogs](#etrue_getlogs) - [Parameters](#parameters-36) - [Returns](#returns-36) - [Example](#example-36) - [etrue_getWork](#etrue_getwork) - [Parameters](#parameters-37) - [Returns](#returns-37) - [Example](#example-37) - [etrue_submitWork](#etrue_submitwork) - [Parameters](#parameters-38) - [Returns](#returns-38) - [Example](#example-38) - [etrue_submitHashrate](#etrue_submithashrate) - [Parameters](#parameters-39) - [Returns](#returns-39) - [Example](#example-39) - [etrue_committeeNumber](#etrue_committeeNumber) - [Parameters](#parameters-40) - [Returns](#returns-40) - [Example](#example-40) - [etrue_fruitNumber](#etrue_fruitNumber) - [Parameters](#parameters-41) - [Returns](#returns-41) - [Example](#example-41) - [etrue_rewardSnailBlock](#etrue_rewardSnailBlock) - [Parameters](#parameters-42) - [Returns](#returns-42) - [Example](#example-42) - [etrue_snailBlockNumber](#etrue_snailBlockNumber) - [Parameters](#parameters-43) - [Returns](#returns-43) - [Example](#example-43) - [etrue_getCommittee](#etrue_getCommittee) - [Parameters](#parameters-44) - [Returns](#returns-44) - [Example](#example-44) - [etrue_getFruitByNumber](#etrue_getFruitByNumber) - [Parameters](#parameters-45) - [Returns](#returns-45) - [Example](#example-45) - [etrue_getFruitByHash](#etrue_getFruitByHash) - [Parameters](#parameters-46) - [Returns](#returns-46) - [Example](#example-46) - [etrue_getRewardBlock](#etrue_getRewardBlock) - [Parameters](#parameters-47) - [Returns](#returns-47) - [Example](#example-47) - [etrue_getSnailBlockByNumber](#etrue_getSnailBlockByNumber) - [Parameters](#parameters-48) - [Returns](#returns-48) - [Example](#example-48) - [etrue_getSnailBlockByHash](#etrue_getSnailBlockByHash) - [Parameters](#parameters-49) - [Returns](#returns-49) - [Example](#example-49) - [etrue_getDataset](#etrue_getDataset) - [Parameters](#parameters-50) - [Returns](#returns-50) - [Example](#example-50) - [etrue_getSnailRewardContent](#etrue_getSnailRewardContent) - [Parameters](#parameters-51) - [Returns](#returns-51) - [Example](#example-51) <!-- END doctoc generated TOC please keep comment here to allow auto update --> # JSON RPC API [JSON](http://json.org/) is a lightweight data-interchange format. It can represent numbers, strings, ordered sequences of values, and collections of name/value pairs. [JSON-RPC](http://www.jsonrpc.org/specification) 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 in 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](http://www.ietf.org/rfc/rfc4627.txt)) as data format. Getrue has experimental pub/sub support. See [this](https://github.com/truechain/truechain-engineering-code/wiki/RPC-PUB-SUB) page for more information. ## JavaScript API To talk to an truechain node from inside a JavaScript application use the [web3.js](https://github.com/truechain/web3.js) library, which gives a convenient interface for the RPC methods. ## JSON-RPC Endpoint Default JSON-RPC endpoints: http://localhost:8545 ### Go You can start the HTTP JSON-RPC with the `--rpc` flag ```bash getrue --rpc ``` change the default port (8545) and listing address (localhost) with: ```bash getrue --rpc --rpcaddr <ip> --rpcport <portnumber> ``` If accessing the RPC from a browser, CORS will need to be enabled with the appropriate domain set. Otherwise, JavaScript calls are limit by the same-origin policy and requests will fail: ```bash getrue --rpc --rpccorsdomain "http://localhost:3000" ``` ## JSON-RPC support JSON-RPC 2.0/ Batch requests/ HTTP/ IPC/ WS ## The default block parameter The following methods have an extra default block parameter: - [etrue_getBalance](#etrue_getbalance) - [etrue_getCode](#etrue_getcode) - [etrue_getTransactionCount](#etrue_gettransactioncount) - [etrue_getStorageAt](#etrue_getstorageat) - [etrue_call](#etrue_call) When requests are made that act on the state of truechain, the last default block parameter determines the height of the block. The following options are possible for the defaultBlock parameter: - `HEX String` - an integer block number - `String "earliest"` for the earliest/genesis block - `String "latest"` - for the latest mined block - `String "pending"` - for the pending state/transactions ## Curl Examples Explained The curl options below might return a response where the node complains about the content type, this is because the --data option sets the content type to application/x-www-form-urlencoded . If your node does complain, manually set the header by placing -H "Content-Type: application/json" at the start of the call. The examples also do not include the URL/IP & port combination which must be the last argument given to curl e.x. 127.0.0.1:8545 ## JSON-RPC methods | [etrue](#etrue) | [eth](#eth) |[web3](#web3) |[net](#net) | | :------------------: | :-----------------: |:-----------------: |:-----------------: | | [protocolVersion](#etrue_protocolVersion)|[protocolVersion](#eth)|[clientVersion](#web3_clientVersion)|[version](#net_version)| |[syncing](#etrue_sycning)|[syncing](#eth)|[sha3](#web3_sha3)| [peerCount](#net_peercount)| |[coinbase](#etrue_coinbase)|[coinbase](#eth)||[listening](#net_listening)| |[mining](#etrue_mining)|[mining](#eth)| |[hashrate](#etrue_hashrate)|[hashrate](#eth)| |[gasPrice](#etrue_gasPrice)|[gasPrice](#eth)| |[accounts](#etrue_accounts)|[accounts](#eth)| |[blockNumber](#etrue_blockNumber) |[blockNumber](#eth) | |[getBalance](#etrue_getBalance)|[getBalance](#eth)| |[getStorageAt](#etrue_getStorageAt)|[getStorageAt](#eth)| | [getTransactionCount](#etrue_getTransactionCount)|[getTransactionCount](#eth)| | [getBlockTransactionCountByHash](#etrue_getBlockTransactionCountByHash) |[getBlockTransactionCountByHash](#eth) | | [getBlockTransactionCountByNumber](#etrue_getBlockTransactionCountByNumber) |[getBlockTransactionCountByNumber](#eth) | | [getCode](#etrue_getCode) | [getCode](#eth) | | [sign](#etrue_sign) | [sign](#eth) | | [sendTransaction](#etrue_sendTransaction) | [sendTransaction](#eth) | | [sendRawTransaction](#etrue_sendRawTransaction) |[sendRawTransaction](#eth) | | [sendTrueRawTransaction](#etrue_sendTrueRawTransaction) | -| | [call](#etrue_call) | [call](#eth) | | [estimateGas](#etrue_estimateGas) | [estimateGas](#eth) | | [getBlockByHash](#etrue_getblockbyhash) | [getBlockByHash](#eth)| | [getBlockByNumber](#etrue_getblockbynumber) | [getBlockByNumber](#eth)| |[getTransactionByHash](#etrue_gettransactionbyhash) | [getTransactionByHash](#eth)| |[getTransactionByBlockHashAndIndex](#etrue_gettransactionbyblockhashandindex) | [getTransactionByBlockHashAndIndex](#eth)| |[getTransactionByBlockNumberAndIndex](#etrue_gettransactionbyblocknumberandindex) | [getTransactionByBlockNumberAndIndex](#eth)| | [getTransactionReceipt](#etrue_gettransactionreceipt) |[getTransactionReceipt](#eth) | |[newFilter](#etrue_newfilter)|[newFilter](#eth)| |[newBlockFilter](#etrue_newblockfilter)|[newBlockFilter](#eth)| |[newPendingTransactionFilter](#etrue_newpendingtransactionfilter)|[newPendingTransactionFilter](#eth)| |[uninstallFilter](#etrue_uninstallfilter)|[uninstallFilter](#eth)| |[getFilterChanges](#etrue_getfilterchanges)|[getFilterChanges](#eth)| |[getFilterLogs](#etrue_getfilterlogs)|[getFilterLogs](#eth)| |[getLogs](#etrue_getlogs)|[getLogs](#eth)| |[getWork](#etrue_getwork)|[getWork](#eth)| |[submitWork](#etrue_submitwork)|[submitWork](#eth)| |[submitHashrate](#etrue_submithashrate)|[submitHashrate](#eth)| | [committeeNumber](#etrue_committeeNumber) |- | | [fruitNumber](#etrue_fruitNumber) |- | | [rewardSnailBlock](#etrue_rewardSnailBlock) |- | | [snailBlockNumber](#etrue_snailBlockNumber) |- | | [getCommittee](#etrue_getCommittee) | - | | [getFruitByNumber](#etrue_getFruitByNumber) |-| | [getFruitByHash](#etrue_getFruitByHash) |-| | [getRewardBlock](#etrue_getRewardBlock) |- | | [getSnailBlockByNumber](#etrue_getSnailBlockByNumber) | - | | [getSnailBlockByHash](#etrue_getSnailBlockByHash) | - | | [getDataset](#etrue_getDataset) | - | | [getSnailRewardContent](#etrue_getSnailRewardContent) | - | | | ## JSON RPC API Reference *** ## web3 #### web3_clientVersion Returns the current client version. ##### Parameters none ##### Returns `String` - The current client version. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' // Result { "id":67, "jsonrpc":"2.0", "result": "Getrue/v1.1.0-unstable-d4c05e98/linux-amd64/go1.10" } ``` *** #### web3_sha3 Returns Keccak-256 (*not* the standardized SHA3-256) of the given data. ##### Parameters 1. `DATA` - the data to convert into a SHA3 hash. ##### Example Parameters ```js params: [ "0x68656c6c6f20776f726c64" ] ``` ##### Returns `DATA` - The SHA3 result of the given string. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x68656c6c6f20776f726c64"],"id":64}' // Result { "id":64, "jsonrpc": "2.0", "result": "0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad" } ``` *** ## net #### net_version Returns the current network id. ##### Parameters none ##### Returns `String` - The current network id. - `"19330"`: Truechain Mainnet - `"18928"`: Testnet - `"100"`: Devnet ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}' // Result { "id":67, "jsonrpc": "2.0", "result": "19330" } ``` *** #### net_listening Returns `true` if client is actively listening for network connections. ##### Parameters none ##### Returns `Boolean` - `true` when listening, otherwise `false`. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}' // Result { "id":67, "jsonrpc":"2.0", "result":true } ``` *** #### net_peerCount Returns number of peers currently connected to the client. ##### Parameters none ##### Returns `QUANTITY` - integer of the number of connected peers. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}' // Result { "id":74, "jsonrpc": "2.0", "result": "0x2" // 2 } ``` *** ## Etrue #### etrue_protocolVersion Returns the current truechain protocol version. ##### Parameters none ##### Returns `String` - The current truechain protocol version. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_protocolVersion","params":[],"id":67}' // Result { "id":67, "jsonrpc": "2.0", "result": "0x40" } ``` *** #### etrue_syncing Returns an object with data about the sync status or `false`. ##### Parameters none ##### Returns `Object|Boolean`, An object with sync status data or `FALSE`, when not syncing: - `currentFastBlock`: `QUANTITY` -current block number(fastchain) - `currentSnailBlock`: `QUANTITY` -current block number(snailchain) - `highestFastBlock`: `QUANTITY` - already highest block number(fastchain) - `highestSnailBlock`: `QUANTITY` -already highest block number(snailchain) - `knownStates`: `String` -already know state - `pulledStates`: `String` -already complete state - `startingFastBlock`: `QUANTITY` -start sync block number(fastchain) - `startingSnailBlock`: `QUANTITY` -start sync block number(snailchain) ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_syncing","params":[],"id":1}' // Result { "jsonrpc": "2.0", "id": 1, "result": { "currentFastBlock": "0x2e9a", "currentSnailBlock": "0xab", "highestFastBlock": "0x3a3d2", "highestSnailBlock": "0xab7", "knownStates": "0x0", "pulledStates": "0x0", "startingFastBlock": "0x2e98", "startingSnailBlock": "0x0" } } // Or when not syncing { "id":1, "jsonrpc": "2.0", "result": false } ``` *** #### etrue_coinbase Returns the client coinbase address. ##### Parameters none ##### Returns `DATA`, 20 bytes - the current coinbase address. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_coinbase","params":[],"id":64}' // Result { "id":64, "jsonrpc": "2.0", "result": "0xc94770007dda54cF92009BFF0dE90c06F603a09f" } ``` *** #### etrue_mining Returns `true` if client is actively mining new blocks. ##### Parameters none ##### Returns `Boolean` - returns `true` of the client is mining, otherwise `false`. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_mining","params":[],"id":71}' // Result { "id":71, "jsonrpc": "2.0", "result": true } ``` *** #### etrue_hashrate Returns the number of hashes per second that the node is mining with. ##### Parameters none ##### Returns `QUANTITY` - number of hashes per second. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_hashrate","params":[],"id":71}' // Result { "id":71, "jsonrpc": "2.0", "result": "0x38a" } ``` *** #### etrue_gasPrice Returns the current price per gas in wei. ##### Parameters none ##### Returns `QUANTITY` - integer of the current gas price in wei. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_gasPrice","params":[],"id":73}' // Result { "id":73, "jsonrpc": "2.0", "result": "0xf4240" // 1000000 } ``` *** #### etrue_accounts Returns a list of addresses owned by client. ##### Parameters none ##### Returns `Array of DATA`, 20 Bytes - addresses owned by the client. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_accounts","params":[],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": ["0xc94770007dda54cF92009BFF0dE90c06F603a09f"] } ``` *** #### etrue_blockNumber Returns the number of most recent block. ##### Parameters none ##### Returns `QUANTITY` - integer of the current block number the client is on. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_blockNumber","params":[],"id":1}' // Result { "id":83, "jsonrpc": "2.0", "result": "0xc94" // 1207 } ``` *** #### etrue_getBalance Returns the balance of the account of given address. ##### Parameters 1. `DATA`, 20 Bytes - address to check for balance. 2. `QUANTITY|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`, see the [default block parameter](#the-default-block-parameter) ##### Example Parameters ```js params: [ '0xc94770007dda54cF92009BFF0dE90c06F603a09f', 'latest' ] ``` ##### Returns `QUANTITY` - integer of the current balance in wei. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getBalance","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f", "latest"],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0x0234c8a3397aab58" // 158972490234375000 } ``` *** #### etrue_getStorageAt Returns the value from a storage position at a given address. ##### Parameters 1. `DATA`, 20 Bytes - address of the storage. 2. `QUANTITY` - integer of the position in the storage. 3. `QUANTITY|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`, see the [default block parameter](#the-default-block-parameter) ##### Returns `DATA` - the value at this storage position. ##### Example Calculating the correct position depends on the storage to retrieve. Consider the following contract deployed at `0x295a70b2de5e3953354a6a8344e616ed314d7251` by address `0x391694e7e0b0cce554cb130d723a9d27458f9298`. ``` contract Storage { uint pos0; mapping(address => uint) pos1; function Storage() { pos0 = 1234; pos1[msg.sender] = 5678; } } ``` Retrieving the value of pos0 is straight forward: ```js curl -X POST --data '{"jsonrpc":"2.0", "method": "etrue_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x0", "latest"], "id": 1}' localhost:8545 {"jsonrpc":"2.0","id":1,"result":"0x00000000000000000000000000000000000000000000000000000000000004d2"} ``` Retrieving an element of the map is harder. The position of an element in the map is calculated with: ```js keccack(LeftPad32(key, 0), LeftPad32(map position, 0)) ``` This means to retrieve the storage on pos1["0x391694e7e0b0cce554cb130d723a9d27458f9298"] we need to calculate the position with: ```js keccak(decodeHex("000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001")) ``` The getrue console which comes with the web3 library can be used to make the calculation: ```js > var key = "000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001" undefined > web3.sha3(key, {"encoding": "hex"}) "0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9" ``` Now to fetch the storage: ```js curl -X POST --data '{"jsonrpc":"2.0", "method": "etrue_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9", "latest"], "id": 1}' localhost:8545 {"jsonrpc":"2.0","id":1,"result":"0x000000000000000000000000000000000000000000000000000000000000162e"} ``` *** #### etrue_getTransactionCount Returns the number of transactions *sent* from an address. ##### Parameters 1. `DATA`, 20 Bytes - address. 2. `QUANTITY|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`, see the [default block parameter](#the-default-block-parameter) ##### Example Parameters ```js params: [ '0xc94770007dda54cF92009BFF0dE90c06F603a09f', 'latest' // state at the latest block ] ``` ##### Returns `QUANTITY` - integer of the number of transactions send from this address. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getTransactionCount","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f","latest"],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0x1" // 1 } ``` *** #### etrue_getBlockTransactionCountByHash Returns the number of transactions in a block from a block matching the given block hash. ##### Parameters 1. `DATA`, 32 Bytes - hash of a block. ##### Example Parameters ```js params: [ '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238' ] ``` ##### Returns `QUANTITY` - integer of the number of transactions in this block. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getBlockTransactionCountByHash","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0xc" // 11 } ``` *** #### etrue_getBlockTransactionCountByNumber > > Returns the number of transactions in a block matching the given block number. ##### Parameters 1. `QUANTITY|TAG` - integer of a block number, or the string `"earliest"`, `"latest"` or `"pending"`, as in the [default block parameter](#the-default-block-parameter). ##### Example Parameters ```js params: [ '0xe8', // 232 ] ``` ##### Returns `QUANTITY` - integer of the number of transactions in this block. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getBlockTransactionCountByNumber","params":["0xe8"],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0xa" // 10 } ``` *** #### etrue_getCode Returns code at a given address. ##### Parameters 1. `DATA`, 20 Bytes - address. 2. `QUANTITY|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`, see the [default block parameter](#the-default-block-parameter). ##### Example Parameters ```js params: [ '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b', '0x2' // 2 ] ``` ##### Returns `DATA` - the code from the given address. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getCode","params":["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x2"],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056" } ``` *** #### etrue_sign The sign method calculates an Truechain specific signature with: `sign(keccak256("\x19Truechain Signed Message:\n" + len(message) + message)))`. By adding a prefix to the message makes the calculated signature recognisable as an Truechain specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim. **Note** the address to sign with must be unlocked. ##### Parameters account, message 1. `DATA`, 20 Bytes - address. 2. `DATA`, N Bytes - message to sign. ##### Returns `DATA`: Signature ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_sign","params":["0x9b2055d370f73ec7d8a03e965129118dc8f5bf83", "0xdeadbeaf"],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0xa3f20717a250c2b0b729b7e5becbff67fdaef7e0699da4de7ca5895b02a170a12d887fd3b17bfdce3481f10bea41f45ba9f709d39ce8325427b57afcfc994cee1b" } ``` An example how to use solidity ecrecover to verify the signature calculated with `etrue_sign` can be found [here](https://gist.github.com/bas-vk/d46d83da2b2b4721efb0907aecdb7ebd). The contract is deployed on the testnet Ropsten and Rinkeby. *** #### etrue_sendTransaction Creates new message call transaction or a contract creation, if the data field contains code. ##### Parameters 1. `Object` - The transaction object - `from`: `DATA`, 20 Bytes - The address the transaction is send from. - `to`: `DATA`, 20 Bytes - (optional when creating new contract) The address the transaction is directed to. - `gas`: `QUANTITY` - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas. - `gasPrice`: `QUANTITY` - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gas - `value`: `QUANTITY` - (optional) Integer of the value sent with this transaction - `data`: `DATA` - The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. - `nonce`: `QUANTITY` - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce. ##### Example Parameters ```js params: [{ "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155", "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", "gas": "0x76c0", // 30400 "gasPrice": "0x9184e72a000", // 10000000000000 "value": "0x9184e72a", // 2441406250 "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675" }] ``` ##### Returns `DATA`, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available. Use [etrue_getTransactionReceipt](#etrue_gettransactionreceipt) to get the contract address, after the transaction was mined, when you created a contract. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_sendTransaction","params":[{see above}],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331" } ``` *** #### etrue_sendRawTransaction Creates new message call transaction or a contract creation for signed transactions. ##### Parameters 1. `DATA`, The signed transaction data. ##### Example Parameters ```js params: ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"] ``` ##### Returns `DATA`, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available. Use [etrue_getTransactionReceipt](#etrue_gettransactionreceipt) to get the contract address, after the transaction was mined, when you created a contract. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_sendRawTransaction","params":[{see above}],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331" } ``` *** #### etrue_sendTrueRawTransaction When transaction contain payer or fee,Creates new message call transaction or a contract creation for signed transactions. ##### Parameters 1. `DATA`, The signed transaction data. ##### Example Parameters ```js params: ["0xf8c60183989680834c4b4094bea78fea68dba84363d0f9b79219ddf5991ccb2a880de0b6b3a76400008094cfb7ec3ac64a3afde043a5b32212d0b9c25b5d808081eba07cc4b8300a8ab6a7d6aee713f6dc61311848bf827794c370873ca334e7cc2cc1a05cd365ffc46cada820911e3c11123e36245ed1cec7943038632715a89a421b0281eca037d6e60016bd70371fd45a2fadd63f8824b34331f2cb5f7fe69f04df7f6d9caea04e05dda8cffa3e453aa474f955eef97fe63e9c9721860aaea379a0ace111fd16"] ``` ##### Returns `DATA`, 32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available. Use [etrue_getTransactionReceipt](#etrue_gettransactionreceipt) to get the contract address, after the transaction was mined, when you created a contract. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_sendTrueRawTransaction","params":[{see above}],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0xc7509ef7672e1c1d59cec2854d3d074d442984382bd03c665c2e82ebfdacc25e" } ``` *** #### etrue_call Executes a new message call immediately without creating a transaction on the block chain. ##### Parameters 1. `Object` - The transaction call object - `from`: `DATA`, 20 Bytes - (optional) The address the transaction is sent from. - `to`: `DATA`, 20 Bytes - The address the transaction is directed to. - `gas`: `QUANTITY` - (optional) Integer of the gas provided for the transaction execution. etrue_call consumes zero gas, but this parameter may be needed by some executions. - `gasPrice`: `QUANTITY` - (optional) Integer of the gasPrice used for each paid gas - `value`: `QUANTITY` - (optional) Integer of the value sent with this transaction - `data`: `DATA` - (optional) Hash of the method signature and encoded parameters 2. `QUANTITY|TAG` - integer block number, or the string `"latest"`, `"earliest"` or `"pending"`, see the [default block parameter](#the-default-block-parameter) ##### Returns `DATA` - the return value of executed contract. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_call","params":[{see above}],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0x" } ``` *** #### etrue_estimateGas Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance. ##### Parameters See [etrue_call](#etrue_call) parameters, expect that all properties are optional. If no gas limit is specified getrue uses the block gas limit from the pending block as an upper bound. As a result the returned estimate might not be enough to executed the call/transaction when the amount of gas is higher than the pending block gas limit. ##### Returns `QUANTITY` - the amount of gas used. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_estimateGas","params":[{see above}],"id":1}' // Result { "id":1, "jsonrpc": "2.0", "result": "0x5208" // 21000 } ``` *** #### etrue_getBlockByHash Returns information about a block by hash. ##### Parameters 1. `DATA`, 32 Bytes - Hash of a block. 2. `Boolean` - If `true` it returns the full transaction objects, if `false` only the hashes of the transactions. ##### Example Parameters ```js params: [ '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331', true ] ``` ##### Returns `Object` - A block object, or `null` when no block was found: - `number`: `QUANTITY` - the block number. `null` when its pending block. - `hash`: `DATA`, 32 Bytes - hash of the block. `null` when its pending block. - `parentHash`: `DATA`, 32 Bytes - hash of the parent block. - `CommitteeHash`: `DATA`, 32 Bytes - hash of the committtee. - `logsBloom`: `DATA`, 256 Bytes - the bloom filter for the logs of the block. `null` when its pending block. - `transactionsRoot`: `DATA`, 32 Bytes - the root of the transaction trie of the block. - `stateRoot`: `DATA`, 32 Bytes - the root of the final state trie of the block. - `receiptsRoot`: `DATA`, 32 Bytes - the root of the receipts trie of the block. - `miner`: `DATA`, 20 Bytes - the address of the beneficiary to whom the mining rewards were given. - `difficulty`: `QUANTITY` - integer of the difficulty for this block. - `extraData`: `DATA` - the "extra data" field of this block. - `size`: `QUANTITY` - integer the size of this block in bytes. - `gasLimit`: `QUANTITY` - the maximum gas allowed in this block. - `gasUsed`: `QUANTITY` - the total used gas by all transactions in this block. - `timestamp`: `QUANTITY` - the unix timestamp for when the block was collated. - `transactions`: `Array` - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getBlockByHash","params":["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d15273312", true],"id":1}' // Result { "id":1, "jsonrpc":"2.0", "result": { "number": "0x1b4", // 436 "hash": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", "parentHash": "0x9646252be9520f6e71339a8df9c55e4d7619deeb018d2a3f2d21fc165dde5eb5", "nonce": "0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2", "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "logsBloom": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "stateRoot": "0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff", "miner": "0x4e65fda2159562a496f9f3522f89122a3088497a", "difficulty": "0x027f07", // 163591 "totalDifficulty": "0x027f07", // 163591 "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000", "size": "0x027f07", // 163591 "gasLimit": "0x9f759", // 653145 "gasUsed": "0x9f759", // 653145 "timestamp": "0x54e34e8e" // 1424182926 "transactions": [{...},{ ... }] } } ``` *** #### etrue_getBlockByNumber Returns information about a block by block number. ##### Parameters 1. `QUANTITY|TAG` - integer of a block number, or the string `"earliest"`, `"latest"` or `"pending"`, as in the [default block parameter](#the-default-block-parameter). 2. `Boolean` - If `true` it returns the full transaction objects, if `false` only the hashes of the transactions. ##### Example Parameters ```js params: [ '0x1b4', // 436 true ] ``` ##### Returns See [etrue_getBlockByHash](#etrue_getblockbyhash) ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getBlockByNumber","params":["0x1b4", true],"id":1}' ``` Result see [etrue_getBlockByHash](#etrue_getblockbyhash) *** #### etrue_getTransactionByHash Returns the information about a transaction requested by transaction hash. ##### Parameters 1. `DATA`, 32 Bytes - hash of a transaction ##### Example Parameters ```js params: [ "0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b" ] ``` ##### Returns `Object` - A transaction object, or `null` when no transaction was found: - `blockHash`: `DATA`, 32 Bytes - hash of the block where this transaction was in. `null` when its pending. - `blockNumber`: `QUANTITY` - block number where this transaction was in. `null` when its pending. - `from`: `DATA`, 20 Bytes - address of the sender. - `gas`: `QUANTITY` - gas provided by the sender. - `gasPrice`: `QUANTITY` - gas price provided by the sender in Wei. - `hash`: `DATA`, 32 Bytes - hash of the transaction. - `input`: `DATA` - the data send along with the transaction. - `nonce`: `QUANTITY` - the number of transactions made by the sender prior to this one. - `to`: `DATA`, 20 Bytes - address of the receiver. `null` when its a contract creation transaction. - `transactionIndex`: `QUANTITY` - integer of the transaction's index position in the block. `null` when its pending. - `value`: `QUANTITY` - value transferred in Wei. - `v`: `QUANTITY` - ECDSA recovery id - `r`: `DATA`, 32 Bytes - ECDSA signature r - `s`: `DATA`, 32 Bytes - ECDSA signature s ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getTransactionByHash","params":["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],"id":1}' // Result { "jsonrpc":"2.0", "id":1, "result":{ "blockHash":"0x1d59ff54b1eb26b013ce3cb5fc9dab3705b415a67127a003c3e61eb445bb8df2", "blockNumber":"0x5daf3b", // 6139707 "from":"0xa7d9ddbe1f17865597fbd27ec712455208b6b76d", "gas":"0xc350", // 50000 "gasPrice":"0x4a817c800", // 20000000000 "hash":"0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b", "input":"0x68656c6c6f21", "nonce":"0x15", // 21 "to":"0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb", "transactionIndex":"0x41", // 65 "value":"0xf3dbb76162000", // 4290000000000000 "v":"0x25", // 37 "r":"0x1b5e176d927f8e9ab405058b2d2457392da3e20f328b16ddabcebc33eaac5fea", "s":"0x4ba69724e8f69de52f0125ad8b3c5c2cef33019bac3249e2c0a2192766d1721c" } } ``` *** #### etrue_getTransactionByBlockHashAndIndex Returns information about a transaction by block hash and transaction index position. ##### Parameters 1. `DATA`, 32 Bytes - hash of a block. 2. `QUANTITY` - integer of the transaction index position. ##### Example Parameters ```js params: [ '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331', '0x0' // 0 ] ``` ##### Returns See [etrue_getTransactionByHash](#etrue_gettransactionbyhash) ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getTransactionByBlockHashAndIndex","params":["0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "0x0"],"id":1}' ``` Result see [etrue_getTransactionByHash](#etrue_gettransactionbyhash) *** #### etrue_getTransactionByBlockNumberAndIndex Returns information about a transaction by block number and transaction index position. ##### Parameters 1. `QUANTITY|TAG` - a block number, or the string `"earliest"`, `"latest"` or `"pending"`, as in the [default block parameter](#the-default-block-parameter). 2. `QUANTITY` - the transaction index position. ##### Example Parameters ```js params: [ '0x29c', // 668 '0x0' // 0 ] ``` ##### Returns See [etrue_getTransactionByHash](#etrue_gettransactionbyhash) ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getTransactionByBlockNumberAndIndex","params":["0x29c", "0x0"],"id":1}' ``` Result see [etrue_getTransactionByHash](#etrue_gettransactionbyhash) *** #### etrue_getTransactionReceipt Returns the receipt of a transaction by transaction hash. **Note** That the receipt is not available for pending transactions. ##### Parameters 1. `DATA`, 32 Bytes - hash of a transaction ##### Example Parameters ```js params: [ '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238' ] ``` ##### Returns `Object` - A transaction receipt object, or `null` when no receipt was found: - `transactionHash `: `DATA`, 32 Bytes - hash of the transaction. - `transactionIndex`: `QUANTITY` - integer of the transaction's index position in the block. - `blockHash`: `DATA`, 32 Bytes - hash of the block where this transaction was in. - `blockNumber`: `QUANTITY` - block number where this transaction was in. - `from`: `DATA`, 20 Bytes - address of the sender. - `to`: `DATA`, 20 Bytes - address of the receiver. null when it's a contract creation transaction. - `cumulativeGasUsed `: `QUANTITY ` - The total amount of gas used when this transaction was executed in the block. - `gasUsed `: `QUANTITY ` - The amount of gas used by this specific transaction alone. - `contractAddress `: `DATA`, 20 Bytes - The contract address created, if the transaction was a contract creation, otherwise `null`. - `logs`: `Array` - Array of log objects, which this transaction generated. - `logsBloom`: `DATA`, 256 Bytes - Bloom filter for light clients to quickly retrieve related logs. It also returns _either_ : - `root` : `DATA` 32 bytes of post-transaction stateroot (pre Byzantium) - `status`: `QUANTITY` either `1` (success) or `0` (failure) ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getTransactionReceipt","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1}' // Result { "id":1, "jsonrpc":"2.0", "result": { transactionHash: '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238', transactionIndex: '0x1', // 1 blockNumber: '0xb', // 11 blockHash: '0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b', cumulativeGasUsed: '0x33bc', // 13244 gasUsed: '0x4dc', // 1244 contractAddress: '0xb60e8dd61c5d32be8058bb8eb970870f07233155', // or null, if none was created logs: [{ // logs as returned by getFilterLogs, etc. }, ...], logsBloom: "0x00...0", // 256 byte bloom filter status: '0x1' } } ``` *** #### etrue_newFilter Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call [etrue_getFilterChanges](#etrue_getfilterchanges). ##### A note on specifying topic filters: Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters: * `[]` "anything" * `[A]` "A in first position (and anything after)" * `[null, B]` "anything in first position AND B in second position (and anything after)" * `[A, B]` "A in first position AND B in second position (and anything after)" * `[[A, B], [A, B]]` "(A OR B) in first position AND (A OR B) in second position (and anything after)" ##### Parameters 1. `Object` - The filter options: - `fromBlock`: `QUANTITY|TAG` - (optional, default: `"latest"`) Integer block number, or `"latest"` for the last mined block or `"pending"`, `"earliest"` for not yet mined transactions. - `toBlock`: `QUANTITY|TAG` - (optional, default: `"latest"`) Integer block number, or `"latest"` for the last mined block or `"pending"`, `"earliest"` for not yet mined transactions. - `address`: `DATA|Array`, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate. - `topics`: `Array of DATA`, - (optional) Array of 32 Bytes `DATA` topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options. ##### Example Parameters ```js params: [{ "fromBlock": "0x1", "toBlock": "0x2", "address": "0x8888f1f195afa192cfee860698584c030f4c9db1", "topics": ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b", null, ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x0000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebccc"]] }] ``` ##### Returns `QUANTITY` - A filter id. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_newFilter","params":[{"topics":["0x0000000000000000000000000000000000000000000000000000000012341234"]}],"id":73}' // Result { "id":1, "jsonrpc": "2.0", "result": "0x1" // 1 } ``` *** #### etrue_newBlockFilter Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call [etrue_getFilterChanges](#etrue_getfilterchanges). ##### Parameters None ##### Returns `QUANTITY` - A filter id. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_newBlockFilter","params":[],"id":73}' // Result { "id":1, "jsonrpc": "2.0", "result": "0x1" // 1 } ``` *** #### etrue_newPendingTransactionFilter Creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call [etrue_getFilterChanges](#etrue_getfilterchanges). ##### Parameters None ##### Returns `QUANTITY` - A filter id. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_newPendingTransactionFilter","params":[],"id":73}' // Result { "id":1, "jsonrpc": "2.0", "result": "0x1" // 1 } ``` *** #### etrue_uninstallFilter Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren't requested with [etrue_getFilterChanges](#etrue_getfilterchanges) for a period of time. ##### Parameters 1. `QUANTITY` - The filter id. ##### Example Parameters ```js params: [ "0xb" // 11 ] ``` ##### Returns `Boolean` - `true` if the filter was successfully uninstalled, otherwise `false`. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_uninstallFilter","params":["0xb"],"id":73}' // Result { "id":1, "jsonrpc": "2.0", "result": true } ``` *** #### etrue_getFilterChanges Polling method for a filter, which returns an array of logs which occurred since last poll. ##### Parameters 1. `QUANTITY` - the filter id. ##### Example Parameters ```js params: [ "0x16" // 22 ] ``` ##### Returns `Array` - Array of log objects, or an empty array if nothing has changed since last poll. - For filters created with `etrue_newBlockFilter` the return are block hashes (`DATA`, 32 Bytes), e.g. `["0x3454645634534..."]`. - For filters created with `etrue_newPendingTransactionFilter ` the return are transaction hashes (`DATA`, 32 Bytes), e.g. `["0x6345343454645..."]`. - For filters created with `etrue_newFilter` logs are objects with following params: - `removed`: `TAG` - `true` when the log was removed, due to a chain reorganization. `false` if its a valid log. - `logIndex`: `QUANTITY` - integer of the log index position in the block. `null` when its pending log. - `transactionIndex`: `QUANTITY` - integer of the transactions index position log was created from. `null` when its pending log. - `transactionHash`: `DATA`, 32 Bytes - hash of the transactions this log was created from. `null` when its pending log. - `blockHash`: `DATA`, 32 Bytes - hash of the block where this log was in. `null` when its pending. `null` when its pending log. - `blockNumber`: `QUANTITY` - the block number where this log was in. `null` when its pending. `null` when its pending log. - `address`: `DATA`, 20 Bytes - address from which this log originated. - `data`: `DATA` - contains the non-indexed arguments of the log. - `topics`: `Array of DATA` - Array of 0 to 4 32 Bytes `DATA` of indexed log arguments. (In *solidity*: The first topic is the *hash* of the signature of the event (e.g. `Deposit(address,bytes32,uint256)`), except you declared the event with the `anonymous` specifier.) ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getFilterChanges","params":["0x16"],"id":73}' // Result { "id":1, "jsonrpc":"2.0", "result": [{ "logIndex": "0x1", // 1 "blockNumber":"0x1b4", // 436 "blockHash": "0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d", "transactionHash": "0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf", "transactionIndex": "0x0", // 0 "address": "0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d", "data":"0x0000000000000000000000000000000000000000000000000000000000000000", "topics": ["0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5"] },{ ... }] } ``` *** #### etrue_getFilterLogs Returns an array of all logs matching filter with given id. ##### Parameters 1. `QUANTITY` - The filter id. ##### Example Parameters ```js params: [ "0x16" // 22 ] ``` ##### Returns See [etrue_getFilterChanges](#etrue_getfilterchanges) ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getFilterLogs","params":["0x16"],"id":74}' ``` Result see [etrue_getFilterChanges](#etrue_getfilterchanges) *** #### etrue_getLogs Returns an array of all logs matching a given filter object. ##### Parameters 1. `Object` - The filter options: - `fromBlock`: `QUANTITY|TAG` - (optional, default: `"latest"`) Integer block number, or `"latest"` for the last mined block or `"pending"`, `"earliest"` for not yet mined transactions. - `toBlock`: `QUANTITY|TAG` - (optional, default: `"latest"`) Integer block number, or `"latest"` for the last mined block or `"pending"`, `"earliest"` for not yet mined transactions. - `address`: `DATA|Array`, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate. - `topics`: `Array of DATA`, - (optional) Array of 32 Bytes `DATA` topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options. - `blockhash`: `DATA`, 32 Bytes - (optional) With the addition of EIP-234 (Getrue >= v1.8.13 or Parity >= v2.1.0), `blockHash` is a new filter option which restricts the logs returned to the single block with the 32-byte hash `blockHash`. Using `blockHash` is equivalent to `fromBlock` = `toBlock` = the block number with hash `blockHash`. If `blockHash` is present in the filter criteria, then neither `fromBlock` nor `toBlock` are allowed. ##### Example Parameters ```js params: [{ "topics": ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"] }] ``` ##### Returns See [etrue_getFilterChanges](#etrue_getfilterchanges) ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getLogs","params":[{"topics":["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"]}],"id":74}' ``` Result see [etrue_getFilterChanges](#etrue_getfilterchanges) *** #### etrue_getWork Returns the hash of the current block, the seedHash, and the boundary condition to be met ("target"). ##### Parameters none ##### Returns `Array` - Array with the following properties: 1. `DATA`, 32 Bytes - current snailBlock header without nonce 2. `DATA`, 32 Bytes - the seed hash used for the DAG. 3. `DATA`, 32 Bytes - the boundary condition ("target"), 2^256 / fruit difficulty. 4. `DATA`, 32 Bytes - the boundary condition ("target"), 2^256 / snailBlock difficulty. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0","method":"etrue_getWork","params":[],"id":73}' // Result { "jsonrpc": "2.0", "id": 73, "result": ["0xbcdcb8533dcf88b736f5b44f777250922f0f0472d4dd34a5a1b445a0c47aceed", "58bc067579760d307143ec1cd416eb3814110d29bf21aba0cd18586e2f038791", "0x0000000000000000000000000000000000000000000000000000000000000064", "0x0000000000000000000000000000000000000000000000000000000000002710"] } ``` *** #### etrue_submitWork Used for submitting a proof-of-work solution. ##### Parameters 1. `DATA`, 8 Bytes - The nonce found (64 bits) 2. `DATA`, 32 Bytes - The header's pow-hash (256 bits) 3. `DATA`, 32 Bytes - The mix digest (256 bits) ##### Example Parameters ```js params: [ "0x0000000000000001", "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000" ] ``` ##### Returns `Boolean` - returns `true` if the provided solution is valid, otherwise `false`. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_submitWork", "params":["0x0000000000000001", "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"],"id":73}' // Result { "id":73, "jsonrpc":"2.0", "result": true } ``` *** #### etrue_submitHashrate Used for submitting mining hashrate. ##### Parameters 1. `Hashrate`, a hexadecimal string representation (32 bytes) of the hash rate 2. `ID`, String - A random hexadecimal(32 bytes) ID identifying the client ##### Example Parameters ```js params: [ "0x500000", "0x59daa26581d0acd1fce254fb7e85952f4c09d0915afd33d3886cd914bc7d283c" ] ``` ##### Returns `Boolean` - returns `true` if submitting went through succesfully and `false` otherwise. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_submitHashrate", "params":["0x500000", "0x59daa26581d0acd1fce254fb7e85952f4c09d0915afd33d3886cd914bc7d283c"],"id":73}' // Result { "id":73, "jsonrpc":"2.0", "result": true } ``` *** #### etrue_committeeNumber get current committee number ##### Parameters none ##### Returns QUANTITY - integer of the current committee number. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_committeeNumber", "params":[],"id":100}' // Result { "jsonrpc": "2.0", "id": 100, "result": 8 } ``` *** #### etrue_fruitNumber get current fruit number ##### Parameters none ##### Returns QUANTITY - integer of the current fruit number. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_fruitNumber", "params":[],"id":100}' // Result { "jsonrpc": "2.0", "id": 100, "result": "0x1975f" } ``` *** #### etrue_rewardSnailBlock get current reward snalBlock infomation ##### Parameters none ##### Returns `Object` - A snail block object, or `null` when no snail reward block was found: - `beginFruitNumber`: `QUANTITY` - the beign fruit number in snail reward block. - `difficulty`: `QUANTITY` - integer of the difficulty for this snail reward block. - `endFruitNumber`: `QUANTITY` - the end fruit number in snail reward block. - `extraData`: `DATA` - the "extra data" field of this reward block. - `fastNumber`: `QUANTITY` - default 0. - `fruitDifficulty`: `QUANTITY` - integer of all fruit difficulty for this snail reward block. - `fruitHash`: `DATA`, 32 Bytes - hash of fruits in snail reward block. - `fruits`: `Array` - Array of all hash of fruits in snail reward block. - `hash`: `DATA`, 32 Bytes - hash of the snail reward block. - `miner`: `DATA`, 20 Bytes - the address of the beneficiary to whom the mining rewards were given. - `mixHash`: `DATA`, 32 Bytes - the mix digest. - `nonce`: `QUANTITY` - the mining nonce. - `number`: `QUANTITY` - the snail reward number. - `parentHash`: `DATA`, 32 Bytes - hash of the parent block. - `pointerNumber`: `QUANTITY` - current snail reward block minus 7. - `size`: `QUANTITY` - integer the size of this reward block in bytes. - `timestamp`: `QUANTITY` - the unix timestamp for when the block was collated. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_rewardSnailBlock", "params":[],"id":100}' // Result { "jsonrpc": "2.0", "id": 100, "result": { "beginFruitNumber": "0x193a0", "difficulty": "0x2710", "endFruitNumber": "0x193db", "extraData": "0xd9820a018667657472756588676f312e31302e38856c696e7578", "fastNumber": 0, "fruitDifficulty": "0x64", "fruitHash": "0x7dad8df99080412919a4e0018c980e6bf40e64bff5e09f0ec45efd63530ed95e", "fruits": ["0x421cf9aa22145c141d3235a5b19c73d10613cc782221f279c3a136f136ac811e", "0xb6fdad4a0287102adba3b5bbe9789598694c028491de7c459f47248ee1844132", "0xa784a38af019ea321c725bf6b6ed61398bb86d4b20289c0a6ef54a20eced554c", "0x8fe6337b88ee4f19514670d49f5a64e736edfd7ae8c34fecc6d54ce923325991", "0x9dcbc81a1e764f6c0a6591e72000776dad6752be2d9c65b77a2157bc88a65333", "0x5cbac30e3a8d3246bbb84b570aecfa69b1d364738e4223fa17fe047b307ed7f2", "0x75115e8cdcfba043c57c2a10c6e781ab582f85b2e715cbacc42e3d2f96bc7cac", "0x08fe101b8ef2304965b5008267ee321ddbc48b1fd210b4dff81441e9c57f2e0f", "0xe31577b98c384074b37ad1d9cad88d31483b152ed96106e17f9864ded8052f62", "0xce3f340eb5c0582e82f5f9c550373ba069af140b50eabaf7a044717eada32536", "0x879f73afc3cb734dd9b5b7fe7687b6f8d6a5b8e7d20c4f730dbd0f84590ac0de", "0xd0c3c2c31f6b19c618c709968624ca02b23341b01178f9de23b43a406755c93e", "0xaa1285332874bd67c7b37b7b81f66e0b3fe6b38b176d22a0ee0349ef3120f9c4", "0xaed6ff91f2f1de5fcd7880797b841c61458bd59fe3f4bd4e80823d99a555049f", "0x46e8303c548f82e59741ee94ced70a0df1500abef9d667f131a39e71b9aaff0c", "0xedc6d3a94624bd914435119493c5d73545c854385758e86cb1b2c6445de7a6d4", "0x46a42a82461c5b92ef7ecf86c6d84dd8a7abeddd72a444467c109da53de26f10", "0xf23a03a1698426280449512bf19f731c56051cd19d04976009d7d2e03d6294a4", "0x4f2b30f026d64d56ec8d0fc69ef0959bbceeff648eafe8ff3c711af4d0f796eb", "0xbcfd45ccd7456fdb5dc3d19a2bd65f4b37530e4772fb6a6364376df3dee8b883", "0x3c1ce1153fc784870812be53f89c549063c5056d653db16621232582b6fe51f7", "0x8dfbb789f49ff07237c5650fa166d7adf9a2ff5b0ee967e510686a0df24b5e6e", "0x06aef81bc2b5d914fc553dad79a83dc0660c33c75448e62129b1da8443a3e704", "0xf291e642625bf18ddc03eb2c6287dea900457bcf8102834c26fb08438eb5d434", "0x73bb8bc367a789ce6e69ef4e21ffec76e103d36a85a01a460bd268a1ceec992a", "0x364c55068a8341db5e3ecc6fa6cc328e1b038d9a567b85fb3e470d8ee12a2fd8", "0x460e5ddc879c9da6090296d04fc522fcfc4341566856c0e4b81a6ee459922c06", "0x0f17e693874809172d889bd813ed4e825fdc4436d4c97bc48725b924ab612ce5", "0xca07ab5afbdc766247276e3641df8206cc89ca00660f3d72ceac86b1e192652a", "0x96027060b71fb9b758131b70c481c2e5f916bb821fa7295a834080c89698dbe1", "0xb9ed69d03aa2a80e358950b82fbd083fbef5069b6b8f2488cd74d70260b5de9b", "0x71c0249266f922677eab708b5de86fe1f057b6b39ad6dcd05230de89a0021eba", "0xbcb6f37b63558db10bedab0f722e34341a6329f57248e00606fe184613468c5c", "0x08eb945b49599aa7903bac856f5f5bb9d260bc1c2c553b2ab9d69a8611c4c935", "0xcac5bb4daec7f138cb820e5fd4b958184c9e724d4879662f4422df0230aadb14", "0xd29c761ec3504ae091998c2acbc3e739635d99e0764a7f521021a8ae7c068c36", "0xe5de172346d9d1f423a09726ca6e992725986c54bf2818ba537d341ba63ebf19", "0x337f7834016004bfa59869cfc357035dbc8128b340ed062e7a30a93bee2ac3fb", "0xf0f6790614751991e9d04548c7a81b0ef28aff686a704e4cfbfe1de01e6fce9e", "0x502e04348f225907f8528d9196c7113bd3c15d3080c1c1718c85c8cc073ea7bb", "0x663bf65f7e766082cfb84ab2d9303f9c078e2819eb2197d6f6318dafc55cfa98", "0x282b563050f940059986b4745345f14ce6d7e96b7160ead7a27985ce99aeae9b", "0x1459d9bb5939fe563d6d9502e28184d5c4619c10d0e0f6699b746daf4c1b0400", "0xc7d3fff73e954042d5bd91107252ff3986c9c756869c0484954d82831dfbfb28", "0x0cb9e8929bf625b0916879359fc617ce0b4e7f474df5cf53414d2075e8668cca", "0x9b8715bf3090fdf115ae675bf4692e5dc3e8453b126fd729ddfabbfaed11aa66", "0x69668b51d76ce1ab186158f05ef8d92394803b9f0c3e508d18d39fe45f2e25d4", "0x972f4e2f865c5e00f377418a2a0469e3abd3c1b64b2cdd803904dd33a9bfc7a0", "0x3ccb10a6a69fcfe8da544bddfcadf6be6a295dd4b38ab5ba0f9e8aa36f4188fd", "0x4098d83b4e8f506c7b85560a8e84017f845b1083b864e3975208ece07f98074f", "0xec6edff7cd40f0bc41b1ed6a129e88bec38cd6474f130363cd6dccc31d49a717", "0xa89aa9e24a3f0926bbbfc4c8a80ed872f58963f83d7d99b13f169463783f4e52", "0x07bb236e22e0d322d962bb28f329aed7ce8e9c460215d8700826a5faa777ccac", "0xf87aa14c01ee28584632c6db9b1667d27c8d0c0eb947d286318641e549dd3c1c", "0x2aeb9798bade7ece9a6fc803e9fb7359c14cb6c27dd986a27e8b20639dda5377", "0x07858381ad1ab29ac5a0f34fd78420cffa494c0dbb9bca64c1bff28075ba490b", "0x121d18d6770575a34480a8ddc268e87438e424d721d1b76c84cb60297d0a7156", "0xc54357b750662ef429845acfeacf482cffa4b253373e05199da3e01301823572", "0xe1bcd60bafc03acbcc8c8c6b454af4ecc1171cbc7d9ab4ed1e321bab82308af8", "0x7917615f4519f7160de4ac556c8de805ce8bc464e5784642cc937e000512ad0f"], "hash": "0xb913521609feef2b7cc351efe0d0b359796c709176e8824622bc6dee312a227f", "miner": "0x7c357530174275dd30e46319b89f71186256e4f7", "mixHash": "0x0000b9b5b60cbaa58a008425f70c3e610794e9eb9ffa7e8c9ab257c451afcc22", "nonce": "0x279486ec07bf61d6", "number": "0x6b4", "parentHash": "0xa24c81127edb0a630b13205b498d8ef0f7d47a4678e96827f8f19ffd2c470a24", "pointerNumber": 1708, "size": "0x101bb", "timestamp": "0x5c9194ec" } } ``` *** #### etrue_snailBlockNumber get current snail block number ##### Parameters none ##### Returns QUANTITY - integer of the current snail block number. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_snailBlockNumber", "params":[],"id":100}' // Result { "id":100, "jsonrpc":"2.0", "result": "0x38" } ``` *** #### etrue_getCommittee get committee member infomation ##### Parameters ```js params: ["0x1"] ``` ##### Returns - `backups`: `Array` - Array of backup committee members, each committee member info contains pubkey、 coinbase、flag、type. - `beginNumber`: `QUANTITY` - the begin fast block number. - `beginSnailNumber`: `QUANTITY` - the begin snail block number. - `endNumber`: `QUANTITY` - the end fast block number. - `endSnailNumber`: `QUANTITY` - the end snail block number. - `id`: `QUANTITY` - committeeId. - `memberCount`: `QUANTITY` - the number of committee members . - `members`: `Array` - Array of committee members. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_getCommittee", "params":["0x1"],"id":100}' // Result { "jsonrpc": "2.0", "id": 100, "result": { "backups": [{ "PKey": "0488a25849abee5921fdb581ba34cd66adc8e02b108391c4153ca8da27722e16badf4fcd5ba7f557ae76d444ccf3638e4590a181805623de1cab67f31364c79736", "coinbase": "0x76ea2f3a002431fede1141b660dbb75c26ba6d97", "flag": 160, "type": 161 }, { "PKey": "04a9a1cedb8900d893b607c4dbc834abada3fe98f247b8bcb5ef44d3d3a246c4cf41d9d792527473c30ded81fa4b81afe7030a09e093dd92746b98c79e6a204c63", "coinbase": "0x831151b7eb8e650dc442cd623fbc6ae20279df85", "flag": 160, "type": 161 }, { "PKey": "040d153624462927444a8212717e4ad41ec5f5739bc36598d093d114729e1dc782d55d322699705829cf9d69f201009db797ebe8ba952f10a26fe36c64356b111b", "coinbase": "0x1074f7deccf8c66efcd0106e034d3356b7db3f2c", "flag": 160, "type": 161 }, { "PKey": "04a3474c26578fce00d241119758271f6a208cc987c6f37d1518dcea2a51257bafeebd93202ae499cb5a8986720d4b63a04043aadb4d03430194a81860c9ca0763", "coinbase": "0xd985e9871d1be109af5a7f6407b1d6b686901fff", "flag": 160, "type": 161 }, { "PKey": "04a3e174523b1054e14f123580bce258745e65591c2a4ee44764e55eb87a3782c9920d306e6121d4f10f8726800497ad9ca5a0bfdfe0832779dbaf7b95b3bf0111", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 160, "type": 161 }, { "PKey": "04d370defb1b7b8c086f98c4a7d7b90348b088cd2effdcc27b86feebdff499a192b4a5a5b16a400625271d69b3fa7d8c42c8b2e15c910cd1f314f28eb5beb73342", "coinbase": "0x4cf807958b9f6d9fd9331397d7a89a079ef43288", "flag": 160, "type": 161 }, { "PKey": "04f67ab0cd48f626da89c718bcd909a04dea393d632d3191891539ef2f5ff6bb1e5d340ebe94cb6d9126b26e1ec64bb4783e9e8ddf31346b53d651d15eb226142e", "coinbase": "0x04d2252a3e0ca7c2aa81247ca33060855a34a808", "flag": 160, "type": 161 }], "beginNumber": 19781, "beginSnailNumber": 1, "endNumber": 30725, "endSnailNumber": 168, "id": 1, "memberCount": 21, "members": [{ "PKey": "04ad2da6433f25f5063c98fb414496bd794f3054544408a63da4c6488a35a7c7ba38e8dbae49356182dcd81f45a715feb1f7f696c3a1bd77e33ab8ab41d8177ca3", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "04eb9577ae8e19d99f708b8d46de17220afaf2d4a89676d98c8e8558e4e10f0283733a6a4a47aee779081cedd9266d5b4edcfc4fa22a4d69e3da98f6a03ad4e372", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "0497413104d718ef592fa4526e796be092a143272f9c7b415c23c73201a9cf3da2ec928e11958246ee2f8e838ec67506e798c4e8fcec89f5e8c9696235f600e765", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "04dc2a2cba3793da755d28f02336193a8e04c77cb3fdef5f04a4197c71f59f978767729ff652267e4c0fc9204c7e921931c207e32ba442ac27a20acaad49324696", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "047a523df31438d3efc02c4126b891d5e1258371336decfe43a15efcb519607aa2b932f895808f4414f75b525d7a490e10be314a6b60971c7149156b9d659fb591", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "04ea62525863113273df44d8b5bbbcf0c1df5d03b94dd60308b747c1894af70dd5eaf5facfb1577bb4416ba517375ce662769f69b0c5fa961ac0cd9a4a342e4f67", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "04601fc9ac609d9d47d01f76bcdf496a1b3d2aaf9dc4c97319faff49e2284ad843aa5505343376db1357b9cc0d176fe828d7a07cc8cd0993aee3b76d77eda2be4b", "coinbase": "0x4cf807958b9f6d9fd9331397d7a89a079ef43288", "flag": 161, "type": 162 }, { "PKey": "04b64ba599ff0e0c2418357f87ed6058f04801ce0e0f653e336aa2f0b9c9620b1ed9222648100d7cadfbbe2cadb66b94e66eeed80b0a96da7808bc55fd8dd282a2", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "044aa7cef6d282ec22e0ef6d55d36b17d607afee920668320430717552cd7d4905e07d92a0e939f96ef6d617174a136267ed6a4efcc14879abe6aa097965fb4740", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "04506b3c55ac57f78b41b2e47afc8d0f8d9891803822bbc4fe35bf3be72ad91056b0aae8a5fa76309f093987202a284c67d5918ca23a31e2e6535255c58240bf59", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "04a69c470e1b4ea2a05d8a70de7c15687131bbb66105049a5bbdb04645381a29899ec72af7929c645ec0d29a91b4359de2629618b763a333d52bb4f436cccf9a9d", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "046e61555ed9bd6bb08b3f5034373bfc4472a8ca8868d21e1ceb4fe3f24c42c3a5dc7cb492ca62a31bfa6c82f86fed02dfa23196c25a76673ddb7a1f3f6eaafc84", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "04eb4c070000b1c4525e42d2cf61a0f1449ef82ce534a19ff03cf8c2a480d16e9738f5162972e15262992eb21cf561b7bae2e49e9dc8eb2b8f52dd9100f2bdce4e", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }, { "PKey": "047fc0ae115cadf26b472ed4bed8785ca535c9fe53eb896bd21d7d7d7e1ee242881c50fa5eeaba4465e1992d5b917ae1f891c1e85e0bb5e0201e885886e846102b", "coinbase": "0x7c357530174275dd30e46319b89f71186256e4f7", "flag": 161, "type": 162 }] } } ``` *** #### etrue_getFruitByNumber get fruit block by fruit number ##### Parameters 1. `QUANTITY` - integer of the fruit number. 2. `Boolean` - if contais fruit signs of committee member. ##### Example Parameters ```js params: [ "0x1", false ] ``` ##### Returns `Object` - A fruit object, or `null` when no fruit was found: - `difficulty`: `QUANTITY` - integer of the difficulty for this snail reward block. - `extraData`: `DATA` - the "extra data" field of this reward block. - `fastHash`: `DATA`, 32 Bytes - hash of the fruit. - `fastNumber`: `QUANTITY` - fruit. - `fruitDifficulty`: `QUANTITY` - integer of all fruit difficulty for the fruit. - `hash`: `DATA`, 32 Bytes - hash of the fruit. - `miner`: `DATA`, 20 Bytes - the address of the beneficiary to whom the mining rewards were given. - `mixHash`: `DATA`, 32 Bytes - the mix digest. - `nonce`: `QUANTITY` - the mining nonce. - `number`: `QUANTITY` - the fruit number. - `size`: `QUANTITY` - integer the size of the fruit in bytes. - `timestamp`: `QUANTITY` - the unix timestamp for when the fruit was collated. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_getFruitByNumber", "params":["0x1",false],"id":100}' // Result { "jsonrpc": "2.0", "id": 100, "result": { "difficulty": "0x4e20", "extraData": "0xd9820a008667657472756588676f312e31302e38856c696e7578", "fastHash": "0x190c33741f18c86ac9b3b3e1102e35c95a354cb6c9214ccc1f0fa28f950840b5", "fastNumber": 1, "fruitDifficulty": "0x64", "hash": "0xd5d8719f456a59249570bb7adf9e37c7d2e30621fbc0aab8ee2817bf591e3acc", "miner": "0x7c357530174275dd30e46319b89f71186256e4f7", "mixHash": "0xb01e70ab492dcede93395389b9193201011e950f181180f78ad98ae58184601d", "nonce": "0x033aebb6a27a911a", "number": 1, "signs": 5, "size": 865, "timestamp": "0x5c87b12a" } } ``` *** #### etrue_getFruitByHash get fruit block by fruit hash ##### Parameters 1. `DATA`, 32 Bytes - hash of fast block. 2. `Boolean` - if contais fruit signs of committee member. ##### Example Parameters ```js params: [ "0x190c33741f18c86ac9b3b3e1102e35c95a354cb6c9214ccc1f0fa28f950840b5", false ] ``` ##### Returns See [etrue_getFruitByNumber](#etrue_getFruitByNumber) ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_getFruitByHash", "params":["0x190c33741f18c86ac9b3b3e1102e35c95a354cb6c9214ccc1f0fa28f950840b5",false],"id":100}' ``` // Result See [etrue_getFruitByNumber](#etrue_getFruitByNumber) *** #### etrue_getRewardBlock return the fast block position where the given snail block is rewarded ##### Parameters 1. `QUANTITY` - integer of the snail reward block number ##### Example Parameters ```js params: [ "0x15" ] ``` ##### Returns `Object` - A fast block object, or `null` when no snail reward block was found: - `CommitteeHash`: `DATA`, 32 Bytes - hash of committee members. - `snailHash`: `DATA`, 32 Bytes - hash of the snail reward block. - `snailNumber`: `QUANTITY` - the reward snail number. - `extraData`: `DATA` - the "extra data" field of fast block. - `gasLimit`: `QUANTITY` - the maximum gas allowed in fast block. - `gasUsed`: `QUANTITY` - the maximum gas allowed in fast block. - `hash`: `DATA`, 32 Bytes - hash of the fast block. - `logsBloom`: `DATA`, 256 Bytes - the bloom filter for the logs of the block. `null` when its pending block. - `number`: `QUANTITY` - the fast block number. - `parentHash`: `DATA`, 32 Bytes - hash of the parent block. - `receiptsRoot`: `DATA`, 32 Bytes - the root of the receipts trie of the fast block. - `signs`: `Array` - Array of each committee member sign. - `size`: `QUANTITY` - integer the size of the fast block in bytes. - `stateRoot`: `DATA`, 32 Bytes - the root of the final state trie of the fast block. - `switchInfos`: `Array`, - Array of switch committee member. - `timestamp`: `QUANTITY` - the unix timestamp for when the fast block was collated. - `transactions`: `Array` - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter. - `transactionsRoot`: `DATA`, 32 Bytes - the root of the transaction trie of the fast block. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_getRewardBlock", "params":["0x15"],"id":100}' // Result { "jsonrpc": "2.0", "id": 100, "result": { "CommitteeHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", "SnailHash": "0xeae9f91963eb64f0ca6e5bcf8551d8efd0d1c7f8d5ff207856c303faef86e419", "SnailNumber": 21, "extraData": "0x", "gasLimit": "0x4b99999", "gasUsed": "0x668a0", "hash": "0x5cc873dd449c7c15676211d8adf334da8e46b65cfa336e638678fbe4bc05ae5b", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "number": "0x7e5", "parentHash": "0x3f1105c6fa853944a84fe9ef7eefcc2bcbb08860c302aed652c773d1bbc0b2f0", "receiptsRoot": "0x824c56f642d67e881555ec142168cc2364a1343129e34044dea382088cb5fa42", "signs": [{ "fastHash": "0x5cc873dd449c7c15676211d8adf334da8e46b65cfa336e638678fbe4bc05ae5b", "fastHeight": "0x7e5", "result": 1, "sign": "0x763026fef783d8bfdf4b06309a1aafbebce229e846383131dc430c6c29ff42bd033d3719f4c70e96bd5a80e46a9a67d2f647fbc7c2e0a7b32c0cf8824feca29300" }, { "fastHash": "0x5cc873dd449c7c15676211d8adf334da8e46b65cfa336e638678fbe4bc05ae5b", "fastHeight": "0x7e5", "result": 1, "sign": "0x4c11748616eda54ca216fc8fd28957459c629caea7967e73f23ac02419e9dfba4650b7cbfd3fd9a0f4737724234941c98fa9a6ad00ffd3f860e9dd5be5ac366c00" }, { "fastHash": "0x5cc873dd449c7c15676211d8adf334da8e46b65cfa336e638678fbe4bc05ae5b", "fastHeight": "0x7e5", "result": 1, "sign": "0x86d689580eac3ce23453dec705ed8cd5c0ed992d0a4296ebea4bc5373f90bb1a56fbc121d6146f4c7ac6416e74b5a876012e25497dd70402b3461c13c9475a2800" }, { "fastHash": "0x5cc873dd449c7c15676211d8adf334da8e46b65cfa336e638678fbe4bc05ae5b", "fastHeight": "0x7e5", "result": 1, "sign": "0xaa1d76682f8ce81fa449819a6921808010114d4433945da40d323d5d8f57ebac78fc7096fbf0307dcdac5e8c9e6b2be80aa3959a6e6304d85d7a534e0e2714cc00" }, { "fastHash": "0x5cc873dd449c7c15676211d8adf334da8e46b65cfa336e638678fbe4bc05ae5b", "fastHeight": "0x7e5", "result": 1, "sign": "0x90b4ce8a7a13d070d9b360173e1c96dd7d95c33e7f7689187117dafae46393a8764ce36db25881fcbf82ba692b18eb2450aa2f69667391e6c55025d9f6704d1701" }], "size": "0xca7", "stateRoot": "0xc422d6752c0aa8e0a773ddd5b12950f3c30361ce7320c6fa59eb77c9f36ca07e", "switchInfos": [], "timestamp": "0x5c87bf4c", "transactions": ["0xee311d9a6e95b0740488a8c797fc36b0ddbba97005c8623d0c8258509ad0e34b", "0x9be94692e83f76fbf8a9ff7a4b9caa83141bf5c7bd91b768669802b18357146c", "0x167c29e6b6278a999c0debe02b51407cbe9f23e701f53fa2c80e141ab42f8cd4", "0x481f16a6866ce56774c5a14bfbf9a19391868761d09403acaea4d9a74fe33bd7", "0x133457504d0c23f84b58b9f82aae15012b48c5bcb5fcff904d795fe78de1ce88", "0xff98231ecd6b0358d15eec72ebb8920ed5312c30305fb21845485316b1cf8ddd", "0x3282ec6633cb743a2e177f0a999b1f366bcf900069c33c40a4a1c3b7b4fc5ed6", "0x897e1b6226666a5c031bf528527e68efb63a7d3c4b6431d758858c554a3cf38a", "0x034bf45b679a2283deec9c3c514b0dfe6dc1ab4980864ceeafd9989bd56410f0", "0x129bc008bcae647a55d900068ae657e3f9073a37d03933d149ba529abd15c63c", "0xc5831516e417510b6f4069093c8845de24e62a1adee409c35164b8b6cf26465d", "0xb0ef3a7209af20990b2e346dc7f963d11e0da3a42ae04640502b81e30ac96202", "0x8c79698e30cbd7c50781eaa6077667428cf51027086762d9349ee9987d9ebe36", "0xf48839d7212c9d01684237131f68f81a30fe6635eb39b0030bab3e68c75bbefa", "0x94aff39d085551389a198378137e5dd694ce689e5ad326910f18f167ff81f16c", "0x882c79c2678a0fc0099bca068ca05bb239405c8a2f363a3b755b4049c67f41c7", "0xaa5855c69051b82716bdc9b7f9190ef06c06411d0d43d8786fbf14a3898446a6", "0x508b4357b911624c11bb5a90d880c86ed92f5f430454f64b6e63ea884cec0589", "0x652a73ec17dab453db88a9e292bf684a814101d7013a489fbbae98ed9c221f03", "0xa95cbff42440d0a000ad55969f95fc5b5ff947efd95dbb0f9607acf849dbfbd9"], "transactionsRoot": "0xcfcce7b64115b9086a78c0449ceb70aac9b08c0d221943470ffacbbdc71fba9a" } } ``` *** #### etrue_getSnailBlockByNumber get snail block by number ##### Parameters 1. `QUANTITY` - integer of the snail block number,or the string `"latest"`, `"earliest"` or `"pending"`, see the [default block parameter](#the-default-block-parameter) 2. `Boolean` - whether show fruits in snail block ##### Example Parameters ```js params: [ "0x19", false ] ``` ##### Returns `Object` - A snail block object, or `null` when no snail block was found: - `beginFruitNumber`: `QUANTITY` - the beign fruit number in snail reward block. - `difficulty`: `QUANTITY` - integer of the difficulty for this snail reward block. - `endFruitNumber`: `QUANTITY` - the end fruit number in snail reward block. - `extraData`: `DATA` - the "extra data" field of this reward block. - `fastNumber`: `QUANTITY` - default 0. - `fruitDifficulty`: `QUANTITY` - integer of all fruit difficulty for this snail reward block. - `fruitHash`: `DATA`, 32 Bytes - hash of fruits in snail reward block. - `fruits`: `Array` - Array of all hash of fruits in snail reward block. - `hash`: `DATA`, 32 Bytes - hash of the snail reward block. - `miner`: `DATA`, 20 Bytes - the address of the beneficiary to whom the mining rewards were given. - `mixHash`: `DATA`, 32 Bytes - the mix digest. - `nonce`: `QUANTITY` - the mining nonce. - `number`: `QUANTITY` - the snail block number. - `parentHash`: `DATA`, 32 Bytes - hash of the parent block. - `pointerNumber`: `QUANTITY` - current snail reward block minus 7. - `size`: `QUANTITY` - integer the size of this reward block in bytes. - `timestamp`: `QUANTITY` - the unix timestamp for when the block was collated. ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_getSnailBlockByNumber", "params":["0x19",false],"id":100}' // Result { "jsonrpc": "2.0", "id": 100, "result": { "beginFruitNumber": "0x5a9", "difficulty": "0x9e86", "endFruitNumber": "0x5e4", "extraData": "0xd9820a008667657472756588676f312e31302e38856c696e7578", "fastNumber": 0, "fruitDifficulty": "0x64", "fruitHash": "0x02c44355f9aa43305f7507efd77ab13a74b0a7bde1d923ac62135e8e3bfe4afd", "fruits": 60, "hash": "0x6fd8a5f62ec65a6f244be17a32605c705736ed960130bad87b79730312d77741", "miner": "0x7c357530174275dd30e46319b89f71186256e4f7", "mixHash": "0x000122785a555ca6b63c54e1ff398cf5ae9f6176391de526a7d3a9277b13cfaf", "nonce": "0x719c13f20436b852", "number": "0x19", "parentHash": "0x1d2361639c4b26f9481caf680e6db21af1c8d9159f804b01a37611a1e057487a", "pointerNumber": 17, "size": "0xcee1", "timestamp": "0x5c87bbcf" } } ``` *** #### etrue_getSnailBlockByHash get snail block by hash ##### Parameters 1. `DATA`, 32 Bytes - hash of snail block . 2. `Boolean` - if contais fruit signs of committee member. ##### Example Parameters ```js params: [ "0x6fd8a5f62ec65a6f244be17a32605c705736ed960130bad87b79730312d77741", false ] ``` ##### Returns See [etrue_getSnailBlockByNumber](#etrue_getSnailBlockByNumber) ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_getSnailBlockByHash", "params":["0x6fd8a5f62ec65a6f244be17a32605c705736ed960130bad87b79730312d77741",false],"id":100}' ``` // Result See [etrue_getSnailBlockByNumber](#etrue_getSnailBlockByNumber) *** #### etrue_getDataset the Minverva algorithm calculates the required source of dataset, and updates the dataset every 12,000 ##### Parameters none ##### Returns [null,null,null,null,null,null....,null]. -when snailBlock number exceed 12000, return not nil ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_getDataset", "params":[],"id":100}' // Result { "jsonrpc": "2.0", "id": 100, "result": { [null, null, null, null, ......, null, null] } } ``` *** #### etrue_getSnailRewardContent get snailBlock reward imfomation, including snailBlock miner,fruit miner and committee reward for each fruit ##### Parameters 1. `QUANTITY` - integer of a block number. ##### Returns - `blockminer`: -snailblock miner address and reward - `committeReward`: -committee member address and reward for all fruit - `fruitminer`: -fruit miner address and reward for each fruit ##### Example ```js // Request curl -X POST --data '{"jsonrpc":"2.0", "method":"etrue_getSnailRewardContent", "params":["0x1"],"id":100}' // Result { "jsonrpc": "2.0", "id": 100, "result": { "blockminer": { "0x7c357530174275dd30e46319b89f71186256e4f7": 61629629629629000000 }, "committeReward": { "0x7c357530174275dd30e46319b89f71186256e4f7": 23111111111110999785 }, "fruitminer": [{ "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }, { "0x7c357530174275dd30e46319b89f71186256e4f7": 446591519055275362 }] } } ``` ## Eth In order for more developers to participate in the truechain ecosystem and be friendly to developers, truechain is compatible with ethereum. Please refer to the instructions of [ethereum](https://github.com/ethereum/wiki/wiki/JSON-RPC) for detailed rules of use