Reference implementation of the Zeth protocol by Clearmatics
Zeth - Zerocash on Ethereum
WARNING This project is a Proof of Concept. It is highly inefficient and has not been thoroughly reviewed. Please do not use in production!
Disclaimer: This work is inspired from babyzoe, Miximus. It follows and extends the design presented in zerocash-ethereum by adapting some code initially written by Zcash.
It is not intended for handling real value or for use on public networks. The authors have not created any such deployment, and assume no responsibility for any fork of the code or deployment created by other parties.
Additionally, several tools from the GCC and LLVM tools suite are used to improve code quality and generate the documentation of the project. These are required in order to compile the project with all options enabled:
To use the Zeth functionality, 3 components are required:
An Ethereum network (the commands below use a local testnet) to host the Zeth contracts and handle transactions.
A running prover-server process, used by Zeth clients to generate proofs.
Client tools, which generate all inputs required for a Zeth operations, request proofs from the prover-server, and transmit transactions to the Ethereum network holding the Zeth contract.
We use 3 terminals, one for each of the above components.
Note: Mac users should increase docker runtime memory from 2GB to 4GB to allow Terminal 1 to complete successfully.
Terminal 1:
We propose 2 alternatives to run the prover-server below.
docker run -ti -p 50051:50051 --name prover ghcr.io/clearmatics/zeth:latest-prover prover-server
Build and run the prover-server in the development container
# Clone this repository:
git clone git@github.com:clearmatics/zeth.git
cd zeth
# Build the zeth-dev image
docker build -f Dockerfile-dev -t zeth-dev .
# Start the zeth development container
docker run -ti -p 50051:50051 --name zeth zeth-dev:latest
# All the commands below are run in the docker container
# Configure your environment
. ./setup_env.sh
# Compile the proving server
mkdir build
cd build
cmake .. [<flags (see below)>]
# Compile all libraries and tools, including the prover-server
make
# (optional) Run the unit tests
make test
# (optional) Run the all tests (unit tests, syntax checks, etc)
make check
# Start the prover-server process
prover-server
Note: By default, prover-server generates a key at startup. Flags can be used to force the server to load and/or save keys. Run prover-server --help for more details.
Build Options
Some flags to the cmake command can control the build configuration. -DCMAKE_BUILD_TYPE=Release or -DCMAKE_BUILD_TYPE=Debug can be used to force a release or debug build.