Skip to content

Commit 89317e8

Browse files
committed
additional readme info
1 parent 21d344f commit 89317e8

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1-
# Gift List
1+
# Gift List
2+
3+
To get started with the repository, clone it and then run `npm install` in the top-level directory to install the depedencies.
4+
5+
There are three folders in this repository:
6+
7+
## Client
8+
9+
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.
10+
11+
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.
12+
13+
## Server
14+
15+
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.
16+
17+
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!
18+
19+
## Utils
20+
21+
There are a few files in utils:
22+
23+
- 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!)
24+
- 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`
25+
- 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
26+
- 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.

server/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const app = express();
77
app.use(express.json());
88

99
// TODO: hardcode a merkle root here representing the whole nice list
10+
// paste the hex string in here, without the 0x prefix
1011
const MERKLE_ROOT = '';
1112

1213
app.post('/gift', (req, res) => {

0 commit comments

Comments
 (0)