Skip to content

Latest commit

 

History

History
2926 lines (2420 loc) · 85.3 KB

jsonrpc_apis.md

File metadata and controls

2926 lines (2420 loc) · 85.3 KB

API reference (JSON-RPC)

this is the document of ela json rpc interfaces. it follows json-rpc 2.0 protocol but also keeps compatible with 1.0 version. That means both named params and positional params are acceptable.

"id" is optional, which will be sent back in the result samely if you add it in a request. It is needed when you want to distinguish different requests.

"jsonrpc" is optional. It tells which version this request uses. In version 2.0 it is required, while in version 1.0 it does not exist.

getbestblockhash

Return the hash of the most recent block

result:

name type description
blockhash string the hash of the most recent block

Example

Request:

{
  "jsonrpc": "2.0",
  "method":"getbestblockhash",
  "params": [],
  "id": 1
}

Response:

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "68692d63a8bfc8887553b97f99f09e523d34a2b599bf5b388436b2ddc85ed76e",
  "error": null
}

getblockhash

Return the hash of the specific blockchain height.

Parameter

name type description
height integer the height of blockchain

Result

name type description
blockhash string the hash of the block

Example

Request:

{
  "method":"getblockhash",
  "params":{"height":1}
}

Response:

{
  "id": null,
  "jsonrpc": "2.0",
  "result": "3893390c9fe372eab5b356a02c54d3baa41fc48918bbddfbac78cf48564d9d72",
  "error": null
}

getblock

Return the block information of the specific blockchain hash.

Parameter

name type description
blockhash string the blockchain hash
verbosity int the verbosity of result, can be 0, 1, 2

Example

Request:

{
  "method":"getblock",
  "params":{
  	"blockhash":"f3a7469bb59452ab665f8b8870e1fb30e6a7181e2ea70f377e218d5b13cfa8ed", 
  	"verbosity": 0},
}

Response when verbosity is 0:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": "00000000c0433b918f500392869aa14cf7a909430fd94502b5c9f05421c9da7519bd6a65219184ea3c0a2973b90b8402c8405b76d7fbe10a268f6de7e4f48e93f5d03df7c31e095bffff7f2000000000d107000001000000010000000000000000000000000000000000000000000000000000000000000000000000002cfabe6d6d3ca6bcc86bada4642fea709731f1653bd34b28ab15b790e102e14e0d7bd138d80100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000000000000000000000000000000000000000000000ce39baabcdbb4adce38c5f23314c5f63a536bbcc8f0a47c7054c36ca27f5acd771d095b00000000020000000101000000000403454c4101000846444170b0e427d2010000000000000000000000000000000000000000000000000000000000000000ffffffffffff02b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a31b2913000000000000000000129e9cf1c5f336fcf3a6c954444ed482c5d916e506b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a341b52c000000000000000000219e9cc4320c3018ced30242b25c03e13a1b2f57c7d107000000"
}

Response when verbosity is 1:

name type description
hash string the blockchain hash
confirmations integer confirmations
size integer the size of a block in bytes
strippedsize integer equals to size
weight integer This block’s weight
height integer the height of block
version integer block header's version
versionhex string block header's version in hex format
merkleroot string the merkleroot hash of this block
tx array[string] transaction hashes of this block, in an array
time integer the Unix timestamp of this block
mediantime integer equals to time
nonce integer the nonce of this block
bits integer bits of this block
difficulty string difficulty of this block
chainwork string The estimated number of block header hashes miners had to check from the genesis block to this block, encoded as big-endian hex
previousblockhash string previous block hash
nextblockhash string next block hash
auxpow string Auxpow information in hex format
{
  "id": null,
  "error": null,
  "jsonrpc": "2.0",
  "result": {
    "hash": "3893390c9fe372eab5b356a02c54d3baa41fc48918bbddfbac78cf48564d9d72",
    "confirmations": 5156,
    "strippedsize": 498,
    "size": 498,
    "weight": 1992,
    "height": 1,
    "version": 0,
    "versionhex": "00000000",
    "merkleroot": "764691821f937fd566bcf533611a5e5b193008ea1ba1396f67b7b0da22717c02",
    "tx": [
      "764691821f937fd566bcf533611a5e5b193008ea1ba1396f67b7b0da22717c02"
    ],
    "time": 1524737598,
    "mediantime": 1524737598,
    "nonce": 0,
    "bits": 545259519,
    "difficulty": "1",
    "chainwork": "00001423",
    "previousblockhash": "8d7014f2f941caa1972c8033b2f0a860ec8d4938b12bae2c62512852a558f405",
    "nextblockhash": "aa98305779686e66294a9b667e6ac77f5231bb2ce09fe7d9ca641775413ecb5a",
    "auxpow": "01000000010000000000000000000000000000000000000000000000000000000000000000000000002cfabe6d6d3893390c9fe372eab5b356a02c54d3baa41fc48918bbddfbac78cf48564d9d720100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff7f0000000000000000000000000000000000000000000000000000000000000000a19035123a440356c0a41a85fe26865620fb4c34dcf1b83b46b5e11efcbbdd893ea6e15a0000000000000000"
  }
}

