1

In bitcoin-land, it's advised to batch transactions to send them to (a) reduce fees and (b) reduce network congestion.

Does the same apply to ethereum land? It seems that the to can be only one address / account. But can there be many froms?

Is there a benefit to doing so?

  • individual transaction can have only 1 from, and also only 1 to. – Nulik May 11 '18 at 22:02
0

On Ethereum, you can have a smart contract with batch transfer functionality, the function would take two arrays as input arguments, one for addresses and one for values. It would then iterate through the input arrays and call transfer as as many times as your length, however, it is a solidity anti-pattern to interact with untrusted external contracts in one single transaction.

  • But an individual transaction can only have one from and one to? – Shamoon May 11 '18 at 16:31
  • yes if you're complying to the ERC20 standard. – phant0m May 11 '18 at 16:38
0

It is possible to send ether from one address to several addresses in one transaction, but it is not possible to send from many addresses unless they are smart contracts.

In order to send ether to multiple addresses in one transaction, you just need to deploy the contract similar to this:

contract BatchSend {
    constructor () public payable {
        address (0x<first address>).transfer (<first amount>);
        address (0x<second address>).transfer (<second amount>);
        ...
        selfdestruct (address (0x<last address>)); // Will send all the rest
    }
}

and along with constructor call you will need to pass total amount of ether to be send, otherwise your transaction will fail.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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