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

145
Visualizações
Transfer ether from a contract address to an actual Ethereum address

I'm trying to send ether from a contract address generated by Truffle and use it as a sender to an Ethereum address (the current injected Metamask account). I already have transferred the ether from a source wallet to a contract using Truffle console, and I tried to copy the address of the contract and use it in web3.sendTransaction method in Web3JS. However, the console.log yields the following error:

Invalid parameters: must provide an Ethereum address.

This is my Javascript code:

// transfer ether fxn (requires callback function)
function transfer () {
  var callback = function(error, res) {
    if(!error) {
        console.log(res);
    }
    else {
        console.log(error);
    }
  }

  web3.eth.sendTransaction({
    to: web3.eth.accounts[0], // current injected Metamask account on the DApp
    from: '0x6509ee304ec8476cfa7e9074f2be5fcfb18e18b4', // the contract address from Truffle, yields the invalid parameters error
    value: web3.toWei('0.01', 'ether')
  }, callback);

}
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