Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme #27

Merged
merged 2 commits into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

SMTB is a service for batch processing of Merkle tree updates. It is designed to be used in conjunction with [Semaphore](https://github.com/semaphore-protocol/semaphore). It accepts Merkle tree updates and batches them together into a single one. This is useful for reducing the number of transactions that need to be submitted to the blockchain. The correctness of the batched Merkle tree update is assured through the generation of a SNARK (generated through [gnark](https://github.com/ConsenSys/gnark)).

## Table of Contents
1. [Features](#features)
2. [Usage](#usage)
3. [Benchmarks](#benchmarks)
4. [Running](#running)
5. [Docker](#docker)
6. [Contributing](#contributing)

## Features

- [x] Merkle tree batch update in gnark
Expand All @@ -12,6 +20,41 @@ SMTB is a service for batch processing of Merkle tree updates. It is designed to
- [ ] Proving service
- [ ] Serialize circuit and proving key

## Usage
This part explains the existing cli commands.

1. setup - builds a circuit with provided batch size and depth, compiles it and writes it to a file.
Flags:
1. output *file path* - A path used to output a file
2. tree-depth *n* - Merkle tree depth
3. batch-size *n* - Batch size for Merkle tree updates
2. export-solidity - Reads a key file (generated from setup), and writes a solidity verifier contract.
Flags:
1. keys-file *file path*
2. Optional: output *file* - Outputs to a file, if not provided, it will output to stdandard output
3. gen-test-params - Generates test params given the batch size and tree depth.
Flags:
1. tree-depth *n* - Depth of the mock merkle tree
2. batch-size *n* - Batch size for merkle tree updates
4. start - starts a api server with /prove and /metrics endpoints
Flags:
1. keys-file *file path* - Proving system file
2. Optional: json-logging *0/1* - Enables json logging
3. Optional: prover-address *address* - Address for the prover server, defaults to localhost:3001
4. Optional: metrics-address *address* - Address for the metrics server, defaults to localhost:9998
5. prove - Reads a prover system file, generates and returns proof based on prover parameters
Flags:
1. keys-file *file path* - Proving system file
6. verify - Takes a hash of all public inputs and verifies it with a prover system
Flags:
1. keys-file *file path* - Proving system file
2. input-hash *hash* - Hash of all public inputs
7. r1cs - Builds an r1cs and writes it to a file
Flags:
1. output *file path* - File to be writen to
2. tree-depth *n* - Depth of a tree
3. batch-size *n* - Batch size for Merkle tree updates

## Benchmarks

Batch size: `100`
Expand Down Expand Up @@ -53,3 +96,17 @@ semaphore-mtb:
docker compose build
docker compose up -d
```

## Contributing

We welcome your pull requests! But also consider the following:

1. Fork this repo from `master` branch.
2. If you added code that should be tested, please add tests.
3. If you changed the CLI flags, please update this readme in your PR.
4. Ensure that CI tests suite passes.

When you submit code changes, your submissions are understood to be under the same MIT License that covers the project.
Feel free to contact the maintainers if that's a concern.

Report bugs using github issues.
Loading