Skip to content

Instantly share code, notes, and snippets.

@dleonard00
Created June 20, 2018 14:08
Show Gist options
  • Save dleonard00/980ceca4be2c6542dc95efbca9313cfd to your computer and use it in GitHub Desktop.
Save dleonard00/980ceca4be2c6542dc95efbca9313cfd to your computer and use it in GitHub Desktop.
show geth sync progress
var lastPercentage = 0;var lastBlocksToGo = 0;var timeInterval = 10000;
setInterval(function(){
var percentage = eth.syncing.currentBlock/eth.syncing.highestBlock*100;
var percentagePerTime = percentage - lastPercentage;
var blocksToGo = eth.syncing.highestBlock - eth.syncing.currentBlock;
var bps = (lastBlocksToGo - blocksToGo) / (timeInterval / 1000)
var etas = 100 / percentagePerTime * (timeInterval / 1000)
var etaM = parseInt(etas/60,10);
console.log(parseInt(percentage,10)+'% ETA: '+etaM+' minutes @ '+bps+'bps');
lastPercentage = percentage;lastBlocksToGo = blocksToGo;
},timeInterval);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment