jsFunction is a function in filename.js
>loadScript("/path/to/file/filename.js") true >jsFunction(<parameters>) <Returns the results as expected>
But when I try to do the same using the Non-interactive mode, it fails:
$ geth --exec 'loadScript("/path/to/file/filename.js")' attach ipc:/path/to/ipc true $ geth --exec 'jsFunction(<parameters>)' attach ipc:/path/to/ipc ReferenceError: 'jsFunction' is not defined at <anonymous>:1:1
I ran the same command (geth –exec) with normal web3.js functions like eth.getTransaction, eth.getBlock and it works fine. I don't understand what's wrong with executing custom scripts. Does geth client support this functionality? Am I missing something?
P.S: I am running a private blockchain but didn't mention –datadir, –networkid, and –genesis etc. in the above commands for readability.