Design and Architecture
The 2 way peg app is a protocol to convert BTC to RBTC and vice versa. It is secured by the powpeg, which is a unique 2-way peg system that secures the locked bitcoins with the same Bitcoin hashrate that establishes consensus. See the history of the Powpeg.
In this section, we will cover the design and architecture used in building the 2 way peg application. It comprises of a web interface built with Vue.js, a backend application built with Node.js, and made to run via containers.
High level
The solution is a web interface, which integrates with a REST API, which in turn communicates with internal services such as the blockchain node and databases. In addition, a daemon/worker will be created that will be responsible for obtaining data from the blockchain and changing the status of the transaction.
This diagram shows the architecture of the 2 way peg app, a Customer (Person) refers to someone who owns BTC or RBTC who wishes to use the 2 way peg app to send a transaction.
Components
The front-end application of the 2 way peg app is developed using Vue.js. The backend application is developed using Nodejs containing a restful API Service and a Daemon service. The API is responsible to serve the data to the front-end, and the Daemon service is responsible for listening for transactions on-chain and updates the database.
Containers
All applications are available to run using Docker and are built using a Dockerfile. The front-end application will start a node environment with nginx to serve the Vuejs application, and the back-end will start nodejs and start the daemon and api listening by default on port 3000
.
Resources
- 2 way peg app frontend repo
- 2 way peg app backend repo
- How to get RBTC using Rootstock’s built in Powpeg
- Rootstock Testnet Faucet
- Get RBTC using Exchanges
- Design architecture