3

I have 3 account

1st account 1000 ether 2nd account 20 ether 3rd account 30 ether

now I want to transfer 100 ether from 1st account to both 2nd and 3rd account

2

You are thinking on batching transactions.

If you worked with bitcoin before, this is quite straightforward as you can set N number of outputs to your transactions (therefore sending to multiple addresses).

On Ethereum, you need to have a contract in the middle to which you want to send 1 transaction with all the data you want to split inside and send separately to each address (through the contract).

A contract method might look like this :

function sendTo(address[] addrs, uint[] amounts) {
    for(uint i = 0; i < addrs.length; i++) {
        addrs[i].transfer(amounts[i]);
    }
}

Cheers

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.