Binance Chain, like any other decentralized exchange, faces the eternal problem that has been plaguing DEXs for ages:Exchanges thrive on allowing users to trade a wide variety of tokens/coins, but how can a DEX list tokens from other chains while remaining decentralized?
So far the following solutions to this problem have been implemented:Custodian Model: Using wrapped tokens maintained by a custodian Atomic Swaps A new foe has appeared: Introducing BEP3 Atomic Pegs
Overall, these previous solutions are not perfect, as they either require a high level of trust in a centralized entity (Custodian Model) or have many drawbacks (Atomic Swaps).For these reasons, Binance came up with the BEP3 peg, a new kind of peg for tokens that come from Smart contract enabled chains, such as Ethereum, EOS or NEO.
BEP3 pegs draw inspiration from atomic swaps to construct a mechanism that takes the Custodian Model and strips away the trust required in some parts of the system.If you’d like to learn more about atomic swaps and how they work check out this article, but no knowledge of them is required to understand the rest of this article.
But enough talking, let’s look at the mechanism itself:Porting tokens to Binance Chain
BEP3 maintains the figure of a deputy, who is in charge of initially creating a new token inside Binance Chain and deploying a smart contract in the other chain. Afterwards, whenever a user wants to port their tokens over to Binance Chain the following steps are taken:The user locks their original tokens inside the smart contract along with a hash of a secret only known to the user, these tokens then remain locked unless the secret is not revealed in under X minutes, in which case they will get sent back to the user. The deputy discovers that some tokens have been locked and sends a message to Binance Chain saying “User has locked Y tokens, if his secret is r...