Response when verbosity is 2:

result format except 'tx' is the same as it is when verbosity=1

result format in 'tx' please see interface 'getrawtransaction'

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": {
    "hash": "3ca6bcc86bada4642fea709731f1653bd34b28ab15b790e102e14e0d7bd138d8",
    "confirmations": 1,
    "strippedsize": 498,
    "size": 498,
    "weight": 1992,
    "height": 2001,
    "version": 0,
    "versionhex": "00000000",
    "merkleroot": "219184ea3c0a2973b90b8402c8405b76d7fbe10a268f6de7e4f48e93f5d03df7",
    "tx": [
      {
        "txid": "219184ea3c0a2973b90b8402c8405b76d7fbe10a268f6de7e4f48e93f5d03df7",
        "hash": "219184ea3c0a2973b90b8402c8405b76d7fbe10a268f6de7e4f48e93f5d03df7",
        "size": 192,
        "vsize": 192,
        "version": 0,
        "locktime": 2001,
        "vin": [
          {
            "txid": "0000000000000000000000000000000000000000000000000000000000000000",
            "vout": 65535,
            "sequence": 4294967295
          }
        ],
        "vout": [
          {
            "value": "0.01255707",
            "n": 0,
            "address": "8VYXVxKKSAxkmRrfmGpQR2Kc66XhG6m3ta",
            "assetid": "b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a3",
            "outputlock": 0
          },
          {
            "value": "0.02929985",
            "n": 1,
            "address": "EXca4DJwqCXa6vbJmpovwatHiP8HRTVS1Z",
            "assetid": "b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a3",
            "outputlock": 0
          }
        ],
        "blockhash": "3ca6bcc86bada4642fea709731f1653bd34b28ab15b790e102e14e0d7bd138d8",
        "confirmations": 1,
        "time": 1527324355,
        "blocktime": 1527324355,
        "type": 0,
        "payloadversion": 4,
        "payload": {
          "CoinbaseData": "ELA"
        },
        "attributes": [
          {
            "usage": 0,
            "data": "46444170b0e427d2"
          }
        ],
        "programs": []
      }
    ],
    "time": 1527324355,
    "mediantime": 1527324355,
    "nonce": 0,
    "bits": 545259519,
    "difficulty": "1",
    "chainwork": "00000000",
    "previousblockhash": "c0433b918f500392869aa14cf7a909430fd94502b5c9f05421c9da7519bd6a65",
    "nextblockhash": "0000000000000000000000000000000000000000000000000000000000000000",
    "auxpow": "01000000010000000000000000000000000000000000000000000000000000000000000000000000002cfabe6d6d3ca6bcc86bada4642fea709731f1653bd34b28ab15b790e102e14e0d7bd138d80100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffff7f00000000000000000000000000000000000000000000000000000000000000000ce39baabcdbb4adce38c5f23314c5f63a536bbcc8f0a47c7054c36ca27f5acd771d095b0000000002000000"
  }
}

getblockcount

Get block count

Example

Request:

{
  "method":"getblockcount"
}

Response:

{
  "jsonrpc": "2.0",
  "id": null,
  "error": null,
  "result": 171454
}

getrawtransaction

Get transaction infomation of given transaction hash.

