DEX Masterclass 102: BitShares DEX complete ecosystem & stable.PHP case study

Bitspark
The Ledger
Published in
7 min readDec 19, 2019

The Bitshares DEX was the first decentralised exchange to come online, as still today it is one of the most advanced DEXs around. The Bitshares DEX is actually a vast ecosystem that touches on many different mechanisms unique to cryptocurrency — such as creating stablecoins.

What you’ll learn

  • Why DEXs are on blockchains
  • How the BitShares DEX works
  • BitShares ecosystem: BTS, Voting, Committee, Worker Proposals
  • The difference between Proof of Work, Proof of Stake, Delegated Proof of Stake
  • What are BitShares DEX gateways and how do they work
  • User Issued Assets & Market Pegged Assets
  • Case study: stable.PHP

DEX Masterclass 102 Recorded Video

Why are DEXs on Blockchains?

It all comes down to trust. On a centralised exchange, traders do not know each other but they trust in the exchange itself to make sure everything works as it should. On a DEX, there is no centralised party to take on that role as traders exchange assets directly between each other.

This is where blockchain comes in as a way to allow people who do not trust each other to still interact without having problems when it’s time to transact.

What that means for a DEX, is that every single interaction is recorded on the blockchain for everyone to see. It gives everyone equal access to the order books and the history of everything that has happened on the DEX.

What is BitShares & the BTS token

Created in 2014, the BitShares DEX was the first of its kind in the world. It’s native token is BTS which is used to operate the DEX and pay for transaction fees, execution fees and voting. BTS is also used as collateral for the many stablecoins available on the BitShares DEX. And just like with any other decentralised token, there is no single party in control of BTS.

Executing trades on BitShares a lot simpler and certainly faster. That has everything to with Delegated Proof of Stake. This model was first pioneered by BitShares, and is an improvement on Proof of Stake. With Delegated Proof of Stake, there are only a limited number of people who verify blocks which are referred to as Block Validators — that’s the delegation. These people are voted in by other members who are required to have coins to do so — that’s the stake.

BitShares has anywhere between 21 and 27 Block Validators, who are randomly assigned in an unpredictable order via the blockchain itself. Block Validators don’t need to have a stake in the system themselves, they just need to be good at validating blocks in order to get voted in.

How Delegated Proof of Stake makes BitShares DEX reliable and faster

The unpredictability is what makes this model work.

With Proof of Work, you can predict that the people with the most hashing power are going to mine the most blocks. In the case of Proof of Stake, the people with the largest stake will be the biggest validators.

But with this Delegated model, say there are 21 Block Validators, there is only a 1 in 21 chance for a validator to be the next in line. The probability of 5 Validators colluding and also being the next 5 Validators chosen at random is incredibly low. And if Validators don’t do a good job, they get voted out.

However, Validators do already know from who the next block is coming from, so there is no need for a discovery process which can take a lot of power and time.

That’s what makes it possible to have a 1.5 second blocktime on the Bitshares blockchain which results in quick transactions on the DEX.

BitShares: Voting, Committee and Worker Proposals

BitShares works as a Decentralised Autonomous Corporation, directed by a combination of voting, a committee and worker proposals.

Voting can be done by anyone that holds BTS. Votes can be cast for block validation, as well as voting people into the committee of BitShares, and approving Worker Proposals.

The committee has the ability to set transaction fees, charged in BTS, based on what the stakeholders want. All fees collected on transactions are kept in a reserve pool. That reserve pool is then used to pay people working on approved Worker Proposals. So essentially, the committee is in charge of keeping the balance between money coming in (fees) and money going out (worker proposals).

Worker proposals are a way for anyone in the community to propose working on a certain project to benefit BitShares. If everyone thinks that’s a great idea then they will vote for the project and then the committee releases the funds from the reserve pool to pay the worker in BTS.

What are Gateways

Gateways are different windows into the BitShares blockchain. There are currently around 15 gateways that are all running on the same BitShares system, the same exact blockchain. In fact, with a BitShares account you could login through any of these gateways to access the DEX from a different window.

