0

Curious approximately what the fee multiple might be to send ETH to 1, 10, 100 and 1,000 addresses in a single transaction?

2 Answers 2

1

The so-called multiple is actually the number of addresses.

For more information please refer to Ethereum YellowPager

1

You can't send Eth directly to multiple addresses with one transaction. One transaction is always to one address. And one Eth transfer (with no payload) costs 21000 gas - full cost depends on the used gas price.

What you can do, however, is create a contract which distributes the Ether to N receivers. So you can loop over the addresses and send Ether to each one.

The cost of executing this is probably easiest to test. The following with three addresses costs 49064 gas and with four 82076 gas, so adding one more address costs 33012 gas. Therefore adding 100 more addresses should cost about 3301200 gas.

Please note that this is not an elegant solution, not the most gas efficient and is only for testing purposes.

pragma solidity ^0.8.0;

contract A {
    function distribute() payable public {
        address[3] memory addresses = [address(0x0), address(0x1), address(0x2)];
        uint share = msg.value / addresses.length;
        for (uint i = 0; i < addresses.length; i++) {
            addresses[i].call{value: share}("");
        }
    }
}
1
  • Amazing answer, how can it be more gas efficient?
    – Ibra
    Oct 23, 2022 at 1:09

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.