6

how could I go about sending tokens to a couple of thousands of addresses without havinging to do it manually? It's an airdrop.

  • A contract might be able to take care of but in a way that might surprise. Can you be more specific? Are there particular accounts, specific amounts, or just a pile for the asking in even amounts for anyone with an ethereum address? – Rob Hitchens - B9lab Oct 23 '17 at 22:05
  • it will cost you some money, why not to make an ICO-like contract. people gets directly the tokens instead droping tks to a bunch of addresses. – Badr Bellaj Oct 23 '17 at 22:58
  • It's a specific amount to be sent to many addresses. I can't do it manually because that would take a couple of days – Vini Oct 24 '17 at 6:18
  • Am adding comment here to help people trying to do via mist after created their token to refer here ethereum.stackexchange.com/a/31332/20357 – Rajesh Nov 22 '17 at 7:49
  • where to include the list of address in the code? how does the code read the list of address to which the tokens should be sent? – IGCGamers Feb 9 '18 at 13:52
6

OmiseGo just released their Airdropper contract that Vitalik purportedly wrote the original version of. It sends many values to many addresses.

It's fairly straightforward: you pass an array of addresses and an array of values and iterate through them sending the funds to each address.

contract Airdropper is Ownable {

    function multisend(address _tokenAddr, address[] dests, uint256[] values)
    onlyOwner
    returns (uint256) {
        uint256 i = 0;
        while (i < dests.length) {
            ERC20(_tokenAddr).transfer(dests[i], values[i]);
            i += 1;
        }
        return(i);
    }
}
  • How many addresses in maximum can I send? – Luan Do The Jan 29 '18 at 9:50
  • you're constrained by gas costs – JohnAllen Jan 29 '18 at 20:30
  • Is this contract already deployed on livenet? – medvedev1088 Feb 9 '18 at 13:55
1

You can do it with a contract in a few ways.

You could use a "pull/withdraw" pattern. Create a contract where users request to withdraw the airdropped tokens and you keep a balance of how many tokens a given address has withdrawn. You could also create a whitelist/blacklist of addresses to allow/disallow certain addresses to receive the tokens.

You can also do it the other way around. Create a contract where people signup by entering their address, and then when you decide so, you can call a function that iterates over the array of addresses and sends them the tokens. The problem with this approach is that is more prone to problems if the list is big enough that there's not enough gas to perform this transaction. You could code it to perform the airdrop in batches to prevent this problem. If it's just a few thousand addresses you should be fine, though.

  • How would one go by doing this – Vini Oct 24 '17 at 6:20

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.