I'm using Geth for bloackchain transactions. In the miner console we have some already existing commands. I wanted to create some more functions in a JavaScript file- (functions.js). So I'm using loadScript to load the script. - https://geth.ethereum.org/docs/interface/managing-your-accounts
In the functions.js, I have created some functions like
function printAllETHBalances() {
for (var acctNum in eth.accounts) {
...
}
return true;
};
function transferUSD(senderAddress, receiverAddress , amount, password){
return personal.sendTransaction({
from: senderAddress,
...
}, password)
};
Now I wanted to import and use node modules in the JavaScript functions. Adding import statement in JavaScrript functions file, gives the error.
var http = require('http'); // Error - Cannot find module 'http'
var fs = require('fs');
How do I add node module, Is there any way to preload the node modules in the Geth Console.
I know this question is already asked - https://ethereum.stackexchange.com/questions/6696/using-node-js-modules-code-from-the-javascript-console-of-geth Thanks in Advance!