RepositoryJavaScript
miguelmota

miguelmota/merkletreejs-solidity

Construct merkle trees with MerkleTree.js and verify merkle proofs in Solidity.

128stars
20forks
0issues
0views

🔐 Merkle Tree trên Solidity – Xác minh proof từ JS đến smart contract

Kết hợp MerkleTree.js để tạo cây và Solidity để verify – đầy đủ ví dụ và test.

Đây là ví dụ minh họa cách xây dựng Merkle tree bằng MerkleTree.js ở phía client (JavaScript), đồng thời triển khai hàm xác minh proof (verify) trong Solidity để dùng trên blockchain Ethereum.

✨ Điểm nổi bật

  • MerkleProof.verify: Hàm Solidity kiểm tra proof so với root, trả về true/false.
  • So sánh hash tự động: Dùng keccak256 và abi.encodePacked để ghép hash theo thứ tự nhỏ/lớn.
  • Hỗ trợ proof mảng: Nhận đầu vào là root, leaf, và mảng proof.
  • Ví dụ JS đầy đủ: Dựng tree từ danh sách leaves, lấy root, leaf, proof và gọi verify.
  • Kiểm tra sai số: So sánh proof đúng và proof sai để chứng minh tính chính xác.
  • Dễ chạy test: Dùng make test để thực thi toàn bộ quy trình.

💡 Vì sao đáng chú ý

Dự án cung cấp đầy đủ đoạn code từ phía JS đến Solidity, giúp người mới dễ dàng hiểu và triển khai nhanh. Phù hợp để xây dựng hệ thống airdrop, whitelist, hoặc bất kỳ ứng dụng nào cần kiểm chứng dữ liệu bằng Merkle proof trên blockchain.


#MerkleTree #Solidity #Ethereum #SmartContracts #TiniX

Similar Projects

Discover other similar projects and AI models.

RepositoryGo
txaty/go-merkletree

Go Merkle Tree. High performance, Supporting parallel run, OpenZeppelin sorting pairs.

129
Nov 25, 2023
RepositorySolidity
OpenZeppelin/openzeppelin-contracts

OpenZeppelin Contracts is a library for secure smart contract development.

27.3k
Oct 21, 2026
Repository
ethereumbook/ethereumbook

Mastering Ethereum: 2nd Edition, by Andreas M. Antonopoulos, Gavin Wood, Carlo Parisi, Alessandro Mazza, Niccolò Pozzolini

21.5k
Oct 12, 2026
RepositoryJavaScript
OffcierCia/DeFi-Developer-Road-Map

DeFi Developer roadmap is a curated Developer handbook which includes a list of the best tools for DApps development, resources and references!

10.9k
Oct 20, 2026
RepositoryTypeScript
NomicFoundation/hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.

8.5k
Oct 24, 2026
RepositoryHTML
ConsenSysDiligence/smart-contract-best-practices

A guide to smart contract security best practices

7.6k
Mar 28, 2025
RepositoryJava
LFDT-web3j/web3j

Lightweight Java and Android library for integration with Ethereum clients

5.4k
Oct 23, 2026
RepositoryPython
ConsenSysDiligence/mythril

Mythril is a symbolic-execution-based securty analysis tool for EVM bytecode. It detects security vulnerabilities in smart contracts built for Ethereum and other EVM-compatible blockchains.

4.3k
Apr 27, 2026
RepositoryPython
olivmath/merkly

🌳 The simple and easy implementation of Merkle Tree

82
Nov 28, 2025