0

Trying to execute a transaction on Remix IDE which is connected to the Ethereum blockchain via Metamask.io Google Chrome extension.

Send transaction failed: invalid address . if you use an injected provider, please check it is properly unlocked. 
1
  • Create an account for the node:

    personal.newAccount() Passphrase: Repeat passphrase: "0x6a41c0972924d3c5efd59e6544bd008190b11bd1"

  • Unlock the account:

    personal.unlockAccount(eth.accounts[0]) Unlock account 0x6a41c0972924d3c5efd59e6544bd008190b11bd1 Passphrase: true

  • Reset Solidity Browser settings as follows: In the "Run" tab of your Solidity Browser change the "Environment" dropdown from "JavaScript VM" to "Web3 Provider". If this works correctly you will see "Account" field value now shows the above unlocked account "0x6a41c0972924d3c5efd59e6544bd008190b11bd1".
  • Now try to create an instance of your SmartContract. Hopefully it will work, showing the following success log:

    [block:538 txIndex:0] from:0x6a4...11bd1, to:greeter.(constructor), value:0 wei, 0 logs, data:0x606...00000, hash:0x30a...4caf6
    
1

In order to use the injected Metamask web3 provider with RemixIDE you will need to ensure the following:

  1. You have created an Ethereum account (or have imported one) in Metamask
  2. You have logged into/unlocked your Metamask account
  3. In RemixIDE you have selected the "Injected web3" option for the environment in the Run tab

If you have completed Step 3 above in Remix then the error message in question likely indicates that Remix is unable to retrieve your ETH address from Metamask.

To resolve this open the Metamask extension and ensure you are logged in and have an account selected, on the network you wish to interact with. Metamask should look something like this:

enter image description here

The "Run" tab in RemixIDE should also show the same account which is selected in Matemask when you have the "Injected web3" option selected for environment:

enter image description here

The above indicates that RemixIDE is able to retrieve your ETH address from the Metamask extension using the injected web3 provider.

At this point, you should be able to submit your transaction given you have enough ETH in your account to pay the gas fee for the relevant network.

0

I used an injected provider which basically allows the Remix IDE to be connected to the private network which is hosted on a server (not on localhost). The problem was that the Ethereum node's personal account with which I connected the Metamask.io and Remix need to be unlocked before performing any transaction. It can either be done the first time you create the private network using the flag --unlock 0 or everytime you connect to the private network, use the following command personal.unlockAccount(eth.accounts[0])

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.