7

I was wondering if someone has more information on how to do a bulk transaction on the Ethereum network for ERC20 tokens.

Let's say I need to send 1 ethereum to 10 users or 10 ERC20 Tokens for that matter. what would make the possibility of sending this to 10 different wallet addresses within 1 transaction?

Would love to hear from someone that has more knowledge on this.

6

Easy way: https://multisender.app

Harder way:

Source code: https://github.com/rstormsf/multisender/blob/master/contracts/contracts/multisender/UpgradebleStormSender.sol

function multisendToken(address token, address[] _contributors, uint256[] _balances) public hasFee payable {
    uint256 total = 0;
    require(_contributors.length <= arrayLimit());
    ERC20 erc20token = ERC20(token);
    uint8 i = 0;
    for (i; i < _contributors.length; i++) {
        erc20token.transferFrom(msg.sender, _contributors[i], _balances[i]);
        total += _balances[i];
    }
    setTxCount(msg.sender, txCount(msg.sender).add(1));
    Multisended(total, token);
}
1
  • Is there a limit for the number of addresses I can send for that function? – user3652172 Aug 19 '20 at 12:07
3

Create a smart contract with a method that accepts an array of addresses, and within the method it transfers the ETH/token to all the addresses. This will require only 1 external transaction.

Batch ETH transfer example:

function sendBatch(address[] addrs) public payable {
    for(uint i = 0; i < addrs.length; i++) {
        addrs[i].transfer(msg.value.div(addrs.length));
    }
}
0

Here is the simple and full tested solidity code from a great dapp https://bulksender.app

pragma solidity ^0.4.24;

interface IERC20 {
    function transfer(address to, uint256 value) external;
    function transferFrom(address from, address to, uint256 value) external;
    function balanceOf(address tokenOwner)  external returns (uint balance);

}
contract Bulksender{
   function bulksendToken(IERC20 _token, address[] _to, uint256[] _values) public  
   {
      require(_to.length == _values.length);
      for (uint256 i = 0; i < _to.length; i++) {
          require(_token.transferFrom(msg.sender, _to[i], _values[i]));
    }
  }
}

Take a look the tutorials: https://github.com/howeguo/Token-BulkSender/blob/master/README.md

Source Code :https://github.com/howeguo/Token-BulkSender/blob/master/BulkSender.sol

Hope this helps!

-1

You can airdrop your token using the Dapple Airdrops DApp. It is designed specifically for ERC20 token airdrops and can handle at the very least 150 addresses at a time. There is also a detailed tutorial on how to use the application.

Here is the link for Dapple Airdrops: https://www.dappleairdrops.com/

Here is the link for the tutorial: https://medium.com/@zenospavlakou/dapple-airdrops-batch-transfer-any-erc20-token-1ff416834525

Hope this helps!

-1

There is ready to use platform provided by Custom Contract Network to accomplish your goal. Check here https://customcontract.network/token-connect

It works well with ropsten as well as mainnet

I suggest first to check over ropsten testnet then try over main net.

Also you can find the complete documented smart contract for this purpose here

https://github.com/ccndevelopers/Token-Distributor-Smart-Contract

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