Skip to main content
MAIN CHAIN

Main Chain JSON-RPC API

The ELA main chain uses a custom JSON-RPC interface that is not Ethereum-compatible. All calls use POST with a JSON body containing method, params, and id. The jsonrpc field is optional; if omitted, the node defaults to "2.0".

{
"method": "getblockcount",
"params": {},
"id": 1
}

Connection

NetworkURLNotes
Mainnethttps://api.elastos.io/elaPublic endpoint
Testnethttps://api-testnet.elastos.io/elaPublic testnet endpoint
Self-hostedhttp://localhost:20336Default JSON-RPC port

Block & Transaction

getbestblockhash

Returns the hash of the most recent block on the longest chain.

Parameters

None.

Result

NameTypeDescription
blockhashstringHash of the tip block

Example

// Request
{
"method": "getbestblockhash",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "68692d63a8bfc8887553b97f99f09e523d34a2b599bf5b388436b2ddc85ed76e",
"error": null
}

getblockhash

Returns the block hash at a given height.

Parameters

NameTypeDescription
heightintegerBlock height

Result

NameTypeDescription
blockhashstringHash of the block at the specified height

Example

// Request
{
"method": "getblockhash",
"params": {
"height": 100
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "3893390c9fe372eab5b356a02c54d3baa41fc48918bbdbd7f4f12f9a9f4c4dc4",
"error": null
}

getblock

Returns block information for a given block hash.

Parameters

NameTypeDescription
blockhashstringThe block hash
verbosityinteger0 = serialized hex string, 1 = JSON summary with tx hashes, 2 = JSON with full transaction objects
Verbosity matters

Use verbosity 0 when you only need the raw hex. Use 1 for block metadata with transaction IDs. Use 2 to get full transaction objects embedded in the block response — this avoids separate getrawtransaction calls.

Result (verbosity 1)

NameTypeDescription
hashstringBlock hash
confirmationsintegerNumber of confirmations
sizeintegerBlock size in bytes
strippedsizeintegerBlock size excluding witness data
weightintegerBlock weight
heightintegerBlock height
versionintegerBlock version
versionhexstringBlock version in hex
merklerootstringMerkle root of transactions
txarray<string>Transaction hashes in this block
timeintegerBlock timestamp (Unix)
mediantimeintegerMedian time of the previous 11 blocks
nonceintegerNonce used in mining
bitsintegerCompact target
difficultystringMining difficulty
chainworkstringCumulative chain work in hex
previousblockhashstringHash of the previous block
nextblockhashstringHash of the next block (if any)
auxpowstringAuxiliary proof-of-work data (from merged mining)

Example

// Request
{
"method": "getblock",
"params": {
"blockhash": "68692d63a8bfc8887553b97f99f09e523d34a2b599bf5b388436b2ddc85ed76e",
"verbosity": 1
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"hash": "68692d63a8bfc8887553b97f99f09e523d34a2b599bf5b388436b2ddc85ed76e",
"confirmations": 5,
"size": 498,
"strippedsize": 498,
"weight": 1992,
"height": 171454,
"version": 0,
"versionhex": "00000000",
"merkleroot": "6c42a2ee69444c0fe684e0be82e38ce67a32cb2d66ae2c72ef21eeb5c073f4c2",
"tx": [
"6c42a2ee69444c0fe684e0be82e38ce67a32cb2d66ae2c72ef21eeb5c073f4c2"
],
"time": 1620000000,
"mediantime": 1619999400,
"nonce": 0,
"bits": 486801407,
"difficulty": "1234567.89012345",
"chainwork": "0000000000000000000000000000000000000000000000000000012345678901",
"previousblockhash": "8fc39d0d18d2341bba75a74d3f0bab87bcc585aba87de3e05f3dd691ae0b0e1a",
"nextblockhash": "aa51e400f3e9faa52e58de04a7e9dbb64db93a1c6c4bb2b32be98e690e5206da",
"auxpow": "..."
},
"error": null
}

getblockcount

Returns the current block height of the node's longest chain.

Parameters

None.

Result

NameTypeDescription
heightintegerCurrent block height

Example

// Request
{
"method": "getblockcount",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 171454,
"error": null
}

getblockbyheight

Returns full block information for a given height. The result schema matches getblock with verbosity 2 (includes full transaction objects).

Parameters

NameTypeDescription
heightuint32Block height

Result

Same as getblock with verbosity 2.

Example

// Request
{
"method": "getblockbyheight",
"params": {
"height": 171454
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"hash": "68692d63a8bfc8887553b97f99f09e523d34a2b599bf5b388436b2ddc85ed76e",
"confirmations": 5,
"size": 498,
"strippedsize": 498,
"weight": 1992,
"height": 171454,
"version": 0,
"versionhex": "00000000",
"merkleroot": "6c42a2ee69444c0fe684e0be82e38ce67a32cb2d66ae2c72ef21eeb5c073f4c2",
"tx": [
{
"txid": "6c42a2ee69444c0fe684e0be82e38ce67a32cb2d66ae2c72ef21eeb5c073f4c2",
"hash": "6c42a2ee69444c0fe684e0be82e38ce67a32cb2d66ae2c72ef21eeb5c073f4c2",
"size": 254,
"vsize": 254,
"version": 0,
"type": 0,
"payloadversion": 0,
"payload": {},
"locktime": 171454,
"vin": [],
"vout": [
{
"value": "1.50000000",
"n": 0,
"address": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo",
"assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",
"outputlock": 0
}
],
"blockhash": "68692d63a8bfc8887553b97f99f09e523d34a2b599bf5b388436b2ddc85ed76e",
"confirmations": 5,
"time": 1620000000,
"blocktime": 1620000000,
"attributes": [],
"programs": []
}
],
"time": 1620000000,
"mediantime": 1619999400,
"nonce": 0,
"bits": 486801407,
"difficulty": "1234567.89012345",
"chainwork": "0000000000000000000000000000000000000000000000000000012345678901",
"previousblockhash": "8fc39d0d18d2341bba75a74d3f0bab87bcc585aba87de3e05f3dd691ae0b0e1a",
"nextblockhash": "aa51e400f3e9faa52e58de04a7e9dbb64db93a1c6c4bb2b32be98e690e5206da",
"auxpow": "..."
},
"error": null
}

getrawtransaction

Returns raw transaction data. When verbose is true, returns a decoded JSON object; otherwise returns the serialized hex string.

Parameters

NameTypeDescription
txidstringTransaction hash
verbosebooltrue for decoded JSON, false for hex string

Result (verbose = true)

NameTypeDescription
txidstringTransaction ID
hashstringTransaction hash
sizeintegerTransaction size in bytes
vsizeintegerVirtual size
versionintegerTransaction version
locktimeintegerLock time
vinarrayArray of inputs
voutarrayArray of outputs, each with value, n, address, assetid, outputlock
blockhashstringBlock containing this transaction
confirmationsintegerNumber of confirmations
timeintegerTransaction timestamp
blocktimeintegerBlock timestamp
typeintegerTransaction type
payloadversionintegerPayload version
payloadobjectTransaction payload
attributesarrayTransaction attributes
programsarrayTransaction programs (scripts)

Example

// Request
{
"method": "getrawtransaction",
"params": {
"txid": "6c42a2ee69444c0fe684e0be82e38ce67a32cb2d66ae2c72ef21eeb5c073f4c2",
"verbose": true
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"txid": "6c42a2ee69444c0fe684e0be82e38ce67a32cb2d66ae2c72ef21eeb5c073f4c2",
"hash": "6c42a2ee69444c0fe684e0be82e38ce67a32cb2d66ae2c72ef21eeb5c073f4c2",
"size": 254,
"vsize": 254,
"version": 0,
"type": 0,
"payloadversion": 0,
"payload": {},
"locktime": 171454,
"vin": [
{
"txid": "0000000000000000000000000000000000000000000000000000000000000000",
"vout": 65535,
"sequence": 4294967295
}
],
"vout": [
{
"value": "1.50000000",
"n": 0,
"address": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo",
"assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",
"outputlock": 0
}
],
"blockhash": "68692d63a8bfc8887553b97f99f09e523d34a2b599bf5b388436b2ddc85ed76e",
"confirmations": 5,
"time": 1620000000,
"blocktime": 1620000000,
"attributes": [],
"programs": []
},
"error": null
}

sendrawtransaction

Broadcasts a signed, serialized transaction to the network.

Parameters

NameTypeDescription
datastringHex-encoded signed transaction

Result

NameTypeDescription
hashstringTransaction hash of the broadcast transaction

Example

// Request
{
"method": "sendrawtransaction",
"params": {
"data": "0200010013313637..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6abcd",
"error": null
}

getrawmempool

Returns all transaction hashes currently in the memory pool.

Parameters

NameTypeDescription
statestring(optional) Pass "all" to return full transaction details instead of just hashes

Result

NameTypeDescription
(default)array<string>Array of transaction hashes
(state="all")array<object>Full transaction details

Example

// Request
{
"method": "getrawmempool",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6abcd",
"b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6abcdef"
],
"error": null
}

createrawtransaction

Creates an unsigned raw transaction from the given inputs and outputs.

Parameters

NameTypeDescription
inputsarrayArray of {"txid": "...", "vout": N} objects
outputsarrayArray of {"address": "...", "amount": "..."} objects
locktimeintegerTransaction lock time

Result

NameTypeDescription
datastringHex-encoded unsigned transaction

Example

// Request
{
"method": "createrawtransaction",
"params": {
"inputs": [
{
"txid": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6abcd",
"vout": 0
}
],
"outputs": [
{
"address": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo",
"amount": "1.00000000"
}
],
"locktime": 0
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "0200010013313637...",
"error": null
}

signrawtransactionwithkey

Signs a raw transaction with the provided private keys.

Parameters

NameTypeDescription
datastringHex-encoded raw transaction
codesstringRedeem script(s)
privkeysstringPrivate key(s) for signing

Result

NameTypeDescription
datastringHex-encoded signed transaction

Example

// Request
{
"method": "signrawtransactionwithkey",
"params": {
"data": "0200010013313637...",
"codes": "2102...",
"privkeys": "5JYc..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "0200010013313637...signed...",
"error": null
}

decoderawtransaction

Decodes a raw transaction hex string into a human-readable JSON object.

Parameters

NameTypeDescription
datastringHex-encoded raw transaction

Result

NameTypeDescription
txidstringTransaction ID
hashstringTransaction hash
sizeintegerSize in bytes
vsizeintegerVirtual size
versionintegerTransaction version
typeintegerTransaction type
payloadversionintegerPayload version
payloadobjectTransaction payload
locktimeintegerLock time
vinarrayInputs
voutarrayOutputs
attributesarrayAttributes
programsarrayPrograms

Example

// Request
{
"method": "decoderawtransaction",
"params": {
"data": "0200010013313637..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"txid": "6c42a2ee69444c0fe684e0be82e38ce67a32cb2d66ae2c72ef21eeb5c073f4c2",
"hash": "6c42a2ee69444c0fe684e0be82e38ce67a32cb2d66ae2c72ef21eeb5c073f4c2",
"size": 254,
"vsize": 254,
"version": 0,
"type": 0,
"payloadversion": 0,
"payload": {},
"locktime": 0,
"vin": [
{
"txid": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6abcd",
"vout": 0,
"sequence": 4294967295
}
],
"vout": [
{
"value": "1.00000000",
"n": 0,
"address": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo",
"assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",
"outputlock": 0
}
],
"attributes": [],
"programs": []
},
"error": null
}

Address & UTXO

getreceivedbyaddress

Returns the total amount received by the given address (confirmed transactions only).

Parameters

NameTypeDescription
addressstringELA address

Result

NameTypeDescription
amountstringTotal ELA received

Example

// Request
{
"method": "getreceivedbyaddress",
"params": {
"address": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo"
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "15.23400000",
"error": null
}

listunspent

Returns unspent transaction outputs (UTXOs) for the specified addresses.

Parameters

NameTypeDescription
addressesarray<string>List of ELA addresses
utxotypestring(optional) "mixed" (default), "vote", or "normal"

Result

NameTypeDescription
resultarrayArray of UTXO objects with txid, vout, address, amount, confirmations

Example

// Request
{
"method": "listunspent",
"params": {
"addresses": [
"EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo"
]
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"txid": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6abcd",
"vout": 0,
"address": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo",
"amount": "5.00000000",
"confirmations": 120,
"assetid": "a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0",
"outputlock": 0
}
],
"error": null
}

getutxosbyamount

Returns UTXOs whose total value is greater than or equal to the specified amount.

Parameters

NameTypeDescription
addressstringELA address
amountstringMinimum total value required
utxotypestring(optional) "mixed", "vote", or "normal"

Result

NameTypeDescription
resultarrayArray of UTXO objects sufficient to cover the requested amount

Example

// Request
{
"method": "getutxosbyamount",
"params": {
"address": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo",
"amount": "2.50000000"
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"txid": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6abcd",
"vout": 0,
"address": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo",
"amount": "5.00000000",
"confirmations": 120
}
],
"error": null
}

getamountbyinputs

Calculates the total value of the specified inputs.

Parameters

NameTypeDescription
inputsstringHex-encoded input data

Result

NameTypeDescription
amountstringTotal ELA value of the inputs

Example

// Request
{
"method": "getamountbyinputs",
"params": {
"inputs": "0201a1b2c3d4..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "10.50000000",
"error": null
}

Node Info

getinfo

Returns general information about the node.

Deprecated — Use getnodestate for more detailed information.

Parameters

None.

Result

NameTypeDescription
versionintegerNode software version
heightintegerCurrent block height
connectionsintegerNumber of connected peers

Example

// Request
{
"method": "getinfo",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"version": 10000,
"height": 171454,
"connections": 25
},
"error": null
}

getnodestate

Returns detailed information about the node's state, including compile info, ports, and connected peers.

Parameters

None.

Result

NameTypeDescription
compilestringNode compile version string
heightintegerCurrent block height
versionintegerProtocol version
servicesstringSupported service flags
portintegerP2P listen port
rpcportintegerJSON-RPC port
restportintegerREST API port
wsportintegerWebSocket port
neighborsarrayConnected peers (see below)

Neighbor fields

NameTypeDescription
netaddressstringPeer IP and port
servicesstringPeer service flags
relaytxboolWhether the peer relays transactions
lastsendstringTimestamp of last message sent
lastrecvstringTimestamp of last message received
conntimestringConnection established time
timeoffsetintegerTime offset from local clock (seconds)
versionintegerPeer protocol version
inboundboolWhether this is an inbound connection
startingheightintegerPeer's block height when connected
lastblockintegerPeer's latest known block height
lastpingtimestringLast ping timestamp
lastpingmicrosintegerLast ping round-trip in microseconds

Example

// Request
{
"method": "getnodestate",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"compile": "v0.9.2-48-gd1e2f3a",
"height": 171454,
"version": 30000,
"services": "SFNodeNetwork|SFTxFiltering|SFNodeBloom",
"port": 20338,
"rpcport": 20336,
"restport": 20334,
"wsport": 20335,
"neighbors": [
{
"netaddress": "192.0.2.1:20338",
"services": "SFNodeNetwork|SFTxFiltering|SFNodeBloom",
"relaytx": false,
"lastsend": "2024-01-15 10:30:00",
"lastrecv": "2024-01-15 10:30:01",
"conntime": "2024-01-14 08:00:00",
"timeoffset": 0,
"version": 30000,
"inbound": false,
"startingheight": 171400,
"lastblock": 171454,
"lastpingtime": "2024-01-15 10:29:50",
"lastpingmicros": 12345
}
]
},
"error": null
}

getconnectioncount

Returns the number of peers connected to the node.

Parameters

None.

Result

NameTypeDescription
countintegerNumber of connected peers

Example

// Request
{
"method": "getconnectioncount",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 25,
"error": null
}

getneighbors

Returns information about connected peers.

Parameters

None.

Result

NameTypeDescription
resultarrayArray of peer info objects

Example

// Request
{
"method": "getneighbors",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"netaddress": "192.0.2.1:20338",
"services": "SFNodeNetwork|SFTxFiltering|SFNodeBloom",
"inbound": false,
"version": 30000,
"lastblock": 171454
}
],
"error": null
}

