bitchin tricks - rotblauer/go-ethereum-1 GitHub Wiki
Bitchin' Tricks
Geth
General
- My
shitclient doesn't work! :fu:
git pull
Mining
- I only want to mine when there are transactions!
var mining_threads = 1
function checkWork() {
if (eth.getBlock("pending").transactions.length > 0) {
if (eth.mining) return;
console.log("== Pending transactions! Mining...");
miner.start(mining_threads);
} else {
miner.stop();
console.log("== No transactions! Mining stopped.");
}
}
eth.filter("latest", function(err, block) { checkWork(); });
eth.filter("pending", function(err, block) { checkWork(); });
checkWork();
Courtesy @chfast
Quick scripts
- I want to get some data out without running a node!
$ geth --exec "eth.accounts" console 2>/dev/null
["0x0000000000000000000000000000000000000000"]
- I want to get some data out without RPC magic!
$ geth --exec "eth.accounts" attach
["0x0000000000000000000000000000000000000000"]