For instance, the module is named "mymodule". It can be used in geth console and web3 like mymodule.funcA(),web3.mymodule.funcA(),



web3 is a JavaScript object.

You can add new functions like

web3.mymodule = {};
web3.mymodule.funcA = function() { /* Code goes here */ };

Not sure if you can import custom JavaScript files in the geth console. However you can achieve the same result by just running the javascript code in .js using node command as you would copy paste it to geth console.

  • I read this post customize-my-own-geth-command, but still don't know how the geth console parses commands(for instance "eth.accounts, eth.getBalance("addr")",etc.) and call different build-in modules, which should be written by both go and js. is here some execution framework? – Ntydrm May 16 '19 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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