setloglevel

Changes the logging verbosity of the node at runtime.

Parameters

NameTypeDescription
levelintegerLog level (0 = debug, 1 = info, 2 = warn, 3 = error, 4 = fatal, 5 = off)

Result

NameTypeDescription
resultstringConfirmation message

Example

// Request
{
"method": "setloglevel",
"params": {
"level": 1
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "log level has been set to 1",
"error": null
}

BPoS & Validators

listproducers

Returns a paginated list of block producers (validators) with optional state filtering.

Parameters

NameTypeDescription
startintegerStart index for pagination
limitintegerMaximum number of results
statestringFilter: "all", "pending", "active", "inactive", "canceled", "illegal", "returned"

Result

NameTypeDescription
ownerpublickeystringOwner's public key
nodepublickeystringNode's public key
nicknamestringProducer name
urlstringProducer info URL
locationintegerLocation code
activeboolWhether the producer is currently active
votesstringNumber of votes received
statestringCurrent state
registerheightintegerBlock height of registration
cancelheightintegerBlock height of cancellation (0 if active)
inactiveheightintegerBlock height when became inactive (0 if active)
illegalheightintegerBlock height when marked illegal (0 if not)
indexintegerIndex in the result set
totalvotesstringTotal votes across all producers
totalcountsintegerTotal number of producers matching the filter

Example

// Request
{
"method": "listproducers",
"params": {
"start": 0,
"limit": 3,
"state": "active"
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"producers": [
{
"ownerpublickey": "0306e4f...",
"nodepublickey": "0282d5a...",
"nickname": "Elephant Wallet",
"url": "https://elephantwallet.app",
"location": 86,
"active": true,
"votes": "45230120.12345678",
"state": "Active",
"registerheight": 362738,
"cancelheight": 0,
"inactiveheight": 0,
"illegalheight": 0,
"index": 0
}
],
"totalvotes": "182345670.98765432",
"totalcounts": 96
},
"error": null
}

producerstatus

Checks the registration status of a block producer.

Parameters

NameTypeDescription
publickeystringProducer's public key

Result

NameTypeDescription
statusinteger0 = not registered, 1 = confirmed, 2 = registered but unconfirmed

Example

// Request
{
"method": "producerstatus",
"params": {
"publickey": "0306e4f..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 1,
"error": null
}

votestatus

Returns the voting status for a given address.

Parameters

NameTypeDescription
addressstringELA address

Result

NameTypeDescription
totalstringTotal ELA in the address
votingstringELA currently locked in votes
pendingstringELA in pending vote transactions

Example

// Request
{
"method": "votestatus",
"params": {
"address": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo"
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"total": "1000.00000000",
"voting": "500.00000000",
"pending": "0.00000000"
},
"error": null
}

getdepositcoin

Returns deposit coin information for a producer by their owner public key.

Parameters

NameTypeDescription
ownerpublickeystringProducer's owner public key

Result

NameTypeDescription
availablestringAvailable (withdrawable) amount
deductedstringDeducted penalty amount
depositstringLocked deposit amount
assetsarrayAdditional asset details

Example

// Request
{
"method": "getdepositcoin",
"params": {
"ownerpublickey": "0306e4f..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"available": "500.00000000",
"deducted": "0.00000000",
"deposit": "5000.00000000",
"assets": []
},
"error": null
}

getarbitersinfo

Returns information about current and next round arbiters and candidates.

Parameters

None.

Result

NameTypeDescription
arbitersarray<string>Current arbiter public keys
candidatesarray<string>Current candidate public keys
nextarbitersarray<string>Next round arbiter public keys
nextcandidatesarray<string>Next round candidate public keys
ondutyarbiterstringPublic key of the currently on-duty arbiter
currentturnstartheightintegerBlock height when the current rotation started
nextturnstartheightintegerBlock height when the next rotation starts

Example

// Request
{
"method": "getarbitersinfo",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"arbiters": [
"0306e4f...",
"0282d5a...",
"03a9b2c..."
],
"candidates": [
"02f1d8e...",
"03b4c6d..."
],
"nextarbiters": [
"0306e4f...",
"0282d5a...",
"03a9b2c..."
],
"nextcandidates": [
"02f1d8e...",
"03b4c6d..."
],
"ondutyarbiter": "0306e4f...",
"currentturnstartheight": 171440,
"nextturnstartheight": 171476
},
"error": null
}

getarbitratorgroupbyheight

Returns the arbitrator group that was active at a given block height.

Parameters

NameTypeDescription
heightuint32Block height to query

Result

NameTypeDescription
ondutyarbitratorindexintegerIndex of the on-duty arbitrator
arbitratorsarray<string>List of arbitrator public keys

Example

// Request
{
"method": "getarbitratorgroupbyheight",
"params": {
"height": 171454
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"ondutyarbitratorindex": 2,
"arbitrators": [
"0306e4f...",
"0282d5a...",
"03a9b2c..."
]
},
"error": null
}

getarbiterpeersinfo

Returns network connection information for DPoS arbiter peers.

Parameters

None.

Result (array)

NameTypeDescription
ownerpublickeystringOwner public key
nodepublickeystringNode public key
ipstringPeer IP address
connstatestringConnection state (e.g. "EstablishConnection", "NoneConnection")

Example

// Request
{
"method": "getarbiterpeersinfo",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"ownerpublickey": "0306e4f...",
"nodepublickey": "0282d5a...",
"ip": "192.0.2.1",
"connstate": "EstablishConnection"
}
],
"error": null
}

