I'm testing and creating a smart contract to send some ether to one account using TestRPC, Truffle and Metamask.

I have a page with a button, when i click on the button it fires the event submitEtherWallet

submitEtherToWallet: function() {

      return instance.sendTransaction({from: account, to: instance.address, value: web3.toWei(5, 'ether')});

    }).then(function(result) {

The method aparently is working well, because metamask open a popup to confirm the transacation.

enter image description here

After click to submit the transaction:

enter image description here

3 Answers 3


Are you sure, in the code, that "from: account" refers to accounts[0] ?

  • Yes, it does. In the start function it fills the account with accounts[0], also I tried to change the account to accounts[0] and happened the samething. Commented Nov 22, 2017 at 18:49

After few hours stucked with this issue, I realized that aparently my metamask was running in a different instace of web3 than my testrpc, it's a weird situation.

Metamask was oppening the correct account popup to confirm the transaction, but in the backend metamask was trying to send the transaction with a different account, I don't know how this happened but I replaced my addEventListener back to the original from truffle webpack and aparently it fixed the issue.

window.addEventListener('load', function() {
  // Checking if Web3 has been injected by the browser (Mist/MetaMask)
  if (typeof web3 !== 'undefined') {
    console.warn("Using web3 detected from external source. If you find that your accounts don't appear or you have 0 MetaCoin, ensure you've configured that source properly. If using MetaMask, see the following link. Feel free to delete this warning. :) http://truffleframework.com/tutorials/truffle-and-metamask")
    // Use Mist/MetaMask's provider
    window.web3 = new Web3(web3.currentProvider);
  } else {
    console.warn("No web3 detected. Falling back to You should remove this fallback when you deploy live, as it's inherently insecure. Consider switching to Metamask for development. More info here: http://truffleframework.com/tutorials/truffle-and-metamask");
    // fallback - use your fallback strategy (local node / hosted node + in-dapp id mgmt / fail)
    window.web3 = new Web3(new Web3.providers.HttpProvider(""));


As you can see in the printscreen, metamask was trying to send the transaction through the wallet "0xf9..." and not with the wallet that was in the popup.


You can restart testrpc. I faced the same problem, restarting testrpc fixed the problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.