Solidity: Merkle Trees, BitMaps & Coding an Airdrop

Опубликовано: 10 Декабрь 2024
на канале: Jordan McKinney
3,658
205

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!

  / jordanmmck  

Code:

https://github.com/jordanmmck/MerkleT...

Videos I mention:

   • Ethereum Smart Contracts Explained  
   • Ethereum Scaling: ZK Roll-Ups  
   • Ethereum Explained: How Tokens Work &...  

How contract storage is laid out:

https://programtheblockchain.com/post...

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