DEV Community

Gino Osahon
Gino Osahon

Posted on

How to Convert BTC to RBTC Using The 2-Way Peg App

Overview

The 2 way peg 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.

The 2 way peg is a web application that fosters the interaction between the bitcoin blockchain and the RSK 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.

In this guide, we are going to learn how to use the 2 way peg app application, its features, benefits, how to use hardware and software wallets to perform peg-ins, and how to view transaction statuses. This guide also provides more advanced operation instructions including how to use different wallets, selecting fees, et cetera.

Note: Current version (v1.1.0) of the 2 way peg app does not support peg-outs.

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 RSK Mainnet and RSK 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 section 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 (v1.1.0) does not support the peg-out functionality.

Why use the 2 way peg?

The 2 way peg application has lots of benefits, these include:

Simplified transactions

The peg-in in 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, which is also possible without it, but with an even higher level of complexity than a legacy peg-in.

Visualization of transactions

Enables the visualization of the status of transactions on the RSK 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
  • Nifty: Through the rLogin application
  • 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

Be sure to check out our next article How to get started using the 2 way peg app on the RSK Developer Portal.

This article was originally posted on the RSK Developer Portal.


Resources

Top comments (0)