If you are able to donate and contribute to the Haven project, please click here. Thank you.
THORChain-The 3 parts to the protocol
Introduction
THORChain is a decentralised liquidity network that enables cross-chain swaps between self-custodial wallets. By pairing all assets against the native token RUNE, users have access to deep liquidity pools and transparent fees. This is an ingenious system of far greater complexity than this introduction will provide so we highly recommend that reading more about it here.
THORChain’s network is made up of three key roles:
- Nodes
- Liquidity Providers
- Swappers/Traders
Nodes and Liquidity Providers make the network possible so swappers/traders can exchange digital assets.
Nodes
ThorNodes are the computational backbone of the network. They host the non-native wallets, validate incoming and outgoing transactions and process transactions on THORChain. There are a limited number of nodes and each node is required to bond $1m in RUNE that is held as collateral to ensure good behavior. ThorNodes undergo a churning process where every 3 days, a node is kicked from the system and a new node is randomly selected from a pool of bidders to take its place. This ensures the system is constantly refreshing itself and cannot be captured by a group of actors.
Node Operators are rewarded by taking 67% of the fees generated by the THORChain network. You can read more about Node Operators here.
Liquidity Providers
THORChain operates a Continuous Liquidity Pool model to provide always-on liquidity to all assets in the system. This requires Liquidity Providers to deposit assets into paired pools for which they are rewarded with 1/3 of the system rewards and fee income generated from swapping activity.
When committing capital to a pool, LP’s are taking an ownership stake of the pool as a percentage. As the price changes and the ratio between the assets changes, the LP’s deposit will remain a percentage of the pool. This means that when they withdraw their assets the LP may receive a different ratio of assets but it will be equal to their deposit plus their share of the pool’s earnings. The loss of a particular asset due to changes in the price is known as impermanent loss.
In a perfect world, LPs are incentivised to deposit an equal USD value of their chosen asset and RUNE into their selected pooled pair. ie XHV:RUNE:.
When XHV is $3 and RUNE is $1.50, you should contribute a ration of 1:2 into the XHV:RUNE pool.
However, as the USD value of each asset is constantly changing, new depositors should deposit asymmetrically to rebalance the pair. If they don’t the protocol will arbitrage the pool to balance the ratio.
The exact amount each LP earns is subject to a number of factors which you can read about here.
Swappers/Traders
Of course, the entire purpose of THORChain is to facilitate users exchanging their digital assets for other digital assets. A user is able to swap between any assets in the system because they are all paired against RUNE. A user can also swap with RUNE directly.
Prices are determined by the depth of assets in each pool. Pools are assumed to be equal in $ value so the price of exchange is determined by the ratio of assets between them.
If there is 10 BTC and 300,000 RUNE then the exchange rate is 1:30,000.
With each transaction, the ratio of assets shifts which changes the exchange rate between the assets. To discourage large transactions that shift the exchange rate dramatically, a dynamic liquidity fee is charged.
If a user wants to swap between non-native assets like BTC to XHV, then the process is BTC > RUNE, RUNE is then moved from the BTC pool into the XHV pool and then exchanged for XHV. This process is handled automatically by the THORChain protocol.
If there is 30,000:1 RUNE:BTC and 3:1 XHV:RUNE then the ratio is 10,000:1 for XHV:BTC.
This means every asset on THORChain is linked to every other asset with RUNE acting as the middleman. This is where the term Continuous Liquidity Pool comes from.
Fees
THORChain fees are transparent but complex. They are weighted to incentivise the correct behaviour and to stabilise the system. There are two fees:
- Fixed Network fees
- Dynamic Liquidity fees
Fixed Network Fees
As THORChain nodes process activity on other chains, the fees within THORChain must also cover the external gas costs. To do this, THORChain maintains an awareness of the current transaction costs for each connected chain. A user is charged 3 times the current average cost on a connected chain, this enables a node to pay up to 1.5 times for the transaction, to ensure it is processed quickly, and then the remainder is absorbed into the pool.
Dynamic Liquidity Fees
The CLP algorithm includes a liquidity sensitive fee, otherwise known as a Slip-based fee. The fee is calculated using the ratio of transaction size to pool liquidity depth. The larger the transaction relative to the depth of the pool, the larger the fee. For liquidity providers, this means shallow pools might provide a better return on assets despite a lower transaction volume. Eventually, pools will tend to an equilibrium depth consummate to the volume of transactions passing through them.
Here’s an interactive example from the Rebase Foundation of asset swaps and the associated fees.
THORChain is enabling the decentralization of DeFi away from Ethereum. Haven’s private, stable xAssets will play a huge role in this ecosystem and you can play a part. THORChain will enable you to earn passive income by staking your XHV and xAssets whilst helping to provide extra liquidity to both protocols.