Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

121
Vistas
How to add node modules in Geth JavaScript console

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

enter image description here

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');

enter image description here

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!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda