Skip to content

Efficient and scalable whitelist mechanism for Solidity smart contracts using a Merkle Tree data structure

Notifications You must be signed in to change notification settings

moribus-single/merkle_tree_whitelist

Repository files navigation

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

About

Efficient and scalable whitelist mechanism for Solidity smart contracts using a Merkle Tree data structure

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published