Updated on April 13, 2021
Istanbul RPC API
Getting Started
- Run Istanbul geth with
--rpcapi "istanbul"
geth attach
API Reference
istanbul.candidates
Candidates returns the current candidates which the node tries to vote in or out.
istanbul.candidates
Returns
map[string] boolean
- returns the current candidates map.
istanbul.discard
Discard drops a currently running candidate, stopping the validator from casting further votes (either for or against).
istanbul.discard(address)
Parameters
string
- the address of the candidate
istanbul.getSnapshot
GetSnapshot retrieves the state snapshot at a given block.
istanbul.getSnapshot(blockHashOrBlockNumber)
Parameters
String|Number
- The block number, the string “latest” or nil. nil is the same with string “latest” and means the latest block
Returns
Object
- The snapshot object
istanbul.getSnapshotAtHash
GetSnapshotAtHash retrieves the state snapshot at a given block.
istanbul.getSnapshotAtHash(blockHash)
Parameters
String
- The block hash
Returns
Object
- The snapshot object
istanbul.getValidators
GetValidators retrieves the list of authorized validators at the specified block.
istanbul.getValidators(blockHashOrBlockNumber)
Parameters
String|Number
- The block number, the string “latest” or nil. nil is the same with string “latest” and means the latest block
Returns
[]string
- The validator address array
istanbul.getValidatorsAtHash
GetValidatorsAtHash retrieves the list of authorized validators at the specified block.
istanbul.getValidatorsAtHash(blockHash)
Parameters
String
- The block hash
Returns
[]string
- The validator address array
istanbul.propose
Propose injects a new authorization candidate that the validator will attempt to push through. If the number of vote is larger than ½ of validators to vote in/out, the candidate will be added/removed in validator set.
istanbul.propose(address, auth)
Parameters
String
- The address of candidate bool
- true
votes in and false
votes out
istanbul.nodeAddress
Retrieves the public address that is used to sign proposals, which is derived from the nodes nodekey
.
istanbul.nodeAddress()
Returns
string
- The nodes public signing address
istanbul.getSignersFromBlock
Retrieves the public addresses for whose seals are included in the block. This means that they participated in the consensus for this block and attested to its validity. A block number may be optionally given, or else the current block is assumed.
istanbul.getSignersFromBlock(blockNumber)
Parameters
Number
- The block number to retrieve
Returns
Object
number
:Number
- The retrieved block’s numberhash
:String
- The retrieved block’s hashauthor
:String
- The address of the block proposercommitters
:[]String
- The list of all addresses whose seal appears in this block
istanbul.getSignersFromBlockByHash
Retrieves the public addresses for whose seals are included in the block. This means that they participated in the consensus for this block and attested to its validity. A block hash must be given, and does NOT default to the current latest block.
istanbul.getSignersFromBlockByHash(blockHash)
Parameters
String
- The hash of the block to retrieve
Returns
Object
number
:Number
- The retrieved block’s numberhash
:String
- The retrieved block’s hashauthor
:String
- The address of the block proposercommitters
:[]String
- The list of all addresses whose seal appears in this block
istanbul.status
Returns the signing status of blocks for a given block range. If the start block and end block numbers are not provided, it returns the status of the last 64 blocks by default.
istanbul.status(startBlockNumber,endBlockNumber)
Parameters
Number
- start block numberNumber
- end block number
Returns
Object
numBlocks
:Number
- number of blocks for which sealer activity is retrievedsealerActivity
:map[string]Number
- key is the validator and value is the number of blocks sealed by the validator
istanbul.isValidator
Returns true
if this node is the validator for the given blockNumber
. If blockNumber is not provided it takes the latest block number by default.
istanbul.isValidator(blockNumber)
Parameters
Number
- block number
Returns
Boolean
- validator status of this node for the givenblockNumber
.