The doc says that scripts can be executed with : geth --exec 'loadscript("script.js")' attach, but in the example script they give right after, they say to use geth js script.js 2>>geth.log.

What is the difference between the two ?

  • I believe those are two ways of doing the same thing.
    – user5135
    Dec 1, 2016 at 18:14

1 Answer 1


You can reference this document for most of your Geth command line needs.

  --exec value           Execute JavaScript statement (only in combination with console/attach)
  • Thank you ! Any ideas what the 2 in 2>>geth.log means ? I still have a lot of blur around javascript execution. How do I pass arguments (can I) ? How do I return values ? Why are a lot of commands of the js console not authorized in scripts, and which one are authorized exactly ? The only doc I managed to find around scripts explicitly is the very long example script, with no explanation at all. Do you know anywhere I could find more detailed help ? Dec 1, 2016 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.