Question: 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](https://i.stack.imgur.com/2PDy5.png)](https://i.stack.imgur.com/2PDy5.png)

Answer: 
Actually, you should not send part of a transaction to all token holders. That is possibly infinitely expensive to do (because your list of token holders can grow indefinetely, I assume). There's no way of doing exactly that in the EVM.

Just to clarify, imagine you have ten thousand token holders and someone just wants to send 1 token to a friend. How much gas will that person pay to make that 1 token transfer? She will have to pay for 9,999 transfers! Most probably, the transaction will just fail because it will run out of gas.

*Note that that will hold even if you are just emitting events, instead of actually using `.transfer`*

You should change your approach in order to meet your objective. You'll need to work with a dividends *proportion*, so that you can calculate how much a given user is entitled to when that user wants to withdraw dividends, or consult how much she owns.

You'll also need to track how much a user has withdrawn before.

The full implementation is far too complex to put here, but you can follow these three links for a more in-depth explanation and to see some examples:

<https://medium.com/@weka/dividend-bearing-tokens-on-ethereum-42d01c710657>

<https://medium.com/@dejanradic.me/pay-dividend-in-ether-using-token-contract-104499de116a>

[ERC20 Token and effective way to store dividends](https://ethereum.stackexchange.com/questions/10864/erc20-token-and-effective-way-to-store-dividends)

Also, take a look at this: <https://github.com/Roger-Wu/erc1726-dividend-paying-token>

I think this last one is *exactly* what you're looking for.
If you have stored the list of all the account holders in an array, you can iterate over this array and transfer them dividend and emit the event as well.

But better instead of transferring in a loop, you can create a dividend mapping and update the dividends of each person when needed and emit an event. The dividend eligible people can then withdraw this dividend when they want to.