ChainSafe Building ChainBridge

ChainSafe Building ChainBridge

Authored by Colin Schwarz

A Multi-Chain Arbitrary Message Passing Standard

Motivation

ChainSafe is excited to announce the release of ChainBridge: a modular multi-directional blockchain bridge to allow data and value transfer between any number of blockchains. We believe that the future of blockchain technology is to allow all major networks to interact with one another and to be able to share value and information. We are building ChainBridge to make this vision a reality. We believe it is not enough to simply facilitate transfers between many different networks. Once ChainBridge is complete, it will achieve this functionality in a decentralized and trustless manner to preserve the ethos of our space and to ensure there are no central points of failure.

Current Bridge Functionality

The launch of ChainBridge will feature a multi-step approach in order to reach our end goal of full decentralization and trustlessness. The first rendition of ChainBridge will rely on trusted relayers, but will feature mechanisms that make it impossible for any one relayer to abuse their power by stealing or otherwise misdirecting funds. In order for a transfer to be accepted and sent across the bridge, it must receive enough votes from the relayers to surpass a certain threshold. Relayers can create a proposal for a transfer and vote on such a proposal but the transfer cannot be executed until the specified threshold has been reached. This mechanism guarantees that multiple parties verify each transaction. The final release of ChainBridge will see the project transition to a fully decentralized model.

ChainBridge is chain agnostic and can eventually be extended to any blockchain network. The bridge offers the ability to transfer arbitrary data from one blockchain to another. A relayer runs software that monitors the different blockchains and signs transactions to execute the transfer of data between blockchains.

We will use an example of how tokens can be sent between two Ethereum chains to help the reader understand how the bridge operates. However, this is far from the only use case for ChainBridge and we will explore others later in the article. Sending tokens between Ethereum chains over the bridge starts at a bridge contract on the origin chain. Users of the bridge need to make at most two transactions to send assets from one chain to another. The first transaction is to whitelist the bridge contract to be able to spend tokens. This is done by calling the "approve" method on the token contract and passing in the bridge contract address for approval.

Next, the user makes a second transaction by calling the deposit method on the bridge contract, which will call the "transferFrom" method on the token contract, and emit an event. This will transfer the whitelisted tokens to the custody of the bridge contract and is the locking mechanism of the bridge.

A successful token transfer will emit a deposit event that is picked up by a relayer that is listening for these events. From here, a proposal is created on the bridge contract of the destination chain. Proposals have different statuses: inactive, active, finalized, and transferred. The newly created proposal is marked active, and contains a hash of the transfer data that was supplied from the deposit event on the origin chain. This will prevent the deposit data from appearing on-chain before a deposit has been approved. Other relayers then look at the hash, compare it against the on-chain data from the origin chain, and vote on the accuracy of the supplied data.

Once a vote has passed, a relayer can call the "executeDeposit" method The data is then passed off to the respective handler and finalized. The recipient of the tokens would now be able to do as they please with them.

This diagram outlines the basic architecture of the bridge software with our partners as examples of supported networks:

Partners

Currently, ChainBridge offers support for Substrate-based chains and EVM based chains (eg. Ethereum and Ethereum Classic). ChainBridge will soon support Celo as well (more about this integration and its use case to be announced soon). We have achieved this with the help of our valued partners: Aragon Network, Centrifuge (with support from the Web3 Foundation), ETC Labs and the Celo Foundation (more about this integration and its use case to be announced soon). Each of these organizations will be using the bridge for a specific use case that will expand their respective ecosystems by allowing interoperability with all the other projects that adopt ChainBridge, both current and future. The following are use cases that demonstrate the wide variety of functionalities that ChainBridge can enable:

Aragon allows users to create and operate DAOs so that they may "freely organize and collaborate without borders or intermediaries." Aragon was built on Ethereum and uses ANT, their own ERC20 token, to govern the Aragon Network, a digital jurisdiction that serves these digital organizations. In fall of 2019, the Aragon community voted to approve a proposal for ChainSafe to build Aragon Chain on Ethermint to complement Aragon on Ethereum. See here for a more in depth explanation of Aragon Chain. Although the Aragon Chain will be highly beneficial to the Aragon community by allowing for lower fees and higher customization, it will be even more useful if it is able to communicate and transact with Aragon on Ethereum. Specifically, Aragon needs a way for ANT holders on Ethereum to be able to stake their funds on Aragon Chain to provide security. ChainBridge will allow users to send value and data from Ethereum to Aragon Chain and back. Aragon Chain will feature its own ARA token and Aragon Chain validators will be able to stake their ARA to secure the chain and come to consensus on the chain's state.

Eventually, the bridge will also allow for events on Aragon Chain to trigger events on Ethereum and vice versa. This will enable coordination and cooperation between DAOs deployed on Aragon Chain and those deployed on Ethereum. For example, DAOs could be running on Aragon Chain and have an Agent contract on Ethereum to perform actions on behalf of the DAO. Furthermore, because ChainBridge is highly modular it can support any chain within the Cosmos ecosystem. We hope that Aragon Chain will be the first of many integrations.

Centrifuge-Chain is a protocol built using Substrate. Centrifuge's mission is to tokenize real-world assets on-chain as NFTs (Non-Fungible Tokens). ChainSafe has built a Substrate pallet, effectively a plug and play module for the tech stack. The pallet allows for the movement of native Substrate tokens and offers support for interactions between other Substrate native assets such as Centrifuge's NFTs. The bridge will allow users of Centrifuge to transfer their NFTs to Ethereum where they can be used as collateral for the various available DeFi protocols. This idea is novel and very exciting. It will be the first time an NFT from another chain would be used as collateral in a DeFi application. Furthermore, because of the modularity of the Substrate pallet, the bridge can connect to any Substrate-based chain. We hope that Centrifuge will be the first of many integrations within this ecosystem.

Another of ChainSafe's valued partners is ETC Labs. Despite choosing different paths as a result of the DAO hack in 2015, there have been many opportunities for cooperation and mutual development between Ethereum Classic and Ethereum since that time. One of the most exciting developments on Ethereum in recent years is the emergence of DeFi. Decentralized Finance has become a widely adopted use case for Ethereum and users of Ethereum Classic now seek to participate in DeFi as well. ChainBridge will allow users to lock up their ETC and transfer their value to Ethereum where the bridge will mint synthetic ETC. This ETC can then interact with DeFi on Ethereum however the user wishes. ChainBridge's two-way functionality will allow these users to transfer assets they may have gained from investing in Defi back to the Ethereum Classic network.

These are three excellent initial use cases for ChainBridge, but we hope the reader can appreciate the depth and range of possibilities that such a technology could come to represent. ChainSafe is extremely excited to be working with these partners and hopes to work with others in the coming months to develop new bridge connections and new use cases.

Future Plans

ChainSafe is very happy with the progress we have already made in developing ChainBridge, but we are most excited for what the future of this project holds. Our plan is to transition to feature trustless cross-blockchain functionality. The technical details of this are still in the works, but we will have some exciting updates to share in the coming months. ChainSafe looks forward to announcing more new partners that will soon be integrating with ChainBridge.

How to get involved

Please reach out to us at info@chainsafe.io if you would like ChainSafe to add support for your network to ChainBridge! Also, feel free to contact us if you would like to get involved in the project in some other capacity.