-
Notifications
You must be signed in to change notification settings - Fork 26
JSON RPC API
It is fully compatible with Ethereum JSON RPC interface. This document only lists additional interfaces.
Default JSON-RPC endpoints:
- localhost:18545
You can start the HTTP JSON-RPC with the --rpc flag 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:
geth --rpc --rpccorsdomain "http://localhost:3000"
The JSON RPC can also be started from the geth console using the admin.startRPC(addr, port) command.
List the last blocks info
Parameters
- limit , Default 20
- norpc , if true respone as rpc format else console format, Default false
params:[3,false]
Returns List the last blocks info
Example
Request
curl -X POST --data '{"jsonrpc":"2.0","method":"tribe_getHistory","params":[3,false],"id":1}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"number": 39565,
"hash": "0x08c19ad2c444ab3875d8f4021da1b4b00ba0d253fb5f8063124fa7872eb5c423",
"signer": "0x3a5fbac6ca913599c5fde8c1638db58d01de8a48",
"difficulty": 2,
"timestamp": 1525675860
},
{
"number": 39564,
"hash": "0xf07e1c9d0721e979224eb23b676f974a8428b08c96e6fd6c73c73a358c2fc621",
"signer": "0x00ab501f3fe4b2f71651764699ec5752598e679f",
"difficulty": 2,
"timestamp": 1525675845
},
{
"number": 39563,
"hash": "0xcf374b2b815933a9097106b84652365a1cd4adbd4195bf711332002ecda7c897",
"signer": "0x7b06dd132c089034157f1e1aacda75787df1e0c5",
"difficulty": 2,
"timestamp": 1525675830
}
]
}
Get a list of signers in the specified block
Parameters
- block hash , Default last block bash
params:["0xaecea29d1411b6a3788f0772e1df52f837a4f754fb3ef152f860e8a2aaf88219"]
Returns List of signers
Example
Request
curl -X POST --data '{"jsonrpc":"2.0","method":"tribe_getSigners","params":["0xaecea29d1411b6a3788f0772e1df52f837a4f754fb3ef152f860e8a2aaf88219"],"id":1}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x3a5fbac6ca913599c5fde8c1638db58d01de8a48",
"score": 3
},
{
"address": "0xad4c80164065a3c33dd2014908c7563eff88ab49",
"score": 3
},
{
"address": "0xc22d53456abd14da347517a4b47ea24866b8e3ae",
"score": 3
}
]
}
Get consensus status in the specified block
Parameters
- block hash , Default last block bash
params:["0xaecea29d1411b6a3788f0772e1df52f837a4f754fb3ef152f860e8a2aaf88219"]
Returns Consensus status
Example Request
curl -X POST --data '{"jsonrpc":"2.0","method":"tribe_getStatus","params":["0xaecea29d1411b6a3788f0772e1df52f837a4f754fb3ef152f860e8a2aaf88219"],"id":1}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"signers": [
{
"address": "0x3a5fbac6ca913599c5fde8c1638db58d01de8a48",
"score": 3
},
{
"address": "0xad4c80164065a3c33dd2014908c7563eff88ab49",
"score": 3
},
{
"address": "0xc22d53456abd14da347517a4b47ea24866b8e3ae",
"score": 3
}
],
"volunteers": [],
"signerLevel": "None",
"number": 3,
"totalSinner": 0,
"epoch": 5760,
"signerLimit": 17,
"volunteerLimit": 70
}
}
Get current sinner list (black list)
Returns sinner list , keep 24H
Example Request
curl -X POST --data '{"jsonrpc":"2.0","method":"tribe_getSinners","params":[],"id":1}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
"0x8e97c702752cb3c1eeabd9df0c4b99c59f34cf0b",
"0x76a45989dd96f58d5cf3d36153068d7b347f7b55"
]
}
Get miner info of current node
Returns Current miner info
Example Request
curl -X POST --data '{"jsonrpc":"2.0","method":"tribe_getMiner","params":[],"id":1}'
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"address": "0x50f7e76132761392373e2616efcc819e24a14f42",
"balance": 0,
"level": "None"
}
}