I am facing this error , My Contract is quite simple

pragma solidity ^0.5.0;

contract sendEther {
  address payable sender;

  function showReceiver() public view returns (address payable) {
      return msg.sender;

  function sendEtherToReceiver(address payable _receiver, uint256 _amount) public payable {
    _receiver.transfer(_amount * 10**18);

Need help in fixing this, i am using MetaMask with ropsten test network Below is attached screenshot and error too. enter image description here

2 Answers 2


I can deploy your contract and call sendEtherToReceiver method successfully on Ropsten network



Do you miss to send value when calling sendEtherToReceiver function? You must to send value >= amount then contract will have enough ETH to transfer to receiver.

enter image description here

  • 1
    How much value did you set, can you send me an screenshot or something sorry i am beginner in this. Jul 17, 2019 at 16:08
  • 1
    The amount is not important, just equal to amount param when you call the method. Make sure that you have to send value in wei, mutiple by 10**18
    – Tony Dang
    Jul 17, 2019 at 16:12
  • 2
    Perfecto, you just saved me ! GodBless ;) Jul 17, 2019 at 16:16

The problem is that you're not sending ETH along with the transaction. In Remix, you'll use the field value (just below the field gas limit) to set how much you're sending along with the transaction.

So, by not sending any ETH, you are demanding that your CONTRACT use its own balance to execute the transfer. Since it has zero balance, the transaction will fail. If your contract had enough balance, it would work fine (but it's probably not doing what you expected).

Please note that if you just want it to work as a relay, meaning you just want to transfer what someone sent in that transaction (from his/her wallet), then you should use something like _receiver.transfer(msg.value);

And that means that your function would look like this:

function sendEtherToReceiver(address payable _receiver) public payable {

Your Answer

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

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