Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.04 KB

README.md

File metadata and controls

36 lines (27 loc) · 1.04 KB

Whitelist with Merkle Tree

Overview

This Solidity project demonstrates how to use a Merkle Tree data structure to implement a whitelist mechanism for a smart contract. Instead of storing addresses in storage memory, which can be expensive in terms of gas fees, this approach leverages the efficiency and security of Merkle Trees.

Example of using Merkle Tree could be found in test folder.
Utility functions stored in scripts folder.

Efficiency

Storing N addresses

Method Total Gas Cost
Without Merkle Tree 20,000 * N
With Merkle Tree 20,000 (const)

Verifying address

Method Total Gas Cost
Without Merkle Tree 2,518
With Merkle Tree 4,652

Getting Started

  1. After cloning the project install the dependencies:
pnpm i
  1. Run tests
npx hardhat test