Skip to content

Latest commit

 

History

History
75 lines (45 loc) · 8.48 KB

pip-0004.md

File metadata and controls

75 lines (45 loc) · 8.48 KB
PIP: <0004>
Title: <Introduction of Bitcoin sidechain to PeerPlays>
Authors: PixelPlex Inc
Status: [ Draft ]
Type: [ Protocol ]
Created: <2019-03-14>
Discussion: <N/A>

Abstract

The future of the distributed web lies in the ability of blockchain networks to interact and integrate with each other. This is the concept of Blockchain interoperability.

Peerplays blockchain was primarily designed as a gaming and gambling blockchain, that would allow for truly decentralized and blockchain-based gaming. However, wider adoption of Bitcoin as the de-facto main cryptocurrency poses a problem with user experience. The users have to first exchange BTC for PPY and then they are able to use it in DApps created on the Peerplays blockchain. In order to allow the users seamless gaming experience and to solve the Scalability Trilemma in the Bitcoin blockchain of not being able to achieve Scalability, Decentralization and Security all at once, we need to create a sidechain to the Bitcoin blockchain so that the users can enjoy gaming using their Bitcoin directly.

Sidechain is a chain that runs alongside a parent chain such as Bitcoin. When you want to transfer the funds from the parent chain to the sidechain, they are locked on the parent chain and then released on the sidechain as a pegged asset. These funds can move on the sidechain until they are returned back to the parent chain where they are released. This will allow users to transact with a Bitcoin analogue and potentiallyuse it as a currency within applications running on Peerplays blockchain.

Such a mechanism raises the question of central storage and the entities controlling it. This proposal does not include the mechanism to change the set of entities controlling central storage, thus making the current version unadoptable on Peerplays main network, due to complex issues that have not been addressed at this point.

Motivation

The key motivating factor is that most of the gamers and gamblers interested in blockchain gaming already own Bitcoin and are reluctant to exchange their Bitcoins for PeerPlays. Secondly, PeerPlays has a very small user base compared to Bitcoin. Enabling Bitcoin users to use DApps built on the Peerplays network will increase the user base for PeerPlays.

So, a Bitcoin sidechain will enable the users to use Bitcoin for playing games or using DApps on the PeerPlays blockchain. Moreover, it will also enable the users to trade in Bitcoin much faster and cheaper using superior transaction throughput of PeerPlays blockchain.

This will also help in decongesting Bitcoin blockchain a little by moving some of its traffic to Peerplays.

Rationale

User experience is the key to any successful product. PeerPlays blockchain is a gaming blockchain but the adoption of the DApps created on the Peerplays blockchain is currently, only limited to the owners of Peerplays. In order to gain more userbase, it is essential to allow the users to use the currency that they hold. And the starting point for this should be the blockchain that has the largest userbase and is widely recognized i.e. theBitcoin blockchain.

This change to the Peerplays Blockchain will not cause issues for the wallet and other pieces that use the Blockchain. However, some modifications will need to be made to the Peerplays Core Wallet and any other wallets to enable sending and receiving Bitcoin.

Advantages of implementing this proposal are as follows:

  1. Increase the user base for PeerPlays by allowing Bitcoin holders to switch over to PeerPlays without any trust issues since the asset itself isnot under direct control of any one person. The group controlling it is constantly changed based on the current composition of witnesses.
  2. Allow users to handle and operate a bitcoin-backed asset.
  3. Faster and Cheaper pegged Bitcoin transactions on the PeerPlays blockchain when compared to the Bitcoin Blockchain.
  4. Witnesses are rewarded in BTC for their participation in controlling BTC Side chain

The disadvantages of this proposal will be:

  1. Requirement of a witness node to run and be connected to a Bitcoin node.
  2. Even though BTC-backed asset can be quickly and easily transacted on PeerPlays, the process of depositing Bitcoin takes some time, due to the transaction processing and confirmation speed on Bitcoin.

Specifications

To implement the sidechain, we will have to add new operations as well as mechanism in the Peerplays blockchain so that we can listen to theblocks on the Bitcoin blockchain and parse them to identify the transactions and vouts from them and to generate and send transactions to theBitcoin blockchain. Running a Bitcoin node will also become a necessity for witnesses, and while multiple witnesses can connect to the sameBitcoin node, it is recommended for different witnesses to connect to different nodes to avoid heavy dependence and reliance on one data source.

The first logical step should be the addition of the ZMQ Listener library to the Peerplays code in order to listen to the block generation on theBitcoin blockchain through the connected Bitcoin node. Each block that is received has to be parsed in order to find any vouts related to theBitcoin addresses of Peerplays Accounts. When a transaction is recieved from the bitcoin blockchain, check to see if there is a deposit transactionto a Bitcoin address created through the Peerplays blockchain. Queue the depost transaction received from the bitcoin blockchain to count theconfirmations.

The users should be able to create a bitcoin address from the Peerplays blockchain and this address should be linked to the user's account sothat the user can use it to get Bitcoins transferred to him. So, the code to create a bitcoin address for the user has to be incorporated on thePeerplays blockchain.

Whenever someone deposits BTC to the user's bitcoin address created through the Peerplays Blockchain, the BTC should be deposited in a Primary Wallet which will essentially be a multisig bitcon address on the bitcoin blockchain. The ZMQ Listener will receive the message and addthis deposit transaction to a queue to check for the required number of confirmations. As soon as the required number of confirmations isreceived, a proposal will be created to credit the user's account with the same amount of pBTC tokens. pBTC will be the pegged Bitcoin Asset on the Peerplays Blockchain. They will be 100% backed by BTC in the Primary Wallet.

The user should also be able to withdraw the BTC from his account to the Bitcoin Blockchain. A Remote Procedure Call (RPC) client will have tobe integrated into the Peerplays blockchain in order to enable the withdrawal of Bitcoins from the user's Peerplays account. Whenever the userrequests to withdraw the Bitcoins, the pBTC from the user's account will be reserved using the asset_reserve_operation. The user shouldn't becharged for the asset_reserve_operation. A proposal should be created for the withdrawal of Bitcoin. Once the proposal is approved, the pBTCsould be burnt and the vins for the withdrawal of same amount of Bitcoin from the Primary Wallet should be created. 1% of this amount should becharged as fees and deposited to the bitcoin address of the witnesses. The user's account should be credited with rest of the amount afterdeducting the Bitcoin blockchain fees.

If due to a fork on the Bitcoin blockchain, we are unable to complete a withdrawal transaction, there should be a mechanism to revert theoperation on the Peerplays blockchain that should come into force and revert the pBTC reserved back to the user's account.

Discussions

N/A

Summary For Voters

Indroduction of Bitcoin sidechain described in this PIP will allow DApp developers and users to leverage the liquidity of Bitcoin while developing and using the DApps on the PeerPlays network. It will allow the users to port their Bitcoins from a slow and expensive Bitcoin blockchain to a faster and cheaper Peerplays blockchainand use it in the DApps created on the Peerplays blockchain or trade it with other users.

The proposed mechanism, while impacting the witnesses with the necessity to perform more actions (signing pBTC asset issuance and controloperations), also rewards them with BTC (rewards are derived from users’ BTC withdrawals).

Copyright

This document is placed in the public domain

Useful links

  1. Bicoin multisignature wallet limitations
  2. ZMQ library
  3. Feature development branch