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

548
Vistas
Uncaught Error: invalid address when transferring token

When I try to transfer the token from 1 address to another, the error in the title pops up. Here is my relevant JS code: ($("#targetAddr").val() is the address of the target address (in metamask) and $("#amt").val() is the value of the tokens to transfer to.)

tokenContract.transfer($("#targetAddr").val().toString(),$("#amt").val())

I am using a smart contract that is very similar to OpenZepplin's ERC20. Its transfer is similar to ERC20's transfer function. What am I doing wrong?

Below is the code of my token contract setup in javascript:

var tokenContractAddress = token_contract_address;
//coinABI is the ABI from my smart contract.
var tokenContract = web3.eth.contract(coinABI).at(tokenContractAddress);

The address that is in the input is one of the addresses in my metamask account (essentially a valid address)

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to construct an actual transaction with web3 or other framework you're using. Here is an example with web3: https://ethereum.stackexchange.com/questions/24828/how-to-send-erc20-token-using-web3-api

If you have a different version, go to their docs: https://web3js.readthedocs.io/en/v1.3.4/index.html

And see methods for sending a transaction to a contract. You need to send a tx to the token contract that will call token's native transfer() method with neede arguments. you will need to sign this transaction and then send it.

about 4 years ago · Juan Pablo Isaza Denunciar
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