[Ethereum] MetaMask – RPC Error: Error: WalletMiddleware – Invalid “from” address

addresseserrormetamaskrpc

I'm trying to create a simple Dapp (via tutorial) which would allow me to send Ether from sender to receiver (via a contract with an address that automatically approves the transaction). The truffle test server is local. I get the following error.

Error: Error: Returned error: Error: WalletMiddleware - Invalid "from" address. at l (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:1243523) at async chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/background.js:1:1241740

According to the tutorial I've setup and deployed the contract and created a html page that interfaces with the server. I'm using Chrome with Metamask installed. What should happen is that when I put the send and the receiving address into the web form page Metamask should pop up in chrome allowing me to sign the amount before submitting.

In the Chrome development console it highlights that the code block generating the error is (this is in my index.html file):

    AprrovalContract.methods.deposit(toAddress).send({from: fromAddress, gas: 100000, value: web3.utils.toWei(amount,'ether')},
  function(error, result) {
    if (error) {
      console.log('error: '+ error);
        $('#deposit-result').html('Error: ' + error);
    } else {
      $('#deposit-result').html('Success TX: <b>' + result + '</b>');
    }
  })

Thanks

Best Answer

Try adding this script to your HTML code: https://code.jquery.com/jquery-migrate-1.4.1.min.js

Related Topic