Merkle Distributors 101

Ali Serag
4 min readAug 6, 2022



These days every other person seems to moonlight as a ‘crypto investor’. Discords servers are flooded with excited ‘degens’, coders and investors excited at the possibility of being included on an airdrop white-list. If you came across this article, you might be wondering: What exactly is an airdrop? What is a Merkle Distributor? Why do DeFi protocols use Merkle Distributors? How exactly does it work?

This article will all these questions and guide you through developing your very own airdrop! (Just be sure to add me to it!).


What is an Airdrop

Many DeFi dapps (decentralized applications), DAOs (Decentralized Autonomous Organizations) and protocols have their own currencies called ‘tokens’. Some tokens have utility such as governance tokens which allow you to vote on directions a DAO can take, others are purely speculative get rich schemes. Airdrops are a marketing tactic that Web3 dapps employ to garner a large user base in a short amount of time, a form of ‘pumpinomics’. Small amounts of the total supply of these tokens are distributed for free or in return for on-chain/off-chain actions such as being active in a discord server, engaging with the dapp or liking a facebook post.


How does one create an Airdrop

In an Airdrop model, only specific addresses can receive a token. The question becomes, how do we make sure that the people we want to receive the tokens are the only ones able to receive them?

Think about it, you can send the tokens directly to all of the addresses that are eligible. This is expensive with massive gas costs (especially on Ethereum).

You can store a mapping of all the allowed addresses within your contract. However this would be expensive for the deployer.

What if there was another approach. One that reduces your cost for deployment while allowing the user to withdraw their airdrop tokens. Encryption made blockchain possible, could encryption potentially solve this challenge as well?

drum rolllllll………

Yes. And the answer is Merkle Distributors, a tool popularized by Uniswap, one of the largest and oldest decentralized exchanges.

How Merkle Distributors Work

Merkle Distributors rely on a Merkle Proof that is used to verify that a specific wallet address is eligible and the amount that it is eligible for.


Pre-extracted wallet addresses are hashed using the Merkle tree, and the final Merkle Root is derived.

In addition, the Merkle proof verifies that the root of the Merkle tree is obtained by using the hash value of the leaf element and other leaves.

In the case of Uniswap, and most DeFi Merkle Distributors, the Merkle tree takes in a list of addresses and eligible amounts (usually in a simple JSON format). The tree hashes each address with an “index” and “amount” (the amount the address is eligible to receive) that represents the leaves. In Uniswap, this process is called Balance Tree. Since it uses SHA256 for hashing, this functionality can be implemented in any language including RUST, Javascript and Python.

The resulting Merkle tree can be found here =>

Using the generated Merkle Tree, Uniswap then utilizes the Merkle Proof library published by Openzeppelin to verify that every address is eligible for token distribution.

This Uniswap repo ( contains the contract airdrop contract as well as super useful scripts to convert a json object of { walletAddress: tokenAmount } into objects that can interact with the Merkle tree.

The final result is the following:

In this example there are 3 eligible addresses in the form of key value pairs. When an address on a dapp attempts to claim an airdrop, all the frontend needs is the merkle root and the address. With this it can find the index, amount eligible to claim and an array of proofs that validate the claim. If the address is not present, or more than the amount specified is input, the user is unable to claim the airdrop.

You might be wondering, “why in the world is the amount ‘0x64’?”. That is called a hexadecimal string, a hexadecimal is simply a number in base 16. If you are unfamiliar with hex format and want to verify the amount each address is eligible for, you can use a useful online converter to double check. You should discover that 0x64 translates to 100. That address is eligible for 100 coins.


There we have it. We learned what an airdrop is, how it is done through cost-effective Merkle Distributors and where to find the code required to launch your own. You are now prepared to build your own economy :) Use your newfound powers wisely!



Ali Serag

Drinking coffee, writing code and talking tech. Ali’s heavily involved in the West Coast’s tech scene and is co-founder of FinTech startup Fostrum.