9

Here is the transaction I am trying to send using web3.eth.sendTransaction:

{
   data: "0x11a861a700...."
   from: "0x8ccb1711ea5562596f146608fdcf27ccf0d5429c"
   gas: "0x6b540"
   gasPrice: "0xaf16b1bb3"
   nonce: "0x0"
   to: "0x7113dd99c79aff93d54cfa4b2885576535a132de"
   value: "0x38d7ea4c68000"
}

It keeps getting back with the following message:

MetaMask - RPC Error: Invalid parameters: must provide an Ethereum address.

Is there some kind of other form this TX should be fed to web3?

edit. This transaction was generated by https://1inch.exchange/#/api using the following GET request:

https://api.1inch.exchange/v1.1/swap?fromTokenSymbol=ETH&toTokenSymbol=BAT&amount=2000000000000000&fromAddress=0x8ccb1711ea5562596f146608fdcf27ccf0d5ZYZc&slippage=1&disableEstimate=true

edit. XYZ addresses are just placeholders.

luiquao
  • 191
  • 1
  • 1
  • 4
  • Well, neither 0x8ccb1711ea5562596f146608fdcf27ccf0d54XYZ nor 0x7113dd99c79aff93d54cfa4b2885576535a13XYZ is a valid Ethereum address, so what exactly are you expecting??? – goodvibration Oct 06 '20 at 09:05
  • @goodvibration I am simply concealing my addresses. – luiquao Oct 06 '20 at 09:11
  • Why? It's not a private key that needs to be concealed! – goodvibration Oct 06 '20 at 09:13
  • anything else to add? – luiquao Oct 06 '20 at 09:15
  • Try to encapsulate each one of them with Web3.utils.toChecksumAddress(...). – goodvibration Oct 06 '20 at 09:16
  • BTW, there is no toAddress value in your GET request. – goodvibration Oct 06 '20 at 09:17
  • I too am facing the same issue. I have two buttons on the page both pointing to different wallet addresses; First Button: – Arrnaya May 23 '21 at 03:58

3 Answers3

8

I had the same issue, and it was not about specifying a wrong address in terms of format (incorrect hexadecimal structure), but putting one of the addresses in the wrong place within the parameters of the transaction. In my case:

    const txParams = {
        from: fromAccount,  // The error was here!
        to: toAccount,
        data: encodedData,
        value: 0,
        chainId: chainId,
    };

When calling the function from a contract, I incorrectly put the contract address in the 'from' instead of putting the caller address.

Therefore, I assume this issue should be normally addressed by reviewing that 'from' and 'to' addresses are correctly set.

Sergi Juanati
  • 3,399
  • 3
  • 17
  • 38
  • Hi can you please have a look at my question. https://ethereum.stackexchange.com/questions/120470/remix-invalid-parameters-must-provide-an-ethereum-address – kd12345 Feb 01 '22 at 13:33
4

I had this issue as well when I forgot to provide the transaction parameters in an array.

Bad:

ethereum.request({ method: 'eth_sendTransaction', params: txParams })

MetaMask - RPC Error: Invalid parameters: must provide an Ethereum address.

Good:

ethereum.request({ method: 'eth_sendTransaction', params: [txParams] })
2

I had this issue and in my case, the wallet was not connected to the web site. A simple click on "connect" in Metamask did the job. Kind of a misleading error message in this scenario.

George
  • 36
  • 2
  • Hi can you please have a look at my question. https://ethereum.stackexchange.com/questions/120470/remix-invalid-parameters-must-provide-an-ethereum-address – kd12345 Feb 01 '22 at 13:33
  • I was connected, but my metamask was not on my connected wallet. By only changing the wallet it worked – n3n3 Apr 29 '22 at 15:30