Parameter

name type description
txid string transaction hash
verbose bool verbose of result

Results

name type description
txid string transaction id
hash string transaction id
size integer transaction size
vsize integer The virtual transaction size, equals to size
version integer The transaction format version number
locktime integer The transaction’s locktime
sequence integer The transaction’s sequence number
vin array input utxo vector of this transaction
n integer index of utxo outputs
vout array output utxo vector of this transaction
assetid string asset id
outputlock string outputlock of this transaction

Example

Request:

{
  "method": "getrawtransaction",
  "params": ["caa0d52ea2b90a08480834b97c271a8b847aadf90057318a33ccc8674b77c796"]
}

Response when verbosity is ture:

{
  "id": null,
  "error": null,
  "jsonrpc": "2.0",
  "result": {
    "txid": "6864bbf52a3e140d40f1d707bae31d006265efc54dcb58e34037645060ce3e16",
    "hash": "6864bbf52a3e140d40f1d707bae31d006265efc54dcb58e34037645060ce3e16",
    "size": 192,
    "vsize": 192,
    "version": 0,
    "locktime": 1000,
    "vin": [
      {
        "txid": "0000000000000000000000000000000000000000000000000000000000000000",
        "vout": 65535,
        "sequence": 4294967295
      }
    ],
    "vout": [
      {
        "value": "0.01255707",
        "n": 0,
        "address": "8VYXVxKKSAxkmRrfmGpQR2Kc66XhG6m3ta",
        "assetid": "b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a3",
        "outputlock": 0
      },
      {
        "value": "0.02929985",
        "n": 1,
        "address": "ENTogr92671PKrMmtWo3RLiYXfBTXUe13Z",
        "assetid": "b037db964a231458d2d6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a3",
        "outputlock": 0
      }
    ],
    "blockhash": "0000000000000000000000000000000000000000000000000000000000000000",
    "confirmations": 4158,
    "time": 1524737766,
    "blocktime": 1524737766,
    "type": 0,
    "payloadversion": 4,
    "payload": {
      "CoinbaseData": "ELA"
    },
    "attributes": [
      {
        "usage": 0,
        "data": "b52165c186769037"
      }
    ],
    "programs": []
  }
}

Response when verbosity is false:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": "000403454c4101000846444170b0e427d2010000000000000000000000000000000000000000000000000000000000000000ffffffffffff02b037db964a231458d2d  6ffd5ea18944c4f90e63d547c5d3b9874df66a4ead0a31b2913000000000000000000129e9cf1c5f336fcf3a6c954444ed482c5d916e506b037db964a231458d2d6ffd  5ea18944c4f90e63d547c5d3b9874df66a4ead0a341b52c000000000000000000219e9cc4320c3018ced30242b25c03e13a1b2f57c7d107000000"
}

getrawmempool

Return hashes of transactions in memory pool.

Example

Request:

{
  "method":"getrawmempool"
}

Response:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result":["5da460632a154fe75df0d5ec98560e4bc1115374a37a75e984a534f8da3ca941", "5da460632a154fe75df0d5ec98560e4bc1115374a37a75e984a534f8da3ca941"]
}

Request:

{
	"method":"getrawmempool",
	"params":{
		"state":"all"
	}
}

