0

Scenario: Suppose that I have to make three transactions simultaneously to Alice, Bob and Claudia. Now the condition is if any one transaction fails the other two must also not go through.

Query: Is there any way to achieve this without using smart contracts? Is there any in-built feature of Ethereum Blockchain that can create batches for multiple transactions?

1

Unlike cryptocurrencies like Bitcoin, the Ethereum transaction format only allows for exactly 1 destination address. There is no way to achieve this without using a smart contract. I'm not sure why you want to avoid using a smart contract.

Something you can try is a smart contract that, when deployed, immediately performs the transfers and then destroys itself. For example:

pragma solidity ^0.4.24;

contract Multisend
{
    constructor(address[] memory destinations, uint256[] amounts) public payable
    {
        require(destinations.length == amounts.length);
        for (uint256 i=0; i<destinations.length; i++)
        {
            destinations[i].transfer(amounts[i]);
        }
        selfdestruct(msg.sender);
    }
}

Here you can see it in action:

https://ropsten.etherscan.io/tx/0xa03a304f1ef68f56874c1683d9f1e4bccb59fcb1634998fb861a16496f03abd3

  • Thanks! I was just curious to know if Ethereum Blockchain is all about smart contracts or I'm missing something. ;) – Gagan Jul 13 '18 at 11:38

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.