How to swap cryptocurrencies
TLDR; atomic swaps take longer and can have limited liquidity. Thorchain fixes this.
Swapping two cryptocurrencies should be simple. Yet it involves multiple steps and can be complicated depending on the currency you want to swap. In case your coins are stored on a centralised exchange like Binance, then it’s really easy to swap, but on Binance you don’t hold custody of your coins (Mt. Gox shows why it might be a good idea to hold your coins).
Let’s say we’d want to swap some BTC for ETH and have the coins stored on a hardware wallet.
- You could transfer them to Binance, execute the swap and transfer them back to the hardware wallet, paying fees for the transfer and swap.
- Atomic swap the coins using something like the Liquality Swap Interface. You can connect your wallet and execute the swap paying a fee and waiting for completion.
- Use Thorchain and its cross-chain bridges. Here too, you connect your wallet and pay a fee.
Option 1 is admittedly what most people do these days as a CEX (centralised exchange) is where you buy crypto with your hard earned fiat. You just know how to use it and might even be too lazy to move your coins onto your own wallet.
But let’s look at the alternatives, shall we?
Atomic swap is a technology the crypto community has been working on for a long time and yet, hasn’t really picked up. A great, detailed, guide on how it works can be found here, so I’ll try to keep it simple.
Bob and Alice don’t trust each other but still want to swap assets peer to peer. Like in the real world, if you don’t trust the other party, an escrow helps secure the assets until both parties have paid and the swap can be executed.
In the digital world Alice and Bob pay their respective amounts into separate escrow smart contracts that lock in the funds. These two escrows are locked with a hashlock and a time lock preventing the funds to be accessed before both parties have deposited the correct amount. The timelock is a timer that prevents the contracts from being open forever. Hashlock will ensure both escrows only open to simultaneously release the funds. The technology is called HTLC.
The swap mechanism ties the swap time to the slowest blockchain. If you’re using Bitcoin, the swap will take a minimum of 10 min. Since it’s peer to peer, a peer needs to be found to provide the liquidity and take the other side of the swap. Some run market maker bots and some have “professional market makers” providing liquidity. The process can also require multiple steps between parties to complete the swap.
Thorchain offers swaps by running a decentralized exchange across chains allowing you to trade native tokens. It’s called a cross-chain bridge — bridging two blockchains (this is a great overview).
Cross-chain Bridges are simple in concept; an asset is locked on one chain; whilst an identical asset is atomically “minted” on the other and sent to an address owned by the original party. (link)
The whole thing works using liquidity pools which means people can deposit their coins to earn yield in the form of fees paid for swap transactions. So instead of just having your BTC sitting in your wallet, you can get it to work by depositing it into a pool. This pool is used to provide instant liquidity to trades.
Say you want to swap ETH to receive BTC. Thorchain uses the pooled BTC to pay out the equivalent amount for your ETH and charges you a small fee for this transaction. This fee goes to the depositor of BTC who has pooled his funds and thus provided liquidity.
Obviously, the final settlement into your wallet will be dependent on the slowest chain, so Bitcoin again will have you wait for ~10 min. The Liquidity pool, however, will confirm your swap much faster as you can tap into the pool without having to search for a peer to swap with you.
Swapping tokens is still in its early stages. Uniswap is the biggest DEX but is only able to swap within the Ethereum ecosystem. You can only trade ERC20 tokens. If you own coins outside of Ethereum, then you can use one of the three options above.
As more fiat money is invested into cryptocurrencies, people will stop moving back to fiat when trading to alternative coins, seeking best returns. When fiat is not involved at all, centralised exchanges will lose a big advantage. Thorchain and atomic swaps will help support these crypto to crypto swaps. Aside from that, decentralised exchanges, of course bring the big benefit of keeping custody of your coins and in theory offering lower fees as everything is automated.