Last active
July 10, 2016 19:28
-
-
Save p-s-dev/596c1ccdd49c1d1c6d0f9e89c3aca048 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
geth --preload 'monitorBlocks.js' attach |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// every half second, if the block is different: print new block number and delta since last block number | |
previousBlockNumber = web3.eth.blockNumber; | |
(function () { | |
function f() { | |
b = web3.eth.blockNumber; | |
if (b != previousBlockNumber) { | |
console.log("block: " + b + ", diff:" + (b - previousBlockNumber)); | |
previousBlockNumber = b; | |
} | |
setTimeout( f, 500 ); | |
} | |
f(); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment