With the introduction of BEP3, now it’s possible to use atomic swaps to trade tokens native to Binance Chain for tokens native to other chains in a totally trustless way.How do atomic swaps work?
Atomic swaps work through a multi-stage mechanism that makes sure that either the whole trade is completed or no part of it is, making it so it’s impossible for one side to cheat by obtaining some funds without having honored their part of the trade. We’ll illustrate how these work using an example: Alice, who owns 1 BTC, will trade it with Bob for 1 BNB through an atomic swap:Alice locks her BTC into a smart contract that says “If Alice reveals her secret before X minutes, send this bitcoin to Bob, otherwise send it back to her”. Bob locks his BNB in the same way. Alice then proceeds to reveal her secret in order to claim Bob’s BNB. By revealing her secret, her BTC transaction is unlocked and Bob claims Alice’s BTC for himself. Drawbacks
While the trustlessness of this mechanism is perfect, everything isn’t rosy in atomic swap land, as these mechanisms have an important set of drawbacks that have prevented them from getting any real-world usage:They’re slow due to the fact that steps 2 and 3 must wait for the previous step to finalize, so there’s no skipping the waiting time of new transactions on both chains, which in Bitcoin is around 1 hour. They are always worse for one part of the deal, usually the party initiating the first step. This is because Bob can always wait some time and take the trade only if the price has moved in his favor, at the expense of Alice, who will be trading at a worse rate (another way of looking at it is that Alice is granting Bob an option on her BTC, at her expense). They are expensive, as they require 2 transactions on each chain for every single trade performed. BEP3 atomic swaps
BEP3, an improvement proposal for Binance Chain that was deployed on main chain a few weeks ago, introduced three new tra...