Cross-chain Bridges and Bagels
DeFi up to 2021 has mostly been built on the back of Ethereum. DeFi projects have brought an enormous amount of traffic to the Ethereum network over the last year causing a massive increase in gas fees. By the time ETH hit its All Time High in May of 2021, the gas fees had already become a massive issue to developers and users, causing them to explore other blockchains with lower transaction fees.
DeFi projects such as Bagels, PancakeSwap, Alpaca, 1Inch have found a second home on other blockchain networks to scale more efficiently and reduce fees all around. As more and more DeFi projects continue to shift to alternative blockchains, it will become increasingly important for value to move effectively between networks, and bridges or multi-chain protocols will be more important than ever before. DeFi projects also fit together like a glove, with lego-like value-add to one another and a blockchain network with the same ability is needed.
Some exchanges offer the ability for users to shift coins between blockchains, although having to use an exchange can be a restrictive feature on the movement of funds. Binance introduced the Binance Bridge to connect Ethereum with other networks.
Several projects such as Polkadot, Anyswap and Ren have introduced trustless solutions that allow users to transact funds cross-chain seamlessly as well. Bagels builds off of key features of these other protocols and adds some specific features that allow users to have the easiest experience when yield farming by introducing cross-chain yield farming (we’ll dive into this in a future blog).
What are Cross- Chain Protocols
Cross-chain bridges are protocols made up of smart contracts and mapping mechanisms that enable interoperability between different networks. Interoperability includes the ability to transfer tokens, data/state information, and smart contract details between stand-alone platforms.
This allows users developers to run dapps on multiple networks; run faster and cheaper transactions of tokens on other chains, that will be used for dapps on less scalable chains; and use tokens on one blockchain to be used for dapps on another.
Why Use Cross-Chain Bridges
The key reason why cross-chain interoperability is important is that it will allow users to get the benefits of dapps on each blockchain without having to switch between different blockchains. They take transaction pressure off of Ethereum, and spur development of other blockchains.
Bridges allow you to quickly move coins from a blockchain that has few dapps to one that has a need for liquidity. They also allow users to use dapps on Ethereum with funds from other blockchains, lowering gas fees for users. Users can complete smaller transfers quickly and without high transaction fees, enabling better scalability.
How Cross-Chain Bridges Work
Most cross-chain bridges use the lock and mint process for transferring value between blockchains.
To execute cross-chain transfers within a lock and mint protocol, a user locks their assets into a smart contract on the blockchain that they are using. Next, an equivalent token is created on the receiving blockchain. When the user goes to redeem the asset from the original chain, the equivalent tokens are destroyed. This asset-mapping process allows users to transact on either chain.
Let’s look at Bagel’s Finance cross-chain protocol, Dokodoa, to illustrate this. The Dokodoa cross-chain bridge is deployed on Ethereum, BSC and HECO. It is a smart contract and oracle protocol that allows Bagels users to complete deposits and cross-chain transactions with a single click. It eliminates the need to switch between different blockchain network settings to make transactions.
When a user sends an ERC-20 asset to the BSC or HECO chain, the user only needs to deposit the token on the Ethereum Dokodoa smart contract, and then redeem the asset on the smart contract on HECO or BSC.
An example:
John deposits 100 USDT in Dokodoa on Ethereum. The oracle monitors the account status on HECO, and the Dokodoa smart contract on HECO immediately maps 100 dUSDT (1 USDT = 1dUSDT) for John.
This is not the same as the token deposited by John on Ethereum, but it can be considered as an equivalent token. When John redeems 100 USDT on Dokodoa on HECO, the 100 dUSDT will be destroyed simultaneously.
Wrapped Bitcoin
Although trustless, decentralized cross-chain protocols are becoming increasingly popular, centralized solutions like wrapped bitcoin (wBTC) are just as popular. wBTC is an ERC20 token that allows bitcoin holders to benefit from the Ethereum network. BTC Holders deposit their bitcoin with a centralized asset company, BitGo, who locks their coins and mints an equivalent value of wBTC tokens for the holder on the Ethereum blockchain. For every wBTC, there is a BTC locked up, making the value somewhat equivalent.
This process allows “bitcoin” to be used in DeFi dapps on the Ethereum blockchain. Similar projects to wrapped bitcoin are available for other blockchains as well, and although they are centralized, they are another solution to move value across blockchains.
Associated Risks
Cross-chain bridges are very important for the next stage of development for DeFi as a whole, as they will increase connectivity in the entire ecosystem. But there are associated risks.
The first risk is with smart contracts and code. All cross-chain bridges utilize smart contracts to lock assets on the native chain before it mints new tokens on the new chain. If your assets can be easily unlocked and stolen, your minted tokens would be worthless as they cannot be redeemed. It is important to either look at the code associated with the cross-chain bridge you are using, or check to see if the code for the protocol has been peer reviewed by a reliable code auditing company.
Additionally, when running cross-chain deposits, it is important to check that you are receiving the right version of the associated token on the new chain, when you deposit your assets on the original chain.
If you are able to be mindful of those two risks, then you’ll be able to transact freely. Of course, projects in this space are always looking for new ways to improve user security and experience so that these protocols are accessible for everyone on every network.