Overview
In this section, we are going to learn about the 2 way peg app, how it works, its features, and the benefits of using the application.
To get started, see the prerequisites section.
The 2 way peg is a protocol that converts 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.
The 2 way peg app is a web application that fosters the interaction between the bitcoin blockchain and the Rootstock network for easier exchange of BTC and RBTC. It provides a way to visualize the status of transactions, communicate with a user wallet (both hardware wallets and software wallets), while also providing the highest possible level of security for transactions.
How it Works
The 2 way peg app uses a REST API and a 2 way peg api as the backend, this API uses a daemon process, which is responsible for listening on blockchain transactions to update the state of peg-ins and in the future, the state of peg-outs, these state changes (tx hash, date change, last status) are stored in a mongodb database.
Currently, the 2 way peg app is available on both Rootstock Mainnet and Rootstock Testnet.
The source code is available on github, and open source:
Features
The 2 way peg app, has two primary features, they are:
-
Peg-in: A conversion from BTC to RBTC. See Glossary page for more explanation.
- Note: The peg-in process is final and cannot be reverted.
-
Peg-out: A conversion from RBTC to BTC. This current version of the 2 way peg app. See pegout for more explanation.
Why use the 2 way peg app?
The 2 way peg application has lots of benefits, these include:
Simplified transactions
The two way peg (peg-in and pegout) are its nature is a complex process and this app makes it simpler. Using the 2 way peg app enables you to choose where to receive the converted BTC / RBTC, which is also possible without it, but with an even higher level of complexity than a legacy peg-in and peg-out.
Visualization of transactions
Enables the visualization of the status of transactions on the Rootstock network
Enables communication with a user wallet (hardware and software)
The 2 way peg app communicates directly with the following services:
- Trezor: Directly via usb
- Ledger: Directly via usb and integrated with the manufacturer's application
- Liquality: Directly through the application provided by the company
- Metamask: Through the rLogin application. Learn more about the rLogin application
Secure transactions
All transactions need to be confirmed via the device used by the customer, whether a hardware or software wallet, all transaction information and the appropriate signatures are generated through integration with the wallets.
Next
- Convert BTC to RBTC using the 2 way peg app.
- Convert RBTC to BTC using the 2 way peg app.
- View Advanced Operations
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