Response:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "txid": "7bc35c1bb5d21c74cb94b73e2774c1be77a460b7ba1a5d8e73baa1721bb8c98d",
            "hash": "7bc35c1bb5d21c74cb94b73e2774c1be77a460b7ba1a5d8e73baa1721bb8c98d",
            "size": 369,
            "vsize": 369,
            "version": 0,
            "type": 5,
            "payloadversion": 0,
            "payload": {
                "blockheight": 366174,
                "sideblockhash": "50e95c5452808282249827971def9b6d01a83a62251aada221b20ea66755f44b",
                "sidegenesishash": "a3c455a90843db2acd22554f2768a8d4233fafbf8dd549e6b261c2786993be56",
                "signature": "fdcb69746140a2c9b42c91642e5f887c7859c3709c189a83ed09ac2305d524d66e3b77dff3e9c070323d312afb8efedc60ce41c12e6684e0db5088bad1683a92"
            },
            "attributes": [
                {
                    "usage": 0,
                    "data": "38303631373539313233303934363232343938"
                }
            ],
            "vin": [
                {
                    "txid": "754552520bbc5241fe5e59aae333a7e72d65c1d4ecec3a123cab3c773186a6b2",
                    "vout": 0,
                    "sequence": 0
                }
            ],
            "vout": [
                {
                    "value": "0.00300000",
                    "n": 0,
                    "address": "EfJDXdRiPk8aiSFwQ4Wf6BCddxgLS4o5hG",
                    "assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",
                    "outputlock": 0,
                    "type": 0,
                    "payload": null
                }
            ],
            "locktime": 688434,
            "programs": [
                {
                    "code": "21036eac18a8fe9722f5afee095334b3970496a92024f832530a51f6f1faba36a881ac",
                    "parameter": "407943915fb2d4938479757dea9cd75e957a9bfe9b45fd973139dd101e1ce4cba3520360ecb2a5da90652fbe05682bb6c7548075225effc87aadc272c27eddcc83"
                }
            ],
            "blockhash": "",
            "confirmations": 0,
            "time": 0,
            "blocktime": 0
        }
    ],
    "id": null,
    "error": null
}

getreceivedbyaddress

Get the balance of an address

Parameter

name type description
address string address

Example

Request:

{
  "method": "getreceivedbyaddress",
  "params":{"address": "8VYXVxKKSAxkmRrfmGpQR2Kc66XhG6m3ta"}
}

Response:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": "33000000"
}

listunspent

List all utxo of given addresses

Parameter

name type description
addresses array[string] addresses
utxotype string the utxo type

if not set utxotype will use "mixed" as default value if set utxotype to "mixed" or not set will get all utxos ignore the type if set utxotype to "vote" will get vote utxos if set utxotype to "normal" will get normal utxos without vote

Example

Request:

{
  "method":"listunspent",
  "params":{"addresses": ["8ZNizBf4KhhPjeJRGpox6rPcHE5Np6tFx3", "EeEkSiRMZqg5rd9a2yPaWnvdPcikFtsrjE"]}
}

Response:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": [
    {
      "assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",
      "txid": "9132cf82a18d859d200c952aec548d7895e7b654fd1761d5d059b91edbad1768",
      "vout": 0,
      "address": "8ZNizBf4KhhPjeJRGpox6rPcHE5Np6tFx3",
      "amount": "33000000",
      "confirmations": 1102,
      "outputlock": 0
    },
    {
      "assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",
      "txid": "3edbcc839fd4f16c0b70869f2d477b56a006d31dc7a10d8cb49bd12628d6352e",
      "vout": 0,
      "address": "8ZNizBf4KhhPjeJRGpox6rPcHE5Np6tFx3",
      "amount": "0.01255707",
      "confirmations": 846,
      "outputlock": 0
     }
  ]
}

setloglevel

Set log level

Parameter

name type description
level integer the log level

Example

Request:

{
  "method": "setloglevel",
  "params": {
    "level": 0
  }
}

Response:

{
  "id": null,
  "jsonrpc": "2.0",
  "error": null,
  "result": "log level has been set to 0"
}

getconnectioncount

Get peer's count of this node

Example

Request:

{
  "method": "getconnectioncount"
}

Response:

{
  "id": null,
  "error": null,
  "jsonrpc": "2.0",
  "result": 0
}

getneighbors

Get peer's info

Example

Request:

{
  "method":"getneighbors"
}

Response:

{
    "error": null,
    "id": null,
    "jsonrpc": "2.0",
    "result": [
        "127.0.0.1:64890 (inbound)",
        "127.0.0.1:64880 (inbound)",
        "127.0.0.1:64822 (inbound)",
        "127.0.0.1:22338 (outbound)",
        "127.0.0.1:23338 (outbound)",
        "127.0.0.1:24338 (outbound)"
    ]
}

getnodestate

Get node state

Result

name type description
compile string node's compile version
height integer current height of local node
version integer peer-to-peer network protocol version of this node
services string the services provided by this node
port integer P2P network port
rpcport integer JSON-RPC service port
restport integer RESTful service port
wsport integer webservice port
neighbors array[neighbor] neighbor nodes information

