Skip to content

Instantly share code, notes, and snippets.

@akirattii
Created December 4, 2016 11:57
Show Gist options
  • Save akirattii/18678ed86bb176418c5b70b031a72aab to your computer and use it in GitHub Desktop.
Save akirattii/18678ed86bb176418c5b70b031a72aab to your computer and use it in GitHub Desktop.
How to know how long your mining block will be found on Ethereum.
// How long it will take for finding your mining block
// will be known from your 'hashrate' and the latest block's 'difficulty':
etm = eth.getBlock("latest").difficulty / miner.hashrate; // estimated time in seconds
Math.floor(etm / 3600.) + "h " + Math.floor((etm % 3600) / 60) + "m " + Math.floor(etm % 60) + "s";
// 1h 3m 30s
// ref. https://ethereum.gitbooks.io/frontier-guide/content/mining_with_geth.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment