I'm writing a compeltely pointless contract that has the sole purpose of at least putting a transaction into every block on the chain, while it is running. This is a part of the the javascript:
var checkNewBlock = function() {
if(currentBlock != web3.eth.blockNumber) {
currentBlock = web3.eth.blockNumber;
console.log("adding some crap to block " + currentBlock);
try {
crapInstance.addCrap({from:from});
}
catch(e) {
currentBlock--;
}
}
}
setInterval(checkNewBlock, 1000);
This works great. Here's some of the output:
adding some crap to block 322707
adding some crap to block 322708
Error response: Known transaction (9f14133a)
adding some crap to block 322708
adding some crap to block 322709
Error response: Known transaction (9f14133a)
adding some crap to block 322709
adding some crap to block 322710
Error response: Known transaction (9f14133a)
adding some crap to block 322710
adding some crap to block 322711
adding some crap to block 322712
adding some crap to block 322713
adding some crap to block 322714
adding some crap to block 322715
adding some crap to block 322716
Now I have two questions:
1. Why are there sometimes known transaction? what are they?
2. When I monitor the number of transactions on stats.ethdev.com, I still quite regularly see blocks with 0 transactions, while my script even re-attempts on failures (see the try/catch)
0 ·
Comments
ok now for some more serious application ...