neighbor:

name type description
netaddress string network address of the neighbor in host:port format
services string the services neighbor provides
relaytx bool relay transactions to the neighbor or not
lastsend string the last time send a message to the neighbor
lastrecv string the last time received a message from the neighbor
conntime string the time when this neighbor was connected
timeoffset integer time offset between local time and the time advertised by the neighbor
version integer peer-to-peer network version advertised by the neighbor
inbound bool the connection direction of the neighbor (inbound/outbound)
startingheight integer the height advertised by the neighbor when connected
lastblock integer the height of the last block advertised by the neighbor
lastpingtime string the last time send a ping message to the neighbor
lastpingmicros integer microseconds to receive pong message after sending last ping message

Example

Request:

{
  "method":"getnodestate"
}

Response:

{
    "error": null,
    "id": null,
    "jsonrpc": "2.0",
    "result": {
        "compile": "v0.2.2-231-g75d2-dirty",
        "height": 0,
        "version": 20000,
        "services": "SFNodeNetwork|SFTxFiltering|SFNodeBloom",
        "port": 21338,
        "rpcport": 21336,
        "restport": 21334,
        "wsport": 21335,
        "neighbors": [
            {
                "netaddress": "127.0.0.1:57656",
                "services": "SFNodeNetwork|SFTxFiltering|SFNodeBloom",
                "relaytx": false,
                "lastsend": "2019-03-06 14:52:03 +0800 CST",
                "lastrecv": "2019-03-06 14:52:18 +0800 CST",
                "conntime": "2019-03-06 14:51:33.65298 +0800 CST m=+36.604516146",
                "timeoffset": 0,
                "version": 20000,
                "inbound": true,
                "startingheight": 0,
                "lastblock": 0,
                "lastpingtime": "2019-03-06 14:52:03.658121 +0800 CST m=+66.609840707",
                "lastpingmicros": 1033
            },
            {
                "netaddress": "127.0.0.1:22338",
                "services": "SFNodeNetwork|SFTxFiltering|SFNodeBloom",
                "relaytx": false,
                "lastsend": "2019-03-06 14:52:02 +0800 CST",
                "lastrecv": "2019-03-06 14:52:02 +0800 CST",
                "conntime": "2019-03-06 14:51:02.097149 +0800 CST m=+5.048492921",
                "timeoffset": 0,
                "version": 20000,
                "inbound": false,
                "startingheight": 0,
                "lastblock": 0,
                "lastpingtime": "2019-03-06 14:52:02.104806 +0800 CST m=+65.056516088",
                "lastpingmicros": 541
            }
        ]
    }
}

sendrawtransaction

Send a raw transaction to node

Parameter

name type description
data string raw transaction data in hex

Result

name type description
hash string transaction hash

Example

Request:

{
  "method":"sendrawtransaction",
  "params": ["xxxxxx"]
}

Response:

{
  "result":"764691821f937fd566bcf533611a5e5b193008ea1ba1396f67b7b0da22717c02",
  "id": null,
  "jsonrpc": "2.0",
  "error": null
}

togglemining

The switch of mining

Parameter

name type description
mining bool whether mine or not

Example

Request:

{
  "method":"togglemining",
  "params":{"mining":false}
}

Response:

{
  "id": null,
  "jsonrpc": "2.0",
  "result": "mining stopped",
  "error": null
}

discretemining

Generate one or more blocks instantly

Parameter

name type description
count integer count of blocks

Example

Request:

{
  "method":"discretemining",
  "params":{"count":1}
}

Response:

{
  "id": null,
  "jsonrpc": "2.0",
  "result": [
    "741d8131f0eea94c1c72c8bb1f0e9051a0a98441e131585bf5bf01868bf0ef46"
  ],
  "error": null
}

getmininginfo

Returns a json object containing mining-related information

Result

name type description
blocks integer the current block
currentblocktx integer the number of block transactions of the last assembled block
difficulty string the current difficulty
networkhashps string the network hashes per second
pooledtx integer the size of the mempool
chain string current network name

Example

Request:

{
  "method":"getmininginfo",
  "params":{}
}

Response:

{
    "error": null,
    "id": null,
    "jsonrpc": "2.0",
    "result": {
        "blocks": 397720,
        "currentblocktx": 7,
        "difficulty": "1553768014955882",
        "networkhashps": "27618978773646499814",
        "pooledtx": 0,
        "chain": "mainnet"
    }
}

createauxblock

Generate an auxiliary block

Parameter

name type description
paytoaddress string miner's address

Example

Request:

named arguments:

{
  "method":"createauxblock",
  "params":{"paytoaddress":"Ef4UcaHwvFrFzzsyVf5YH4JBWgYgUqfTAB"}
}

positional arguments:

{
  "method": "createauxblock",
  "params": ["Ef4UcaHwvFrFzzsyVf5YH4JBWgYgUqfTAB"]
}

Response:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": {
    "chainid": 1224,
    "height": 152789,
    "coinbasevalue": 175799086,
    "bits": "1d36c855",
    "hash": "e28a262b38316fddefb0b5c753f7cc0022afe94e95f881576ad6b8f33f4e49fe",
    "previousblockhash": "f297d03791f4cf2c6ef093b02a77465ea876b040b7772e56b8e140f3bff73871"
  }
}

submitauxblock

Submit the solved auxpow of an auxiliary block

Parameter

name type description
blockhash string the auxiliary block hash
auxpow string the solved auxpow of this auxiliary block

Example

Request:

named arguments sample:

{
  "method":"submitauxblock",
  "params":{
    "blockhash": "7926398947f332fe534b15c628ff0cd9dc6f7d3ea59c74801dc758ac65428e64",
    "auxpow": "02000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4b0313ee0904a880495b742f4254432e434f4d2ffabe6d6d9581ba0156314f1e92fd03430c6e4428a32bb3f1b9dc627102498e5cfbf26261020000004204cb9a010f32a00601000000000000ffffffff0200000000000000001976a914c0174e89bd93eacd1d5a1af4ba1802d412afc08688ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90000000014acac4ee8fdd8ca7e0b587b35fce8c996c70aefdf24c333038bdba7af531266000000000001ccc205f0e1cb435f50cc2f63edd53186b414fcb22b719da8c59eab066cf30bdb0000000000000020d1061d1e456cae488c063838b64c4911ce256549afadfc6a4736643359141b01551e4d94f9e8b6b03eec92bb6de1e478a0e913e5f733f5884857a7c2b965f53ca880495bffff7f20a880495b"
  }
}

positional arguments sample:

{
  "method":"submitauxblock",
  "params":[
    "7926398947f332fe534b15c628ff0cd9dc6f7d3ea59c74801dc758ac65428e64",
    "02000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4b0313ee0904a880495b742f4254432e434f4d2ffabe6d6d9581ba0156314f1e92fd03430c6e4428a32bb3f1b9dc627102498e5cfbf26261020000004204cb9a010f32a00601000000000000ffffffff0200000000000000001976a914c0174e89bd93eacd1d5a1af4ba1802d412afc08688ac0000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90000000014acac4ee8fdd8ca7e0b587b35fce8c996c70aefdf24c333038bdba7af531266000000000001ccc205f0e1cb435f50cc2f63edd53186b414fcb22b719da8c59eab066cf30bdb0000000000000020d1061d1e456cae488c063838b64c4911ce256549afadfc6a4736643359141b01551e4d94f9e8b6b03eec92bb6de1e478a0e913e5f733f5884857a7c2b965f53ca880495bffff7f20a880495b"
  ]
}

Response:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": true
}

getinfo

Return node information. warning: this interface is ready to be deprecated. So no api information will be supplied.

listproducers

Show producers infromation

Parameter

name type description
start integer the start index of producers
limit integer the limit count of producers
state string the producer state you want
"all": get producers in any state
"pending": get producers in the pendding state
"active": get producers in the active state
"inactive": get producers in the inactive state
"canceled": get producers in the canceled state
"illegal": get producers in the illegal state
"returned": get producers in the returned state
if state flag not provided return the producers in pending and active state.

Result

name type description
ownerpublickey string the owner public key of producer
nodepublickey string the node public key of the producer
nickname string the nick name of the producer
url string the url of the producer
location uint64 the location number of the producer
active bool if producer has confirmed
votes string the votes currently held
state string the current state of the producer
registerheight uint32 the height of cancel producer
cancelheight uint32 the cancel height of the producer
inactiveheight uint32 the inactive start height of the producer
illegalheight uint32 the illegal start height of the producer
index uint64 the index of the producer
totalvotes string the total votes of registered producers
totalcounts uint64 the total counts of registered producers

Example

Request:

{
  "method": "listproducers",
  "params":{
    "start": 0,
    "limit": 3
  }
}

Response:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": {
    "producers": [
      {
        "ownerpublickey": "0237a5fb316caf7587e052125585b135361be533d74b5a094a68c64c47ccd1e1eb",
        "nodepublickey": "0237a5fb316caf7587e052125585b135361be533d74b5a094a68c64c47ccd1e1eb",
        "nickname": "elastos1",
        "url": "http://www.elastos1.com",
        "location": 401,
        "active": true,
        "votes": "3.11100000",
        "state": "Active",
        "registerheight": 236,
        "cancelheight": 0,
        "inactiveheight": 0,
        "illegalheight": 0,
        "index": 0
      },
      {
        "ownerpublickey": "030a26f8b4ab0ea219eb461d1e454ce5f0bd0d289a6a64ffc0743dab7bd5be0be9",
        "nodepublickey": "030a26f8b4ab0ea219eb461d1e454ce5f0bd0d289a6a64ffc0743dab7bd5be0be9",
        "nickname": "elastos2",
        "url": "http://www.elastos2.com",
        "location": 402,
        "active": true,
        "votes": "2.10000000",
        "state": "Active",
        "registerheight": 225,
        "cancelheight": 0,
        "inactiveheight": 0,
        "illegalheight": 0,
        "index": 1
      },
      {
        "ownerpublickey": "0288e79636e41edce04d4fa95d8f62fed73a76164f8631ccc42f5425f960e4a0c7",
        "nodepublickey": "0288e79636e41edce04d4fa95d8f62fed73a76164f8631ccc42f5425f960e4a0c7",
        "nickname": "elastos3",
        "url": "http://www.elastos3.com",
        "location": 403,
        "active": true,
        "votes": "0",
        "state": "Active",
        "registerheight": 216,
        "cancelheight": 0,
        "inactiveheight": 0,
        "illegalheight": 0,
        "index": 2
      }
    ],
    "totalvotes": "5.21100000",
    "totalcounts": 10
  }
}

producerstatus

Show producer status

Parameter

name type description
publickey string the public key of producer

Result

0: producer has not registered 1: producer has confirmed (6 confirms) 2: producer registered but not confirmed (less than 6 confirms)

Example

Request:

{
  "method": "producerstatus",
  "params":{
    "publickey": "0237a5fb316caf7587e052125585b135361be533d74b5a094a68c64c47ccd1e1eb"
  }
}

Response:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": 1
}

votestatus

Show producer vote status

Parameter

name type description
address string the address of user

Result

Note: If the EnableUtxoDB configuration entry is true, the total field is computed, otherwise the total field returns -1

name type description
total string the total voting rights
voting string the used voting rights
pending bool have vote in tx pool

Example

Request:

{
  "method": "votestatus",
  "params":{
    "address": "EZwPHEMQLNBpP2VStF3gRk8EVoMM2i3hda"
  }
}

Response:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": {
    "total": "4.66088900",
    "voting": "0",
    "pending": true
  }
}

estimatesmartfee

Estimate transaction fee smartly.

Parameter

name type description
confirmations int in how many blocks do you want your transaction to be packed

Result

name type description
- int fee rate, the unit is sela per KB

Example

Request:

{
  "method": "estimatesmartfee",
  "params":{
    "confirmations": 5
  }
}

Response:

{
  "error": null,
  "id": null,
  "jsonrpc": "2.0",
  "result": 10000
}

getdepositcoin

Get deposit coin by owner public key.

Parameter

name type description
ownerpublickey string the ownerPublicKey of producer

Result

name type description
available string the available deposit coin of producer
deducted string the deducted deposit coin of producer
deposit string the deposit amount coin of producer
assets string the total assets coin of producer

Example