This is week 2's final project for Alchemy University Ethereum Bootcamp.
To run both the server
and the client
, rust must be installed on your machine.
The project consists in simple a server, with a memory size of 32 bytes (of course this is an imaginary constraint) that needs to verify that an element belongs to a gift list using a merklee tree, and a client that supplies the needed values for the verification.
The client app is a simple cli program that requires a .json
file storing a list of strings to be used to build the merkle tree.
Usage: client [OPTIONS] <COMMAND>
Commands:
get-root Builds a merkle root from <FILE>
validate Validates that <NAME> belongs to the merkle tree by querying <HOST>
Options:
-f, --file <FILE> File that stores the list of allowed names to receive a gift [default: nice-list.json]
The server has a single endpoint /gift
, which expects a name
and a merkle proof
to validate that the given name
belongs to the allow list.
The server needs the MERKLE_ROOT
env variable to start, otherwise it will panic. If a PORT
is not specified the project will use the default value 3000
.
cargo run --bin client -- get-root
cargo run --bin client -- validate --name "Traci McDermott"
MERKLE_ROOT=a166212461750725be5a1baf054338a810fc9a3500f979f6da55054dd8e893fe cargo run --bin server