Skip to content

webb-tools/anon

Repository files navigation

Webb Anon


🕸️ The Webb Anon Node 🕵️‍♂️
⚠️ Under Heavy Development ⚠️


✨ Substrate based Mixer w/ Relayable transactions using bulletproofs & arkworks compatible zk-(S)NARKs ✨.

For an updated architecture of this project, check out darkwebb-substrate.

Overview 📜

At the highest-level, this is a cryptocurrency mixing pallet that uses both trusted and non-trusted 👤 setup zero-knowledge proofs to facilitate mixing operations. It uses the bulletproofs library built from dalek-cryptography to handle non-trusted zkNARKs and arkworks libraries to handle trusted-setup Groth16 proofs. The repo contains pallets that allow for creation of merkle trees with elements in Curve25519, Bn254, and BLS381's scalar field and a mixer that utilises these merkle trees to build an on-chain application or protocol.

Pallet documentation 💎

To generate the docs for the entire repo, run:

cargo doc --open

To generate the docs for individual pallets and present it, run:

cd pallets/pallet-<name>
cargo doc --open

These commands will both generate the rustdocs site and open it in your default browser. The compiled docs will be located at /target/doc/

Dependencies 🧱

The library utilises a variety of zero-knowledge primitives, gadgets, circuits, etc. that are all implemented using bulletproofs R1CS api with Curve25519. You can find more about the components below and descriptions following thereafter:

Architecture 🏗️

The architecture for the project is as follows:

We have pallets in this repo and a Substrate chain for running this runtime logic. We developed zero-knowledge gadgets that expose a prover and a verifier for interacting with this runtime. Specifically, we embed the gadget's verifiers on-chain so that proofs can be verified on-chain to eliminate any trust involved in mixing currencies. Users are responsible with generating proofs, using the tools in the gadget repo, off-chain and broadcasting these proofs to the network using a signed extrinsic or a live relayer.

Relayers are used to relay transactions on behalf of users. This is necessary because extrinsics normally charge a fee for submission and so we enable a "fee-less" experience by allowing users to offload extrinsic submission to a third-party relayer who can submit transactions on behalf of users who wish to remain more anonymous. Note that there should still be more work put into the fee-mechanism to ensure that relayers are incentivised to run such a service in production.

Tools 🛠️

The flow for integrating these tools into your Substrate project are fairly straightforward. You will add the pallets of interest to your Substrate project and follow the runtime implementations necessary to get your node to compile. From there, you will have integrated a mixer to your Substrate project.

It is possible by extending your dApp with our types in our Typescript API to have this functionality in a front-end application for users to interact with. It is also possible to run a transaction relayer to submit withdrawal transactions from the mixers on behalf of users. Please refer to the documentation in these respective projects when facing issues and asking questions.

Build 👷

Install Rust 🦀:

curl https://sh.rustup.rs -sSf | sh

Initialize your Wasm Build environment:

./scripts/init.sh

Build Wasm and native code:

./scripts/build.sh

Test 🦀

Testing zero-knowledge functionality should all be handled in --release mode. This is due to optimisations on cryptographic operations that ensure your tests complete in a timely manner.

./scripts/test.sh

Run 🚀

Single node development chain

Simply Run:

./scripts/start.sh

Or, you could, first by purge any existing developer chain state:

./target/release/webb-node purge-chain --dev

and then, start a development chain with:

./target/release/webb-node --dev

Using Docker 🐳

We have a 3 pipelines right now, one for the main/master branch and this should be the stable release, and one is edge from the develop branch:

  1. Pull the Docker Image
$ docker pull ghcr.io/webb-tools/anon:edge # change edge to latest for the master branch
  1. Run the node using docker
$ docker run --rm -it --network host ghcr.io/webb-tools/anon:edge webb-node --dev

This will run the node in dev mode, without saving any state, that is easy for testing and development.

Safety ⚡

This crate uses #![deny(unsafe_code)] to ensure everything implemented in 100% Safe Rust.

Contributing 🧑‍🤝‍🧑

Want to join us? take a look at some of these issues:

License

Licensed under Apache 2.0.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the `Apache 2.0` license, shall be licensed as above, without any additional terms or conditions.