🌌Bitsong Faucet

This application enables the users to receiver coins on the Bitsong Testnet. It can be called through simple HTTP GET requests, whose single query parameter is the address of the wallet who wants to receive the coins.

It is empowered by an anti-bruteforce attack system and a jobs queue built on Redis.

It is also possible to see a documentation for the available APIs at /api.

πŸš€ Tech Stack

Server: NestJS, Node.js, Redis and Swagger

Benchmark: Python

🌎 Environment Variables

To run this project you need to create a .env file. You can copy the example file by typing:

cp .env.example .env

Then, you should edit the variables. Their explaination follows:

FAUCET_MNEMONIC Faucet mnemonic used for transaction signing

FAUCET_ADDRESS Faucet address used for transaction

ADDRESS_PREFIX Address prefix used for receiver address validation

RPC_URL Link to Bitsong RPC API

NODE_PORT Node port used by server instance

QUEUE_MAX_JOBS The maximum number of items in the queue

QUEUE_DURATION The maximum duration of a queued job

THROTTLER_TTL The maximum duration of each throttle

THROTTLER_LIMIT The number of times an endpoint can be called from the same ip address in a TTL

REDIS_HOST Redis server hostname

REDIS_PORT Redis server port

βš™οΈ Run Locally

Clone the project

  git clone https://github.com/bitsongofficial/bitsong-faucet.git

Go to the project directory

  cd bitsong-faucet

Install dependencies

  pnpm i

Or you can use:

  npm i

Start docker container (Redis):

  docker-compose up -d

Start the server on dev mode:

  pnpm start:dev

Start the server on debug mode:

  pnpm start:debug

Start the server on prod mode:

  pnpm start:prod

Moreover if you want to start docker service and Node.js server on debug mode, you can use:

  start:debug-docker

Build the server for production:

  pnpm build

πŸ’₯ Benchmark

Create a virtual enviroment on python:

  python3 -m venv benchmark/env

Active the virtual enviroment:

  source benchmark/env/bin/activate

Install dependencies:

  pip3 install -r benchmark/requirements.txt

Run the benchmark:

  python3 benchmark/main.py

πŸ‘€ Authors

πŸ†˜ Support

For support, email g.nocera@bitsong.io or join our Discord.

πŸ” License

Copyright Β© 2022 BitSong.

This project is licensed by MIT License.