In this video I explain how Merkle trees work, how bitmaps work, and how to combine these data structures to implement an efficient airdrop distribution for an ERC20 token. I first explain things at a high-level using the digram, then I show how we can implement it all in solidity.
The diagram will be available as an NFT soon. Check my twitter for more info!
https://twitter.com/jordanmmck
Code:
https://github.com/jordanmmck/MerkleTreesBitmaps
Videos I mention:
https://youtu.be/PLgawr4pbqE
https://youtu.be/3C0g-60bAWc
https://youtu.be/yV4vHMaKZT0
How contract storage is laid out:
https://programtheblockchain.com/posts/2018/03/09/understanding-ethereum-smart-contract-storage/
0:00 - intro
0:15 - world state
1:29 - diagram overview
4:08 - airdrop design
6:47 - merkle trees
7:39 - tree construction
9:55 - proofs
13:01 - proof complexity
14:57 - intuition
17:43 - bitmaps
21:16 - bool array
22:06 - uint array
24:30 - mapping
28:14 - code
37:22 - outro