Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

547
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!