Efficient token Air-drop using Merkle trees
- Owner of contract prepares a list of addresses with many entries and publishes this list in public static .js file in JSON format
- Owner reads this list, builds the merkle tree structure and writes down the Merkle root of it.
- Owner creates contract and places calculated Merkle root into it.
- Owner says to users, that they can claim their tokens, if they owe any of addresses, presented in the list, published on owner's site.
- User wants to claim his N tokens, he also builds Merkle tree from public list and prepares Merkle proof, consisting from log2N hashes, describing the way to reach Merkle root.
- User sends transaction with Merkle proof to contract.
- Contract checks Merkle proof, and, if proof is correct, then sender's address is in list of allowed addresses, and contract does some action for this use. In our case it mints some amount of token.
- clone this repo
git clone https://github.com/bhatt-deep/AirdropUsingMerkletree.git
- run truffle commands
truffle develop
truffle migrate
truffle test