I have follow this SO answer for sending ERC20 tokens from 1 address to another. I am running into an issue where I am receiving an error that my from address is invalid

Error: Error: WalletMiddleware - Invalid "from" address.

The from address works just fine when I use the web3 function contract.balanceOf, so I am not sure why it says my address is invalid

Here is my code:

    '0x002FaCf5B2e8441c7ECb4eb6dCfD9C7b46320c97', //toaddress
    web3.toWei(1, "ether"),      //send 1 token
        from:'0xb8fd65fc6919c5b97453eaba6b895144597985b2' //fromaddress
    }, function(err, transactionHash)
  • Can you share the code where you use getAccounts() ? Your question does not seem to match with your description, please make the connection between those two points. – kuzdogan Feb 4 '20 at 12:25

I didn't see where web3.eth.getAccounts() is used in your code, but this is javascript promise and you might wanna use it this way to get the accounts:

web3.eth.getAccounts(function(error, accounts) {
if(error) {
} else {
  • thanks for your answer. Unfortunately I receive an empty array from accounts – Barney Chambers Sep 2 '19 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.