I am watching an event from a contract in geth, using the callback function, such as:


Once the event is detected, I would like to execute an external command (such as save details of the event to a file on my computer). Is there a way to do it in geth?

If not, how else can I watch contracts and trigger execution of an non-Ethereum command?

1 Answer 1


No you can't as is, from geth console. But the the above code you have posted is javascript,so you have all the possibility of what you could do from java script. For example you can have it running as a Dapp, and in the call back function you call a post to your server which can record the result data. You also have the option of using node.js as one of server and can do almost everything like filesystem access and many more, you can follow https://github.com/ethereum/web3.js/

  • Is there a tutorial to do this anywhere? I would have thought reading/writing to a file from the javascript console would be a trivial task. Sep 10, 2016 at 19:01

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.