1

I am planning an airdrop of an ERC20 mintable token created through a crowdsale contract based on Open Zeppelin.

Now what I am wondering, is what would be the cost effective way of adding an airdrop functionality. Here's what I could think of:

  • Send all tokens reserved for the airdrop to the crowdsale's owner wallet on contract creation and then write a small Node.js + Web3 + ethereumjs-tx app that simply loops through the list of airdrop wallets and sends to each one of them some tokens (wallet to wallet) using sendSignedTransaction.

  • Add an airdrop method to the Crowdsale contract that will receive the array of wallet addresses and loop through those, mint()ing and transferring the tokens to each of them. Then call that method through Node.js + Web3 passing it the list of addresses?

Is there a better way that I am missing?

What would be cheapest way to do this?

1

Method 2 is the more commonly used. Instead of paying the a fee for every transfer you group together several transfers.

A different approach is to have a "virtual" airdrop where only events are generated and the actual balances are acredited on the first transfer.

But you should write the code and test yourself.

  • but in method 2 lets say i pass 100 addresses to the method, i would still need to make 100 transfers, so i would still pay a fee for every transfer, right? or am i missing something? – Julien Apr 3 '18 at 1:07
  • 1
    Making two transfers in a single transaction should be cheaper than making two transfers in two transactions. But in any case you should not trust me, program the two solutions and mease the gas used. – Ismael Apr 3 '18 at 1:22
  • ok i see, and what about the virtual airdrop, not sure i understand what you mean that the balances are credited on the first transfer. what first transfer? – Julien Apr 3 '18 at 1:26
  • The idea is to only generate Transfer events, that should be cheap because contract storage is not modified. Wallets and/or block explorers will show the balance from the Transfer event. When someone asks for a balance you will check if the account was initialized, if not initialized return a fixed value. The accounts will be initialized when they make their first transfer, when they call transfer or tranferFrom from the contract. – Ismael Apr 3 '18 at 14:28
  • What purpose would such an airdrop serve ? – Nikita Fuchs Jul 28 '18 at 14:10

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.