I have a four node setup and have get method in smartcontract to get the status of certain application. Currently the api invocation is happening at any node ( any of four nodes). For example if one of the node is syncing to other nodes ( was down for some time) in the network and if my api call is triggered at the syncing node the data which I am getting won't be the latest one. So is there anyway to identify the node is in sync with network and then perform the api get call or am I wrong with my understatnding.

4 Answers 4


Is my node connected to peers?


Is my node syncing?


Is my node fully synced? (should be 0)

web3.eth.syncing.highestBlock - web3.eth.syncing.currentBlock

You may use method web3.eth.isSyncing to know whether node is still synchronizing. You may use web3.eth.getBlockNumber to know what block node is currently at.

You better check both, because node may think that it is synchronized, but may actually be disconnected form the network.


As say in other answer you should use web3.eth.isSyncing but just to be precise this function :

  • if is synced, returns false
  • if is syncing, returns startingBlock, currentBlock, highestBlock, knownStates pulledStates
  • if is just started / not connected to other nodes, returns false

The last case can be tricky as it gives you false positive.


You can use trustray open source


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.