While all the gateways operate under the same rules, private companies create them to provide additional features that would add value for their customers. Think of different user interfaces or the ability to list additional currencies.

For example, trading Bitcoin on the BitShares DEX and blockchain requires a custom solution because BTC is on a different blockchain. Gateways such as Sparkdex are providers of those solutions.

What type of cryptocurrencies can be traded on Sparkdex

There two different types of cryptocurrencies we will discuss here: User Issued Assets (UIA) and Market Pegged Assets (MPA).

UIA: Trading Bitcoin on the Bitshares blockchain

To make trading BTC on the BitShares DEX possible, a gateway will run a Bitcoin node that process transactions on the Bitcoin blockchain. When a customer makes a BTC deposit, the gateway will take that BTC and issue a BitShares-based token in exchange which represents the value of that Bitcoin deposit. That is the UIA and as a BitShares based token, it can be traded quickly and easily across the BitShares ecosystem.

The UIA token takes on the name of the gateway that issues it. So in the case of Bitspark, the UIA Bitcoin token used for trading on the BitShares blockchain is Sparkdex.BTC. And because all the gateways are actually hooking into the same system looking at the same order books, you will see the BTC tokens of other gateways regardless of which gateway you are using yourself.

At the end of the day, when a customer wants to withdraw the BTC deposit, the gateway token is exchanged back into real Bitcoin and burned thereafter. This is where gateways can really distinguish themselves in terms of how fast they can receive and withdraw your Bitcoin.

The burning of the gateway issued UIA token is required to prevent a buildup of tokens that have no actual BTC tied to them. A good gateway will provide transparency around the issuance and burning of UIA tokens. See the Sparkdex transparency page as an example.

MPA: stablecoins

Market pegged assets (referred to as smart coins or stablecoins), use smart contracts and collateral to create new coins with a value tied to another asset.

While there are many stablecoins today, BitUSD was the first one ever created back in 2014, made possible by the BitShares MPA feature.

MPAs created on BitShares do not require trust. The collateral for creating say BitUSD, is held in a smart contract. For BitUSD, that collateral is BTS which means that at any point in time, you can exchange BitUSD for the same US dollar value in BTS tokens.

If BTS drops in value to the point where it can no longer back the value of BitUSD, the blockchain automatically sells it off. To create a buffer that can deal with the volatility of the collateral’s price, in order to make 1 BitUSD you need 1.6 BitUSD worth of collateral.

Stablecoin case study: stable.PHP created by Bitspark

Bitspark has created stable.PHP, a stablecoin for Philippine peso using BitUSD as collateral backing. The PHP stablecoin has 2 main uses across the business:

1: Cash in, Cash out in the Philippines

It gives Bitspark access to the Philippines market, providing people with a way to cash in and out of cryptocurrencies using their own local currency. All without needing to rely on Bitcoin exchanges or local banks. Using stable.PHP, customers in the Philippines can do many different things such as sending and receiving money across borders, or even paying their solar electricity bills in selected regions made possible by the partnership between Bitspark and Okra Solar.

2: Shorting the Philippine peso

Because the collateral backing the PHP stablecoin is BitUSD, there are shorting opportunities for traders to capitalise. Almost every emerging market currency over time depreciates against the US dollar because USD is the global reserve currency, and the same goes for Philippine peso. With USD as your collateral, you can make money over time as PHP depreciates either creating more PHP or take the initial PHP and buy more BitUSD.

Both uses, emerging markets accessing crypto and traders being able to short exotic currencies, is what Bitspark is replicating around the world by issuing local currency stablecoins for all the world’s currencies over time.

In the next episode

In DEX Masterclass 103, we get down into the practical side of things and walk through each of the main sections you’ll find on Sparkdex.

Watch DEX Masterclass 103

Originally published at https://www.bitspark.io.

--

--

Bitspark
The Ledger

Bitspark helps you convert cash to cryptocurrency globally without banks. Send and receive money, and exchange between currencies at exceptional rates.