Skip to content

tangle-network/relayer

Repository files navigation

Webb Relayer

GitHub release (latest by date) GitHub Workflow Status License Apache 2.0 Twitter Telegram Discord

Table of Contents

Table of Contents

Getting Started

In the Webb Protocol, the relayer plays a variety of roles. This repo contains code for an Anchor System oracle, transaction and data relayer, and protocol governance participant. The aim is that these can all be run exclusive to one another to ensure maximum flexibility of external participants to the Webb Protocol.

The relayer system is composed of three main components. Each of these components should be thought of as entirely separate because they could be handled by different entities entirely.

  1. Private transaction relaying (of user bridge transactions like Tornado Cash’s relayer)
  2. Data querying (for zero-knowledge proof generation)
  3. Event listening, proposing, and signature relaying (of DKG proposals where the relayer acts like an oracle)

Transaction relaying role

Relayers who fulfill the role of a transaction relayer are responsible with exposing an API for clients who wish to relay their zero-knowledge transactions through and with submitting them. Relayers of this role must possess enough balance on the blockchains in which they will relay these transactions, since, after all, they must possess the native balance to pay the fees for these transactions. Relayers can be configured for any number of chains and protocols from mixers to variable anchors and run for individual chains or all of them that exist for a given bridged set of anchors.

Data querying role

Relayers who fulfill this role do so in conjunction with the transaction relaying role although it is not required to possess both. Namely, this role is concerned with listening to the events occurring within an Anchor Protocol instance and storing the data for clients who wish to quickly access it through traditional HTTP methods. This role is actively maintained and sees regular updates to how we hope to store and serve data in the future.

Oracle role

Relayers who fulfill the role of an oracle listen to the Anchor Protocol instances on the various chains the anchors exist on. When they hear of insertions into the anchors' merkle trees they handle them accordingly (as is implemented in the event watchers). Those playing this role then relay the anchor update information to other connected Anchors, the DKG governance system, and any other integration that gets implemented in this repo. Oracle relayers help keep the state of an Anchor Protocol instance up to date by ensuring that all anchors within an instance know about the latest state of their neighboring anchors.

For additional information, please refer to the Webb Relayer Rust Docs. Have feedback on how to improve the relayer network? Or have a specific question to ask? Checkout the Relayer Feedback Discussion.


Prerequisites

This repo uses Rust so it is required to have a Rust developer environment set up. 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:

rustup default stable
rustup update

Great! Now your Rust environment is ready!


How to run a relayer

1. Relayer setup

Clone relayer

git clone https://github.com/webb-tools/relayer.git
cd relayer
cargo build --release --features cli -p webb-relayer
2. Relayer Configuration

You need to create configuration files for the relayer. You can find multiple examples here. Simplest of them is running evm-blanknet configuration which connects to our development environment Orbit.

You can either use pre defined configurations or create new config directory.

relayer-config // path to dir containing relayer configuration files

Note: You could also use the json format for the config files if you prefer that!

3. Run Relayer

Once relayer configuration files are created we run relayer using following command

./target/release/webb-relayer -vvv -c ./relayer-config
  • Example to run relayer with evm-blanknet configuration
./target/release/webb-relayer -vvv -c ./config/development/evm-blanknet

Relayer API Documentation

Relayer provides API support to query cached leaves, configuration info, metrics.

To refer more about API support kindly checkout readme docs here


Relayer Integration E2E Tests

To ensure the proper functioning of the Relayer, integration end-to-end (E2E) tests have been provided. These tests validate the Relayer's behavior in various scenarios.

To learn how to run these integration tests, please follow the step-by-step instructions outlined in the relayer tests readme guide here


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 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.

Supported by