BitgesellOfficial / wbgl-bridge

BGL-WBGL bridge
10 stars 13 forks source link

WBGL Bridge

This is the prototype (proof-of-concept) version of the Bitgesell-WBGL bridge application that allows users to exchange between BGL coins and WBGL ERC-20 tokens.

Consists of frontend GUI that runs in the browser (React) and communicates with the backend service, which in turn is connected to the Bitgesell network (using RPC of a running node) and an Ethereum gateway (via a websocket endpoint).

Setup

Backend Service

Backend service is a Node.js application that exposes a port for HTTP requests. In production, it is recommended to hide it behind an SSL-enabled proxy server (such as nginx). CORS needs to be configured to enable XHR requests from the domain the frontend application is being served from.

MongoDB database is used for storing data used by the service.

To set up the service, go to the service directory, and run either of the following commands (depending on whether you use npm or yarn as the package manager):

yarn

or

npm install

Backend service is configured using environment variables that need to be set before running the application with Node.js. The following variables are supported:

The command for running the service is:

node src/server.js

Frontend Application

Frontend application is a minimal GUI developed in React. To prepare the application build process, go to the app folder, and install the dependencies using one of the following commands:

yarn

or

npm install

Before building the application, you'll need to set the REACT_APP_SERVICE_URL environment variable, which should contain the URL the background service is running at. It should look something like this: https://service.domain.

To build the application, run one of the following commands:

yarn build

or

npm run build

This will create the static application bundle in the build subdirectory, which can be directly served using any web server.

Caveats

As mentioned above, this is a proof-of-concept implementation of the Bitgesell-WBGL bridge application. As such, it comes with multiple shortcomings that should be overcome before launching a full scale service. Some of these shortcomings are: