Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/victory-canopus/merkle-tree-gift-list
This project demonstrates the practical application of Merkle Trees in a client-server model. The client supplies a name and a proof of existence of his name on the list, to the server. If the returned proof is true then the user gets a gift.
https://github.com/victory-canopus/merkle-tree-gift-list
merkletrees web3
Last synced: 3 days ago
JSON representation
This project demonstrates the practical application of Merkle Trees in a client-server model. The client supplies a name and a proof of existence of his name on the list, to the server. If the returned proof is true then the user gets a gift.
- Host: GitHub
- URL: https://github.com/victory-canopus/merkle-tree-gift-list
- Owner: Victory-Canopus
- Created: 2023-03-04T15:50:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-03-04T15:53:33.000Z (over 1 year ago)
- Last Synced: 2024-09-02T15:42:03.741Z (2 months ago)
- Topics: merkletrees, web3
- Language: JavaScript
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gift List
To get started with the repository, clone it and then run `npm install` in the top-level directory to install the depedencies.
There are three folders in this repository:
## Client
You can run the client from the top-level directory with `node client/index`. This file is a script which will send an HTTP request to the server.
Think of the client as the _prover_ here. It needs to prove to the server that some `name` is in the `MERKLE_ROOT` on the server.
## Server
You can run the server from the top-level directory with `node server/index`. This file is an express server which will be hosted on port 1225 and respond to the client's request.
Think of the server as the _verifier_ here. It needs to verify that the `name` passed by the client is in the `MERKLE_ROOT`. If it is, then we can send the gift!
## Utils
There are a few files in utils:
- The `niceList.json` which contains all the names of the people who deserve a gift this year (this is randomly generated, feel free to add yourself and others to this list!)
- The `example.js` script shows how we can generate a root, generate a proof and verify that some value is in the root using the proof. Try it out from the top-level folder with `node/example.js`
- The `MerkleTree.js` should look familiar from the Merkle Tree module! This one has been modified so you should not have to deal with any crypto type conversion. You can import this in your client/server
- The `verifyProof.js` should also look familiar. This was the last stage in the module. You can use this function to prove a name is in the merkle root, as show in the example.