iam-dev / webb-tools-protocol-solidity

Webb Protocol implementation in Solidity.

Home Page:https://webb-tools.github.io/protocol-solidity/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸš€ Webb's Solidity Smart Contract Implementation πŸš€

GitHub Workflow Status License Apache 2.0 Twitter Telegram Discord

πŸ“– Table of Contents

Table of Contents

Getting Started πŸŽ‰

This repository contains the Solidity smart contracts for Webb's Anchor System and single asset shielded pool protocols. The Anchor System is a bridging protocol for connecting cryptographic accumulators between chains and can be used, as is implemented in this repo, to build interoperable shielded pool protocols. These shielded pool protocols enable cross-chain private asset transfers and liquidity pools.

For additional information, please refer to the official Webb docs site πŸ“. Have feedback on how to improve protocol-solidity? Or have a specific question to ask? Checkout the Anchor System Feedback Discussion πŸ’¬.

Installation & Compile πŸ’»

Install dependencies:

yarn install 

Update submodules:

git submodule update --init --recursive

To populate fixtures from the submodules, you'll need to install DVC: https://dvc.org/doc/install. Then run:

yarn fetch:fixtures

To compile contracts and build typescript interfaces

yarn build

To run the test suite:

yarn test

To fix the formatting:

yarn format

To run TypeScript checks:

yarn ts-check

Note: If you push new fixtures to remote storage

cd solidity-fixtures
dvc add solidity-fixtures
dvc push --remote aws

Using Nix with Flakes ❄️

  1. Install Nix
  2. Enable Flakes (if you are not already see here: Flakes)
  3. If you have direnv installed, everything should work out of the box.
  4. Alternatively, you can run nix develop in the root of this repo to get a shell with all the dependencies installed.
  5. Happy hacking!

Generating Fixtures

If you need to generate fixtures you will need Circom 2.0 and snarkjs installations. You can find installation instructions below.

This repository makes use of node.js, yarn, Rust, and requires version 16. To install node.js binaries, installers, and source tarballs, please visit https://nodejs.org/en/download/. Once node.js is installed you may proceed to install yarn:

npm install --global yarn

Great! Now your Node environment is ready! πŸš€πŸš€

You must also have Rust installed. This guide uses https://rustup.rs installer and the rustup tool to manage the Rust toolchain.

First install and configure rustup:

# Install
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Configure
source ~/.cargo/env

Configure the Rust toolchain to default to the latest nightly version, and add the nightly wasm target:

rustup default nightly
rustup update
rustup update nightly
rustup target add wasm32-unknown-unknown

Generating Fixtures Prerequisites

NOTE: This is only required for testing / dev purposes and not required to compile or interact with smart contracts.

To generate fixtures you will need Circom 2.0 and snarkjs installed. To install from source, clone the circom repository:

git clone https://github.com/iden3/circom.git

Enter the circom directory and use the cargo build to compile:

cargo build --release

The installation takes around 3 minutes to be completed. When the command successfully finishes, it generates the circom binary in the directory target/release. You can install this binary as follows:

cargo install --path circom

The previous command will install the circom binary in the directory $HOME/.cargo/bin.

Installing snarkjs

snarkjs is a npm package that contains code to generate and validate ZK proofs from the artifacts produced by circom.

You can install snarkjs with the following command:

npm install -g snarkjs

Contributing

Interested in contributing to the Webb Relayer Network? Thank you so much for your interest! We are always appreciative for contributions from the open-source community!

If you have a contribution in mind, please check out our Contribution Guide for information on how to do so. We are excited for your first contribution!

License

Licensed under Apache 2.0 / MIT license.

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

About

Webb Protocol implementation in Solidity.

https://webb-tools.github.io/protocol-solidity/

License:MIT License


Languages

Language:TypeScript 56.4%Language:Solidity 37.6%Language:Circom 3.7%Language:Shell 1.9%Language:JavaScript 0.2%Language:Nix 0.1%