Skip to content

webb-tools/webb-faucet

Repository files navigation

Webb Faucet

📖 Table of Contents

Table of Contents

Getting Started 🎉

This is a multi-chain faucet for Webb's test bridges. The faucet backend is written in Rust and the frontend is written in React. The backend is responsible for authenticating a twitter user and verifying they follow our twitter account: @webbprotocol. Once authenticated, the backend will send a transaction to the user's provided address on the form.

Webb's testnets are currently deployed to EVMs and Substrate chains. If you are an EVM or Substrate chain that wants to integrate with the Webb protocol, please reach out to us on Discord!

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! 🚀🚀

Nix (with flakes)

If you prefer Nix, then follow these steps to get your environment setup:

  1. Install Nix
  2. Enable flakes (if you haven't already)
  3. Run nix develop to enter a shell with all the dependencies installed

Additionally, if you have direnv installed, you can run direnv allow to automatically enter the shell whenever you enter the directory.

Usage

Starting the Rust serve requires you to create a Rocket.toml file specified with your Twitter Developer App's credentials. You can find the template in the Rocket.example.toml file. You will also need to create a new Twitter Application for development purposes. You can find the instructions here.

Notes:

  1. For 'App permissions' you will need to select 'Read' permissions.
  2. For 'Type of App' you will need to select 'Native App'.
  3. For 'App info' you will need to fill in the 'Website URL' and 'Callback URLs' fields. The 'Callback URLs' field should be set to http://127.0.0.1:3000 and http://localhost:3000.

Once created, you can run the server with the following command:

cargo run

Starting the React application requires you to create a .env file specified with some of your Twitter Developer App's credentials. You can find the template in the ./faucet-frontend/.env.example file. The .env should be placed in the ./faucet-frontend directory.

The frontend can be started with the following commands:

cd faucet-frontend
yarn start

User Flow

  1. User clicks the "Log in with Twitter" button
  2. User is redirected and authorizes the app to access their Twitter account.
  3. Once the access token is generated and displayed, the user should supply the receiving addressand claim their tokens by clicking the "Claim" button.

There is no actually blockchain logic hooked in yet.