Code Monkey home page Code Monkey logo

protocol-substrate's Introduction

Anchor Protocol - Substrate πŸ•ΈοΈ

πŸš€ Webb's Substrate Pallet Implementation πŸš€
⚠️ Beta Software ⚠️

GitHub Workflow Status Codecov License Apache 2.0 Twitter Telegram Discord

πŸ“– Table of Contents

Table of Contents

Getting Started πŸŽ‰

For additional information, please refer to the Webb Protocol-Substrate Rust Docs πŸ“. Have feedback on how to improve protocol-substrate? Or have a specific question to ask? Checkout the Anchor Protocol Feedback Discussion πŸ’¬.

Pallet layout

pallets/
  |____anchor/              # A simple module for building Anchors.
  |____anchor-handler/      # A module for executing the creation and modification of anchors.
  |____linkable-tree/       # A module for constructing, modifying and inspecting linkable trees.
  |____hasher/              # A module for abstracting over arbitrary hash functions primarily for zero-knowledge friendly hash functions that have potentially large parameters to deal with.
  |____mixer/               # A simple module for building Mixers. 
  |____signature-bridge/    # A module for managing voting, resource, and maintainer composition through signature verification.
  |____token-wrapper/       # A module for wrapping pooled assets and minting pool share tokens
  |____vanchor/             # A simple module for building variable Anchors.  
  |____verifier/            # A module for abstracting over arbitrary zero-knowledge verifiers for arbitrary zero-knowledge gadgets
  |____xanchor/             # A module for managing the linking process between anchors.

Prerequisites

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 stable version, add nightly and the nightly wasm target:

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

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

Installation πŸ’»

Clone the submodules:

# clone the repo
git clone [email protected]:webb-tools/protocol-substrate.git

# Fetch submodules
git submodule update --init

Build the node in release mode:

cargo build --release

Troubleshooting for Apple Silicon users

Install Homebrew if you have not already. You can check if you have it installed with the following command:

brew help

If you do not have it installed open the Terminal application and execute the following commands:

# Install Homebrew if necessary https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

# Make sure Homebrew is up-to-date, install openssl
brew update
brew install openssl

❗ Note: Native ARM Homebrew installations are only going to be supported at /opt/homebrew. After Homebrew installs, make sure to add /opt/homebrew/bin to your PATH.

echo 'export PATH=/opt/homebrew/bin:$PATH' >> ~/.bash_profile

In order to build protocol-substrate in --release mode using aarch64-apple-darwin Rust toolchain you need to set the following environment variables:

echo 'export CC="/opt/homebrew/opt/llvm/bin/clang"' >> ~/.bash_profile
echo 'export AR="/opt/homebrew/opt/llvm/bin/llvm-ar"' >> ~/.bash_profile

Usage

Quick Start ⚑

Standalone Local Testnet

In order to run the standalone development network, you will need to prepare 2 terminal windows. Once the below commands are executed it will set up a development network using the BABE consensus mechanism for a 2 node network.

Terminal 1:

./target/release/webb-standalone-node --dev --alice --node-key 0000000000000000000000000000000000000000000000000000000000000001

Terminal 2:

./target/release/webb-standalone-node --dev --bob --port 33334 --tmp   --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp

You now have successfully set up a standalone local testnet! πŸŽ‰

Docker 🐳

To build the standalone docker image specified in docker/ :

docker build -f ./docker/Standalone.Dockerfile -t protocol-substrate/standalone .

To run docker image:

docker run protocol-substrate/standalone

Testing πŸ§ͺ

The following instructions outlines how to run the protocol-substrate base test suite and integration test suite.

To run base tests

cargo test --release --workspace --exclude webb-client

To run integration tests

  1. Run cd scripts
  2. Run sh run-integrations.sh

Code Coverage

You need to have docker installed to generate code coverage.

Build docker image:

docker build -t cov -f docker/Coverage.Dockerfile .

Run docker image and generate code coverage reports:

docker run --security-opt seccomp=unconfined cov

Contributing

Interested in contributing to protocol-substrate? 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 license.

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.

protocol-substrate's People

Contributors

drewstone avatar dev0x1 avatar wizdave97 avatar dutterbutter avatar ahmedkorim avatar akileshtangella avatar dharjeezy avatar nepoche avatar salman01zp avatar duguorong009 avatar mfaghihi avatar appcypher avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.