Giter VIP home page Giter VIP logo

rbtc-faucet's Introduction

RBTC Faucet

Description

Faucet to dispense test RBTC for RSK Testnet.

This is a NextJS app that interacts with the RSK blockchain and uses a captcha service. Therefore we can identify 3 actors

  1. NextJS app
  2. RSK Blockchain
  3. Captcha service

Architecture

diagram

Setup -config.json variables

There are 3 differents environments, production, development and testing, each one has a specific -config.json file

  • Production: prod-config.json
  • Development: dev-config.json
  • Testing: test-config.json

Please check -config.json and fill them with right values.

{
  "RSK_NODE": "NODE_URL", 
  "API_URL": "API_FETCH_URL",
  "NEW_CAPTCHA_URL": "http://rust-captcha.com/new/easy/5/998",
  "SOLVE_CAPTCHA_URL": "http://rust-captcha.com:8080/solution/",
  "FAUCET_ADDRESS": "ADDRESS",
  "FAUCET_PRIVATE_KEY": "PRIVATE_KEY",
  "GAS_PRICE": 60000000,
  "GAS_LIMIT": 800000,
  "VALUE_TO_DISPENSE": 0.001,
  "TAG_MANAGER_ID": "GTM-XXXXXXX"
}

In order to run a production version, please check if prod-config.json exists, if not create one with the configuration described previously.

  • RSK_NODE is the URL where the node is running.
  • API_URL where the API is hosted.
  • NEW_CAPTCHA_URL is the URL where you're gonna request a new captcha.
  • SOLVE_CAPTCHA_URL is for checking the solution.
  • CAPTCHA_API_URL is where the captcha-api is hosted.
  • TAG_MANAGER_ID id for google service (this one shouldn't be changed).

To get more about info the captcha service, please read this README.

Running development environment

First install depenecies (use yarn)

yarn

Then run app

yarn dev

You'll need a running blockchain in order to run this environment. To do this, you can run a local ganache and point it at dev-config.json, RSK_NODE variable. Notice that you won't be able to get a real explorer link because you're running a local blockchain instead of an RSK one!

For this environment you can use a test captcha service with this config (at dev-config.json).

  {
    "NEW_CAPTCHA_URL": "https://rust-captcha.herokuapp.com/new/easy/5/998",
    "SOLVE_CAPTCHA_URL": "https://rust-captcha.herokuapp.com/solution/",
    "CAPTCHA_API_URL": "https://rust-captcha.herokuapp.com"
  }

There is no need to change API_URL, VALUE_TO_DISPENSE, GAS_PRICE, GAS_LIMIT and TAG_MANAGER_ID.

Production deploy

Checkout Next.js tutorial or docs

Docker

This project has been dockerized

First build the image

docker build -t rbtc-faucet .

Then run

docker run -d --name rbtc-faucet -p 3000:3000 rbtc-faucet

Linting

You can lint the whole project with prettier, just run

yarn lint

Setup linting options at .prettierrc

rbtc-faucet's People

Contributors

alebanzas avatar jonathansmirnoff avatar dependabot[bot] avatar fedejinich 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.