This method should notify a dapp when the node is syncing (e.g. importing more than 10 blocks), so that dapps can stop asking nodes or process incoming blocks for performance reasons.
We might add fields in the future for state db syncing.
Returns an object object with data about the sync status.
none
Object|Boolean
, An object with sync status data or FALSE
, when not syncing:
startingBlock
:QUANTITY
- The block at which the import started (will only be reset, after the sync reached his head)currentBlock
:QUANTITY
- The current block, same as eth_blockNumberhighestBlock
:QUANTITY
- The estimated highest block
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_isSyncing","params":[],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": {
startingBlock: '0x384',
currentBlock: '0x386',
highestBlock: '0x454'
}
}
// Or when not syncing
{
"id":1,
"jsonrpc": "2.0",
"result": false
}
in web3 i would create a polling automatically under the hood and you can simple register a callback, which gets fired when a sync starts or stops and updates. We could then easily transform that later to a push API under the hood: