Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for running arbritary scripts against the nodes #8

Open
tayzlor opened this issue Apr 28, 2016 · 1 comment
Open

Add support for running arbritary scripts against the nodes #8

tayzlor opened this issue Apr 28, 2016 · 1 comment

Comments

@tayzlor
Copy link
Contributor

tayzlor commented Apr 28, 2016

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

@katopz
Copy link

katopz commented Oct 26, 2017

@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? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants