Posts

Understanding Price Determination in the Unique System Present in THORChain/Chaosnet

avatar of @kevinnag58
25
@kevinnag58
·
·
0 views
·
4 min read

INTRODUCTION

Chaosnet, THORChain's multichain decentralized exchange is the first protocol allowing for cross-chain swaps of assets in their native form (without being pegged or represented). THORChain's operation in this regard is permissionless, trustless and non-custodial.

By now, most are aware of two serious hacks that affected Chaosnet in July of 2021. These hacks were, however, professionally handled with a high degree of transparency; [See, e.g. Nagoda, K. Details Concerning the Exploit Against THORChain on July 15, 2021. (Accessed October 4, 2021)]. Following these hacks, Chaosnet was shuttered by THORChain while the faults present in THORChain's code was repaired. Now, the Chaosnet is reopening, so it's time once again to investigate factors that make THORChain unique.

In this supplement to the THORChain Coin Guide, let's give a look into how asset prices are determined in the THORChain/Chaosnet protocol.

*HOW ARE ASSET PRICES DETERMINED IN THE THORCHAIN/CHAOSNET PROTOCOL?

One of the main requirements of any decentralized exchange is the need to provide accurate pricing data to it's users to enable them to swap between various assets. THORChain/Chaosnet provides this accurate pricing absent the use of weighted averages or oracles. Instead, THORChain/Chaosnet provides accurate pricing through it's unique pool design as well as the reliance upon independent arbitrageurs.

Official documentation from THORChain is particularly instructive in this area. The following example of pricing in THORChain/Chaosnet is drawn from the presentation found at THORChain - Prices, accessed October 4, 2021:

A pool contains 16,000 MATIC and 1,000 RUNE. On external exchanges the price of MATIC is set at $0.02 and the price of RUNE set at $0.32. In the internal pool, the ratio of MATIC to RUNE is 16:1 which accurately reflects the external values of both assets.

Now a user enters and swaps 2,000 MATIC for RUNE. Using the 'swap formula', it it calculated that this user will remove 98.76 RUNE from the pool:

Photo Source

This creates a pricing imbalance between the internal and external asset prices. The internal pool now contains 18,000 MATIC and 901.24 RUNE, which is a ratio of approximately 20:1 while the external pool remains at a ratio of 16:1. The implication from this demonstrates that given this scenario it would be irrational for anyone to exchange MATIC for RUNE on THORChain as they would receive less RUNE for their MATIC than they would from the external pool.

So how does the system employed by THORChain/Chaosnet rectify this price imbalance? It relies on outside independent arbitrageurs to use their bots to quickly restore the balance. This is accomplished by the arbitrageurs trading RUNE for MATIC as they can obtain MATIC internally at a lower price, then sell the MATIC on an external market realizing a profit.

Through repeated small economical trades (the arbitrageur's swaps are split and become smaller and smaller keeping their transactions profitable), the arbitrageur's actions increase the amount of RUNE in the pool and decrease the amount of MATIC in the pool, until the ratio (as in our example) of 16:1 is restored.

*USING POOL BALANCES TO DETERMINE THE PRICE OF OTHER ASSETS

By using the balances in any pools, THORChain/Chaosnet is able to provide a price determination as to the value of one asset in terms of any other asset. For an example, you have a MATIC:RUNE pool and a TUSD:RUNE pool. Based solely upon the prices present in both pools, THORChain/Chaosnet is able to compute the value of 1 MATIC in terms of TUSD. The formula to obtain this information is:

Photo Source

Let's return to the example used above (MATIC:RUNE = 16,000 MATIC and 1,000 RUNE) and add a second pool, TUSD:RUNE which contains 3.300 TUSD and 10,000 RUNE. By plugging just these numbers into the equation, THORChain/Chaosnet know the price of 1 MATIC in terms of TUSD:

Photo Source

Accordingly in the example, 1 MATIC is worth 0.021 TUSD. The information used to yield this determination is found soley within THORChain/Chaosnet absent outside oracles. Thus, using arbitrageurs and permitting the market to normally operate, the THORChain/Chaosnet protocol works without utilizing external price data.

And for clarification purposes, the general formula for exchange rates between any two external assets is as follows:

Photo Source

*CONCLUSION

This pricing model employed by THORChain/Chaosnet differs from other exchanges as it does not use weighted averages or oracles to determine prices. The use of external sources provides nefarious actors vectors of attack against the network. Additionally, external sources are subject to manipulation causing their data to be unreliable.

THORChain/Chaosnet addresses this deficiency by relying on arbitrageurs to balance the various pools and correct the ratios as demonstrated above to provide market assurance that it's prices are correct.

*DISCLAIMER: The information contained herein is presented solely for educational purposes. It is not in any way intended to be construed as financial advice. Any forgone profit or loss realized by you is yours and yours alone and under no circumstances may be imputed to this author. Your author holds a long position in RUNE.

Posted Using LeoFinance Beta