On THORChain, users can swap their digital assets for other digital assets. The network aims to give users access to:
A large variety of assets through cross-chain compatibility and simple asset listing
Superior user experience through open finance protocols and permissionless access
1-transaction access to fast chains (Binance Chain), smart chains (Ethereum), censorship-resistant chains (Bitcoin) and private chains (Monero).
Users can swap any assets which are on connected chains and which have been added to the network. Users can swap from any connected asset to any other connected asset. They can also swap from any connected asset to RUNE.
THORChain manages the swaps in accordance with the rules of the state machine - which is completely autonomous. Every swap that it observes is finalised, ordered and processed. Invalid swaps are refunded, valid swaps ordered in a transparent way that is resistant to front-running. Validators can not influence the order of trades, and are punished if they fail to observe a valid swap.
Swaps are completed as fast as they can be confirmed, which is around 5-10 seconds.
Swaps on THORChain are made possible by liquidity pools. These are pools of assets deposited by Stakers, where each pool consists of 1 connected asset, for example Bitcoin, and THORChain's own asset, RUNE. They're called Continuous Liquidity Pools because RUNE, being in each pool, links all pools together in a single, continuous liquidity network.
When a user swaps 2 connected assets on THORChain, they swap between two pools:
Swap to RUNE in the first pool,
Move that RUNE into the second pool,
Swap to the desired asset in the second pool with the RUNE from (2)
The THORChain state machine handles this swap in one go, so the user is never handles RUNE.
See this example for further detail and the page below for broader detail on Continuous Liquidity Pools.
The output of a swap can be worked out using the formula
x is input asset amount
X is input asset balance
y is output asset amount
Y is output asset balance
The BTC.RUNE pool has 100 BTC and 2.5 million RUNE. A user swaps 1 BTC into the pool. Calculate how much RUNE is output:
This user swaps 1 BTC for 24,507.40 RUNE.
The cost of a swap is made up of two parts:
All swaps are charged a network fee. The network fee is dynamic – it's calculated by averaging a set of recent gas prices. Learn more about Network Fees.
Note that users who force their swaps through quickly cause large slips and pay larger fees to stakers.