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

142
Vistas
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 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