1

As we know, geth send eth by sendTransaction, it has from to and amount, it is an one-to-one transaction. Can I get a way of one-to-many(many-to-many) transaction like sendmany in bitcoin-core? As bitcoin-core can draw bitcoin form all address in the local wallet automatically, it is actually a many-to-many transaction. Just for saving miner-fee when I have huge transactions.

Thanks.

1

There is not native method in Ethereum that can do that but you can write a smart contract that is able to do it.

For example this one https://github.com/cleanunicorn/smart-split

Has users defined as partners

// partnerAdd adds a new partner to the list
// It saves the partner address and the weight of the partner
function partnerAdd(address partner, uint256 weight) public onlyOwnerOrPartner  {
    require(partnerExists(partner) == false);

    partners.push(partner);
    partnersWeight.push(weight);
}

And in the function that receives ETH can split the funds based on your logic

function () public payable {
    uint256 sum;
    for (uint256 i = 0; i < partners.length; i++) {
        sum = sum + partnersWeight[i];
    }
    Sum(sum);

    for (i = 0; i < partners.length; i++) {
        address dst = partners[i];
        uint256 value = msg.value * partnersWeight[i] / sum;
        dst.transfer(value);

        SplitValue(dst, partnersWeight[i], value);
    }
}

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.