This is a merkle tree implementation using the merkletreejs library with support for root generation and leaf verification. It can be applied for checking eligible participants in an airdrop.
- merkletreejs library
- keccak256 Hash function
- Leaves (names of eligible users) are stored in the array => "eligibleAirdropParticipants".
- Leaves are hashed using keccak256 hash function and each hash is mapped to its corresponding leaf.
- The tree and its root are generated with the MerkleTree() class constructor and the getHexRoot() function.
- The checkIfNameIsValid() function verifies if a name is a valid leaf and part of the tree through steps and returns an output for true and false scenario.
- Clone repo
$ gh repo clone raymondabiola/MerkleTree-Implementation
- Edit array to customize array index values.
- Install dependencies
$ npm install
$ npm start
Built with 🤍 by Raymond Abiola
Feel free to follow my Github account or fork this repo for learning and testing.
