eth_syncing
Returns an object with sync status data or false
when not syncing.
When to Use This Method
Use eth_syncing
to:
- Check Node Health - Verify node is fully synced
- Monitor Sync Progress - Track synchronization
- Validate Node Readiness - Ensure node is ready
- Troubleshoot Issues - Identify sync problems
Parameters
No parameters required.
{
"jsonrpc": "2.0",
"method": "eth_syncing",
"params": [],
"id": 1
}
Returns
Object|Boolean
- Sync status or false
:
false
when not syncing- Object with sync data when syncing:
startingBlock
- Starting blockcurrentBlock
- Current blockhighestBlock
- Estimated highest block
Implementation Examples
- JavaScript
- Python
const provider = new ethers.JsonRpcProvider('https://api-xdc-mainnet.n.dwellir.com/YOUR_API_KEY');
const syncStatus = await provider.send('eth_syncing', []);
if (syncStatus === false) {
console.log('Node is fully synced');
} else {
console.log('Syncing:', syncStatus);
}
w3 = Web3(Web3.HTTPProvider('https://api-xdc-mainnet.n.dwellir.com/YOUR_API_KEY'))
sync_status = w3.eth.syncing
if not sync_status:
print('Node is fully synced')
else:
print(f'Syncing: {sync_status}')
Related Methods
- eth_blockNumber - Get latest block
- net_listening - Check if listening