getconfirmbyheight

Returns the block confirmation (DPoS consensus signature) at a given height.

Parameters

NameTypeDescription
heightintegerBlock height
verbosityinteger0 for hex, 1 for decoded JSON

Result (verbosity 1)

NameTypeDescription
sponsorstringPublic key of the confirm sponsor
viewoffsetintegerView offset in the consensus round
votesarrayArray of vote objects with signer and accept fields

Example

// Request
{
"method": "getconfirmbyheight",
"params": {
"height": 171454,
"verbosity": 1
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"sponsor": "0306e4f...",
"viewoffset": 0,
"votes": [
{
"signer": "0282d5a...",
"accept": true
},
{
"signer": "03a9b2c...",
"accept": true
}
]
},
"error": null
}

getconfirmbyhash

Returns the block confirmation (DPoS consensus signature) for a given block hash.

Parameters

NameTypeDescription
blockhashstringBlock hash
verbosityinteger0 for hex, 1 for decoded JSON

Result

Same as getconfirmbyheight.

Example

// Request
{
"method": "getconfirmbyhash",
"params": {
"blockhash": "68692d63a8bfc8887553b97f99f09e523d34a2b599bf5b388436b2ddc85ed76e",
"verbosity": 1
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"sponsor": "0306e4f...",
"viewoffset": 0,
"votes": [
{
"signer": "0282d5a...",
"accept": true
}
]
},
"error": null
}

estimatesmartfee

Estimates the fee rate needed for a transaction to be confirmed within a given number of blocks.

Parameters

NameTypeDescription
confirmationsintegerTarget number of blocks for confirmation

Result

NameTypeDescription
feeintegerEstimated fee rate in sela per KB

Example

// Request
{
"method": "estimatesmartfee",
"params": {
"confirmations": 6
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": 10000,
"error": null
}

Mining

togglemining

Starts or stops CPU mining on the node.

Parameters

NameTypeDescription
miningbooltrue to start mining, false to stop

Result

NameTypeDescription
resultstringConfirmation message

Example

// Request
{
"method": "togglemining",
"params": {
"mining": true
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "mining started",
"error": null
}

discretemining

Mines a specified number of blocks instantly. Intended for regtest/testing environments.

Parameters

NameTypeDescription
countintegerNumber of blocks to mine

Result

NameTypeDescription
resultarray<string>Array of mined block hashes

Example

// Request
{
"method": "discretemining",
"params": {
"count": 3
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
"aabb1122...",
"ccdd3344...",
"eeff5566..."
],
"error": null
}

getmininginfo

Returns information about the node's mining state.

Parameters

None.

Result

NameTypeDescription
blocksintegerCurrent block height
currentblocktxintegerNumber of transactions in the current block template
difficultystringCurrent mining difficulty
networkhashpsstringEstimated network hash rate per second
pooledtxintegerNumber of transactions in the mempool
chainstringNetwork name (e.g. "mainnet", "testnet", "regnet")

Example

// Request
{
"method": "getmininginfo",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blocks": 171454,
"currentblocktx": 12,
"difficulty": "1234567.89012345",
"networkhashps": "98765432109876",
"pooledtx": 47,
"chain": "mainnet"
},
"error": null
}

createauxblock

Creates an auxiliary block for merged mining. A Bitcoin miner calls this to get work from the ELA node.

Parameters

NameTypeDescription
paytoaddressstringELA address to receive the block reward

Result

NameTypeDescription
chainidintegerAuxiliary chain ID
heightintegerBlock height of the candidate block
coinbasevalueintegerBlock reward in sela
bitsstringCompact target for the block
hashstringHash of the candidate block
previousblockhashstringPrevious block hash

Example

// Request
{
"method": "createauxblock",
"params": {
"paytoaddress": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo"
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"chainid": 1224,
"height": 171455,
"coinbasevalue": 150000000,
"bits": "1a016729",
"hash": "79c20b21ba5af617a0c147e7fc2c3b4bfb0c283a4d15a2e4624e0cda98e1a0d2",
"previousblockhash": "68692d63a8bfc8887553b97f99f09e523d34a2b599bf5b388436b2ddc85ed76e"
},
"error": null
}

submitauxblock

Submits a solved auxiliary proof-of-work block. Called by a Bitcoin miner after solving a block that includes the ELA auxiliary chain.

Parameters

NameTypeDescription
blockhashstringHash of the auxiliary block (from createauxblock)
auxpowstringSerialized auxiliary proof-of-work data

Result

NameTypeDescription
resultbooltrue if accepted, error otherwise

Example

// Request
{
"method": "submitauxblock",
"params": {
"blockhash": "79c20b21ba5af617a0c147e7fc2c3b4bfb0c283a4d15a2e4624e0cda98e1a0d2",
"auxpow": "02000000010000000000..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true,
"error": null
}

CR (Elastos DAO)

listcrcandidates

Returns a paginated list of Cyber Republic (CR) council candidates.

Parameters

NameTypeDescription
startintegerStart index for pagination
limitintegerMaximum number of results
statestringFilter: "all", "pending", "active", "canceled", "returned"

Result

NameTypeDescription
codestringCandidate code
cidstringCandidate CID (CRC ID)
didstringCandidate DID
nicknamestringCandidate name
urlstringCandidate info URL
locationintegerLocation code
statestringCurrent state
votesstringNumber of votes received
registerheightintegerBlock height of registration
cancelheightintegerBlock height of cancellation (0 if active)
indexintegerIndex in result set
totalvotesstringTotal votes across all candidates
totalcountsintegerTotal number of candidates matching the filter

Example

// Request
{
"method": "listcrcandidates",
"params": {
"start": 0,
"limit": 3,
"state": "all"
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"crcandidatesinfo": [
{
"code": "21024f3a...",
"cid": "ihfb4V1u...",
"did": "igNBwC2P...",
"nickname": "CR Council Member A",
"url": "https://example.com/cr-a",
"location": 86,
"state": "Active",
"votes": "12500000.00000000",
"registerheight": 413568,
"cancelheight": 0,
"index": 0
}
],
"totalvotes": "75000000.00000000",
"totalcounts": 24
},
"error": null
}

getcrdepositcoin

Returns deposit coin information for a CR member.

Parameters

NameTypeDescription
idstringCRC ID or DID of the CR member
publickeystring(alternative) Public key of the CR member

Provide either id or publickey.

Result

NameTypeDescription
availablestringAvailable (withdrawable) amount
deductedstringDeducted penalty amount
depositstringLocked deposit amount
assetsarrayAdditional asset details

Example

// Request
{
"method": "getcrdepositcoin",
"params": {
"id": "ihfb4V1u..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"available": "0.00000000",
"deducted": "0.00000000",
"deposit": "5000.00000000",
"assets": []
},
"error": null
}

getsecretarygeneral

Returns the public key of the current CR secretary general.

Parameters

None.

Result

NameTypeDescription
secretarygeneralstringPublic key of the secretary general

Example

// Request
{
"method": "getsecretarygeneral",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"secretarygeneral": "0306e4f..."
},
"error": null
}

listcurrentcrs

Returns the current active CR council members.

Parameters

NameTypeDescription
statestringFilter: "all", "elected", "impeached", "returned"

Result

NameTypeDescription
codestringMember code
cidstringCRC ID
didstringDID
nicknamestringMember name
urlstringMember info URL
locationintegerLocation code
impeachmentvotesstringVotes cast for impeachment
depositamountstringDeposit amount locked
depositaddressstringDeposit address
penaltystringAccumulated penalty amount
indexintegerIndex in result set
totalcountsintegerTotal number of members matching the filter

Example

// Request
{
"method": "listcurrentcrs",
"params": {
"state": "all"
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"crmembersinfo": [
{
"code": "21024f3a...",
"cid": "ihfb4V1u...",
"did": "igNBwC2P...",
"nickname": "CR Council Member A",
"url": "https://example.com/cr-a",
"location": 86,
"impeachmentvotes": "0.00000000",
"depositamount": "5000.00000000",
"depositaddress": "8VYXVxKKSAxkmRrfmGpQR2Kc66XhG6m3ta",
"penalty": "0.00000000",
"index": 0
}
],
"totalcounts": 12
},
"error": null
}

listcrproposalbasestate

Returns a paginated list of CR proposal states.

Parameters

NameTypeDescription
startintegerStart index for pagination
limitintegerMaximum number of results
statestringFilter: "all", "registered", "cragreed", "voteragreed", "finished", "crcanceled", "votercanceled", "aborted"

Result

NameTypeDescription
proposalbasestatesarrayArray of proposal state objects with proposalhash, title, status, instate
totalcountsintegerTotal number of proposals matching the filter

Example

// Request
{
"method": "listcrproposalbasestate",
"params": {
"start": 0,
"limit": 5,
"state": "all"
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"proposalbasestates": [
{
"proposalhash": "ab12cd34...",
"title": "Community Development Fund",
"status": "VoterAgreed",
"instate": "Normal"
}
],
"totalcounts": 47
},
"error": null
}

getcrproposalstate

Returns detailed state information for a specific CR proposal.

Parameters

NameTypeDescription
proposalhashstring(option 1) Hash of the proposal
drafthashstring(option 2) Hash of the proposal draft

Provide either proposalhash or drafthash.

Result

NameTypeDescription
statusstringCurrent proposal status
proposalobjectFull proposal details including title, sponsor, budget, etc.
proposalstateobjectState machine details: tracking numbers, review info

Example

// Request
{
"method": "getcrproposalstate",
"params": {
"proposalhash": "ab12cd34..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"status": "VoterAgreed",
"proposal": {
"proposalhash": "ab12cd34...",
"type": "Normal",
"categorydata": "",
"ownerpublickey": "0306e4f...",
"drafthash": "ef56ab78...",
"budgets": [
{
"type": "Imprest",
"stage": 0,
"amount": "10000.00000000"
}
],
"recipient": "EXoXaT68VzPBRVpnqRFVkFMaTPmiiVzPqo"
},
"proposalstate": {
"registerheight": 500000,
"status": "VoterAgreed",
"votestartheight": 500010,
"votersagreeamount": "125000000.00000000"
}
},
"error": null
}

getproposaldraftdata

Returns the raw draft data for a CR proposal in hex format.

Parameters

NameTypeDescription
drafthashstringHash of the proposal draft

Result

NameTypeDescription
datastringHex-encoded draft data

Example

// Request
{
"method": "getproposaldraftdata",
"params": {
"drafthash": "ef56ab78..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": "0200010013313637...",
"error": null
}

getcrrelatedstage

Returns information about the current CR election and voting stage.

Parameters

None.

Result

NameTypeDescription
ondutyboolWhether the CR council is currently on duty
votingstartheightintegerBlock height when the current voting period started
votingendheightintegerBlock height when the current voting period ends
inelectionperiodboolWhether we are in an election period

Example

// Request
{
"method": "getcrrelatedstage",
"params": {},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"onduty": true,
"votingstartheight": 500000,
"votingendheight": 510000,
"inelectionperiod": false
},
"error": null
}

Cross-Chain

submitsidechainillegaldata

Submits evidence of illegal activity detected on a sidechain. Used by arbiter nodes to report sidechain misbehavior to the main chain.

Parameters

NameTypeDescription
illegaldatastringHex-encoded illegal data evidence

Result

NameTypeDescription
resultbooltrue if accepted

Example

// Request
{
"method": "submitsidechainillegaldata",
"params": {
"illegaldata": "02000100..."
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": true,
"error": null
}

getexistwithdrawtransactions

Checks which of the given withdrawal transaction hashes already exist on the main chain. Used to avoid duplicate cross-chain withdrawal processing.

Parameters

NameTypeDescription
txsarray<string>Array of withdrawal transaction hashes to check

Result

NameTypeDescription
resultarray<string>Subset of input hashes that already exist

Example

// Request
{
"method": "getexistwithdrawtransactions",
"params": {
"txs": [
"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6abcd",
"b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6abcdef"
]
},
"id": 1
}
// Response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6abcd"
],
"error": null
}

Resources