Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

120
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda