ethereum-docker
ethereum-docker copied to clipboard
Add support for running arbritary scripts against the nodes
For example (the below script) -
i = 0;
while (i < eth.accounts.length) {
account = eth.accounts[i];
balance = web3.fromWei(eth.getBalance(account), "ether");
console.log("Account: " + account);
console.log("Balance: " + balance + '\n');
i++;
}
Can be run like -
docker exec -it bootstrap geth --datadir=~/.ethereum/devchain --jspath "/tmp/scripts" --exec 'loadScript("getAccountBalances.js")' attach
Should wrap this up to make it a bit easier to consume and less convoluted
@tayzlor Here's what I got
# Use loadScript
npm run exec -- 'loadScript("/src/helloworld.js")'
# Or just load
JS=./src/helloworld.js npm run load
More at https://github.com/katopz/ethereum-docker#to-run-external-javascript-file
Want me to PR? :)