1

I am trying to understand why Merkle Distributor AKA merkle airdrop is used. I understand how it works, but what I don't understand is why it's a better option.

People use it when there's ICO and they want to distribute tokens, my problem is that I don't see a lot of advantage of it. Let's say we use a traditional distribution.

  • we write ERC20 token contract. (contract1)
  • we write another contract which creates lots of tokens and sends it to this contract. (contract2) . So contract2 has let's say 1000000000000 tokens.
  • other users call the function buyTokens on contract2 and in that function, we check how much ethers they pay and according to it, we calculate how many tokens to give to the users. Then, we call address(ERC20).transfer(to, amount) . This seems to work fine. **It's the user that pays the transaction fee`.

Could you explain why Merkle Distributor makes sense here and what advantage it has ? I know what it is and how it exactly works, so no need to explain it too much.

1

The Merkle distributor is more useful when you have a predefined list of addresses that should receive the tokens. In the ICO model, anybody can buy the tokens. In an Airdrop model only some addresses can receive the token. The question becomes, how do we make ensure that some specific people receive the tokens? You can send it directly to all of them. This is expensive. You can store a mapping of all the allowed addresses within your contract. This is expensive for the deployer. Or you can have a merkle root within your Merkle Distributor. This approach reduces your cost for deployment while allowing the user to withdraw their airdrop tokens. I hope that answers your question.

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.