Sending cryptos across chain
How do you send crypto acrosschains? One of the biggest issues with DeFi and Blockchain technology, ingeneral, is that there is no perfect process for moving assets from one chainto another. This leads to a highly fractured crypto-economy where users need tofind ways of moving their assets from one chain to another.
There are a few ways of doingso, but for the average person, it is highly confusing. The chances of making amistake and losing funds are high. Simplifying the decentralised process ofmoving assets between chains is essential if crypto is to be adopted.
What is bridging?
One way of moving capital fromone chain to another is through a method called cross-chain bridging.
A cross-chain bridge creates aconnection between two blockchains facilitating the flow of data, capital, andassets between their respective ecosystems. This works through the use ofsmart contracts.
How does bridging work?
Consider the simple example ofa user bridging ETH from Ethereum to Avalanche:
· The user deposits ETH from an Ethereum wallet intothe bridging contract
· This ETH is locked on the Ethereum side. Anequivalent ETH token is minted on the Avalanche side – WETH (Wrapped ETH)
· WETH is pegged to ETH in a 1:1 ratio, since WETH onthe Avalanche side can only minted if there has been ETH deposited on theEthereum side.
· WETH can then be used to interact with DeFiproducts on the Avalanche ecosystem.
· To bridge that ETH back to Ethereum, the usersimply deposits the WETH into the bridging contract, which is then burned. TheETH initially deposited on the Ethereum side is unlocked.
Bridging is not perfect- bybridging you are placing trust in the bridging contract that it will not failor be subjected to a hack/exploit. Also, wrapping and unwrapping tokens requiregas fees as users are interacting with a contract. In the case of Ethereum,this can become quite expensive.
Nevertheless, the pros ofbeing able to bridge two ecosystems and the ability to transfer liquiditybetween them generally outweigh the risk of contract failure.
Cross-chain swaps (Atomic Swap)
Another optionfor interoperability between chains is cross-chain (atomic) swapping.An atomic swap is simply the process of changing one token with anothertoken of equal value, except the two tokens do not have the same tokenstandard.
For example, if a user had 1BTC worth $40,000 and they wanted to swap to LTC, which was worth $400 pertoken, they would be able to swap that 1 BTC to 100 LTC.
How do atomic swaps work?
Atomic swaps are generallypeer-to-peer and executed through the use of a smart contract. Here’s how itworks:
· Steve wishes to swap his BTC to LTC. So, hedeposits 1 BTC into the swap contract.
· Amy wishes to swap her LTC into BTC. She deposits100 LTC into the swap contract.
· The contract recognises that there is enough BTC tofulfil Amy’s order, so it routes Amy’s LTC to Steve giving him 100 LTC andsends Steve’s 1 BTC to Amy.
· The transaction is complete.
The benefit of this kindof transaction is that no party can be scammed by the other as the smartcontract holds all funds in escrow.
However, the cryptocurrenciesinvolved must have similar hashing algorithms. Another issue is thatatomic swaps work on an “all or nothing” basis – either all the coins areswapped or none of them are. This is inefficient as the time taken to find acounterparty with a specific amount of coins limits how quickly the swap can beexecuted.
Cross-chain/multi-chain swaps (Liquidity Pools)
Another option that has onlyrecently been introduced is cross-chain swapping via liquiditypools. Essentially, this method of cross-chain swapping is executed in asimilar manner to an atomic swap.
The main difference is thatthe swap is instantaneous, and the contract does not have to find acounterparty with enough tokens to fill the order. Instead, a series ofliquidity pools is used to facilitate the swap through an automated marketmaker.
Any asset can theoretically beswapped for any other asset if there is a liquidity pool for those assets.Currently, the only true example of a multi-chaindecentralised exchange is THORChain Protocol.
How do multi-chain swaps work?
Cross-chain swapping throughthis method is generally carried out with the assistance of an intermediatorytoken, in the case of THORChain this token is RUNE. Here’s how it works:
· Bill wants to swap his BTC for ETH.
· He connects his wallet to THORChain, sets theamount of BTC he wants to swap, and is shown the amount of ETH he will receivefor his BTC.
· He accepts the transaction and his BTC is depositedto the BTC-RUNE liquidity pool.
· From the BTC-RUNE liquidity pool, the equivalentvalue of the deposited BTC in RUNE is routed to the ETH-RUNE pool.
· The equivalent value of the RUNE received by theETH-RUNE pool is sent to Bill’s wallet as ETH.
· Bill has received his ETH, and the transaction iscomplete.
To visualise what justhappened, here’s a simplification:
Bill’s Wallet > BTC >RUNE > ETH > Bill’s Wallet
Essentially the deposited BTCwas swapped to RUNE, and the RUNE was then swapped to ETH. By using thisintermediatory asset (RUNE), THORChain is able to establish links betweenchains. It can compensate Bill for his BTC with ETH already existing withinTHORChain’s liquidity pools.
This method is much moreflexible than an atomic swap and is executed instantaneously and on-demand.There is no waiting for a counterparty to take the other side of the trade.Bill doesn’t see any of this happen. As far as he is concerned he has swappedBTC to ETH without any hassle.
The downside of swapping usingthis method is that there is often slippage involved. Slippage is a smallpercentage of the transaction that is lost due to the nature of liquiditypools. As the pool becomes unbalanced slightly as assets are moved around, thevalue of the assets in those pools appears to change a small amount.
Additionally, transaction feesfor both chains must be considered as the transaction has to be recorded onboth blockchains.