I read this example http://solidity.readthedocs.io/en/latest/solidity-by-example.html#simple-open-auction to learn how to let my smart contract recieve eth from external account. It seems that I need a simple payable function. So I wrote a contract with a simple payable function on Remix and test it with MetaMask (Ropsten Network), sending 1 eth from my external account to my contract. Failure, MetaMask tells me the contract throw an exception. So, I added to the contract a fallback function and tried again to send eth. It worked! But the example linked above doesn't tell me I need a fallback function, and I can't performe data storage (like store msg.value and msg.sender into variables) in a fallback function, cause it requires more gas that it can have!

Please, help me. I know it's a noob question but I can't figure out.

The very few contract's row: enter image description here

THE ERROR: enter image description here

Thanks to everyone!

  • 3
    adding your contract code and the errors would definitely make it easier for people to help May 28, 2018 at 13:18

3 Answers 3


The problem is that even if you have a payable function in your contract you're not calling it. You have to call the function directly. If you do not call any specific function directly (which happens if you just send Ether with Metamask), the fallback function will be called (if such exists).

Unfortunately Metamask does not seem to support calling contract functions directly. You need some additional tools (or different tools). Check out Metamask: How to access/call deployed contract's functions using Metamask for example.


It looks ok, you just need to deploy the contract on the ropsten network (select JavaScript VM from the top right menu on remix). Then use metamask to send ether to the contract after it gets deployed. Obviously for complex operations you are gonna need a normal function, public and payable, like the "bid" function you already got.

p.s the fallback function is needed when you want your contract to accept ether without executing a function, like when you want to send ether from metamask to the contract.


Here's a simple contract I made that is payable for the makeWish function. Essentially you can throw some ether at it and get your wish text string added to the blockchain in the form of an Event.

Here's the contract code: https://etherscan.io/address/0x592F9B9A7D7AaF70FD6b4dE9883a62cA888DE702#code

You can interact with it via MetaMask here: https://etherscan.io/address/0x592F9B9A7D7AaF70FD6b4dE9883a62cA888DE702#writeContract

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.