I'm setting up a dApp (truffle framework) with an escrow contract that holds the money from the buyer of a product before it's released to the seller. When the user clicks "order", I am able to do an eth.sendTransaction from the buyer to the contract. I want the payment to be released when the user clicks "received item" and I can't seem to call the function that releases the payment to the seller from web3js. I receive this error:

Error: invalid address
    at inputAddressFormatter

Is this because MetaMask doesn't allow the contract (since it's not imported as an account) perform the transfer? If so, what should I change about my contract?

Here's my contract code:

  function EscrowPayment(address _seller){
    // constructor
    buyer = msg.sender;
    seller = _seller;

  function getSeller() constant returns(address) {
    return seller;

  function () payable{


  function payoutToSeller() payable {

As a note, I'm able to call on payoutToSeller() through the truffle console and it works.

1 Answer 1


This error usually means you have set the sender to an invalid address. This can happen because:

  • The user has not unlocked any accounts for you to send from (empty accounts array)
  • You are not using the injected web3 provider to request current accounts, and so are not actually viewing MetaMask accounts.

You can see some examples of detecting accounts correctly in this guide: https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md#partly_sunny-web3---ethereum-browser-environment-check

  • Thanks for the info! So what I'm trying to do is getting a contract to send its balance to the seller (who is in the contract). I'm not sure how to import the contract as an account to metamask, or if that's even acceptable. So if I don't import, does that mean I can't perform this action through web3?
    – jwu
    Jul 19, 2017 at 16:10
  • That's a very different question, and gets to some basics of interacting with contracts. I recommend going through a full tutorial like this one: karl.tech/learning-solidity-part-1-deploy-a-contract
    – DanF
    Jul 23, 2017 at 8:03

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.