0

I want to transfer the same amount of ether to 100 different addresses. I'd like to reduce the amount of gas for it.

I tried to do it with such contract:

contract MultiTransfer {

  function transferEther(uint amount, address[] users) public payable {
    require(amount * users.length == msg.value);
    for (uint i = 0; i < users.length; i++) {
      users[i].transfer(amount);
    }
  }

}

As result, it requires 3422830 gas for tx with 100 addresses. ~ 34K gas per 1 address. But it costs only 21K if transfer ether directly without contracts.

So smart contracts can't help to reduce gas for this task?

1 Answer 1

0

Yes, they can't help you. Smart contracts also create transaction for each address. And transaction cost is 21k gas.

Your Answer

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