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.
personal.newAccount() Passphrase: Repeat passphrase: "0x6a41c0972924d3c5efd59e6544bd008190b11bd1"
personal.unlockAccount(eth.accounts[0]) Unlock account 0x6a41c0972924d3c5efd59e6544bd008190b11bd1 Passphrase: true
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
In order to use the injected Metamask web3 provider with RemixIDE you will need to ensure the following:
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:
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:
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.
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])