I am executing a function with Web3 like this:
MyContract.deployed().then(function (contractInstance) {
return contractInstance.MyFunction(parameter1, parameter2, { gas: 200000, from: web3.eth.accounts[0] })
})
This works fine running the app on http://localhost:8080 with Chrome in incognito (so there's no MetaMask, which I have installed) - so the web3.eth.accounts[0]
that executes the function will be the account I setup in Geth.
However, if I run the app in a normal Chrome window, where MetaMask will be active (thus it'll be using a different account) the following error will occur:
Uncaught (in promise) Error: invalid address
Removing the web3.eth.accounts[0] part, so I run the function like this:
return contractInstance.SetMessage(key, string1, string2, string3, string4, { gas: 200000})
Also fails. How should this be done correctly?