Darwinia-Ethereum Bridge

The Progressive Launch of Darwinia Mainnet has reached the third stage: the bi-directional “Darwinia-Ethereum Bridge.”

Now, you can freely transfer RING and KTON between Darwinia and Ethereum in a decentralized manner. Of course, you need to pay some network gas fees (Ether and RING).

We will start by recapping some background knowledge for the Darwinia-Ethereum cross-chain bridge and the one-way bridge from the previous stage. Then we will focus on the Darwinia->Ethereum bridge that has been launched this time. You will learn the features, design rationale, and some of the implementation details. We will also walk you through Darwinia tech innovations and explain why the Darwinia cross-chain bridge is decentralized and trust-free.

Background knowledge

Darwinia Network is a decentralized cross-chain bridge network building on Substrate, the “Golden Gate Bridge Hub” of the cross-chain ecosystem. It provides the safest general bridge solution, connecting Polkadot, Ethereum, TRON, and other heterogeneous chains, realizing cross-chain assets transfer and public remote chain calls. As a bridging hub, any blockchain network connected to Darwinia can obtain cross-chain access to any other Darwinia connected networks without building direct bridges repeatedly on its own. Its main application areas include Defi, cross-chain NFT trading market, games, etc.

RING: RING is the native token for Darwinia Network. RING can be used as gas for transactions. Gas includes transaction fees, contract execution fees, bridging service fees, and more.

KTON: To encourage users to make long term commitments and pledge, users can choose to lock RING for 3–36 months in the process of Staking, and the system will offer KTON tokens as a commitment reward for users participating in Staking. KTON can join in the Staking to obtain more staking power.

Ethereum->Darwinia Bridge

The Ethereum->Darwinia, one way Bridge, is the primary component activated in the second phase of the Progressive Launch of the Darwinia mainnet.

The ERC20 version of RING and KTON and the RING deposits can be transferred to the Darwinia mainnet through the Ethereum->Darwinia bridge.

The Ethereum->Darwinia Bridge realizes the cross-chain verification while reducing costs by implementing a Super Light Client on the chain. Super Light Client uses a unique MMR data structure, which has been adopted by projects such as Grin and Beam. However, if the counterparty chain does not natively support the MMR header, many challenges have not been encountered in the implementation of Super Light Client on the chain.

Darwinia innovatively solves the challenge by implementing Super Light Client on the chain, introducing an Optimistic Verification Game protocol, and building a set of economically feasible cross-chain transfer bridge solutions to provide a future heterogeneous direction cross-chain technology.

To learn more information about Ethereum->Darwinia bridge implementation, please visit the wiki page or this medium article.

Darwinia-Ethereum Bridge (D2E Bridger)

Darwinia-Ethereum Reverse Bridge is a decentralized cross-chain bridge from Darwinia to Ethereum, referred to as the D2E bridge. The Darwinia-Ethereum Reverse bridge’s launch represents Darwinia completing the third stage of the progressive mainnet launch and the launch of Ethereum-Darwinia bidirectional asset transfer.

The primary function of the D2E bridge is to move crypto assets from Darwinia to Ethereum in a decentralized way. The user first locks his assets in the Backing Module on the Darwinia network, secured by the smart contract. No one can extract it. The super-light client implemented by a smart contract on the Ethereum observes the state of the Darwinia chain. The Issuing Smart Contract on the Ethereum will use the super-light client to verify the user-submitted Proof of Lock of his asset. Once the transaction was successfully verified, the Issuing Smart Contract will mint the bridged/mapped ERC20/ERC721 asset to the user’s Ethereum address.

Benefiting from the GRANDPA consensus protocol built on Darwinia with irreversible finality, the super light client deployed Ethereum can verify and confirm the user’s cryptographic proof in just a few minutes.

The above process is just the opposite of the Ethereum->Darwinia one-way bridge that has been activated in the previous stage. Besides, because Darwinia’s native assets are transferred to other heterogeneous blockchains, the D2E bridge is often called the Darwinia-Ethereum reverse bridge.

Features of D2E Bridge

Trust free

In the blockchain field, trustless means that you can manage or access your assets without trusting any centralized system or any participant in the system, and you can ensure the security of your assets.

There are many ways to achieve the cross-chain of assets, including centralized and decentralized. The custodial model is the simplest. You rely on an intermediary or a custodian to keep your asset safe and be honest. But the biggest drawback of the centralized approach is the heavy need for trust.

Darwinia Bridges, including the D2E Bridge, is designed to provide cross-chain capabilities in a decentralized manner. Users only need to trust the cross-chain protocols, the code, cryptography, and game theory that implement this set of protocols. All participants are incentivized to follow the rules of the game enforced by these cross-chain protocols, including Darwinia’s developers.

Substrate Grandpa has irreversible finality and can quickly finalize the blocks of Darwinia; In contrast, the Proof of Work (PoW) consensus system only has probabilistic finality and needs to wait for more block confirmations to obtain a high probability of finality.

Through the proof of Grandpa Justification, the block header of Darwinia and the MMR Root embedded in the block header can be finalized in the Ethereum light client smart contract. Then the historical blocks of Darwinia can be finalized. This is actually Darwinia’s super light client built on the target chain Ethereum. Grandpa finality mechanism and MMR proof are the core verification logic.

Low Gas Consumption

Everyone knows that the blockchain operation has a cost, so the use of the blockchain is not free.

Many decentralized cross-chain solutions are implemented by running light clients in the opponent blockchain, and Darwinia’s solution falls under this category. But classic light clients need to maintain all the block headers of the complete blockchain. This is an ever-growing overhead, especially if the chain is already very long. It will occupy a large amount of storage space on the opponent chain. In the blockchain’s multi-node distributed environment, the overall storage cost will become very considerable, and ultimately this part of the cost will be shared by users.

However, Darwinia’s light client is a super-light client. Compared with classic linear light clients that store every block header, It only requires a limited, on-demand block header to achieve the light client’s goal, that is, to verify the proof of the existence of any transaction using Merkle Tree. The solution will be introduced in the following sections.

The classic light client is technically workable but not economically sustainable. Darwinia’s sub-linear super-light client solves this issue.

The D2E bridge uses smart contracts to implement such a super-light client on the Ethereum network so that users can complete decentralized cross-chain operations at a very low cost.

Components of the D2E Bridge

The D2E bridge is mainly composed of the following parts, and its overall structure is as follows:

Darwinia super light Client on Ethereum

As mentioned earlier, most decentralized cross-chain solutions use light clients. A light client is a data structure that only contains the block headers of the blockchain. It does not need to store the sizeable complete block data. It can help users access and interact with the blockchain in a secure and decentralized manner without synchronizing the complete blockchain.

But for classic linear light clients implemented using a smart contract that store all block header, it is not light.

Darwinia implemented a Super Light Client that submits block headers on demand by introducing Merkle Mountain Range (MMR).

The Super Light Client does not need to save every block header. When needed, the bridge relayers submit the required block header to it to meet the data verification requirements. D2E Authorities guarantee the correctness of the block header submitted by bridge relayers. In the future, when the Ethereum precompiled contract supports Ed25519, the correctness of the block header can be guaranteed by Darwinia Grandpa Authorities.

Relayers

Since the chain cannot directly access each other, the cross-chain data submission needs to be completed by a third party. This third party is the bridge relayers.

Anyone can become a bridge relayer, and the bridge relayer obtains income by completing the relay task between the bridges. This incentive can promote the stable existence of bridge relayers to ensure the bridge’s regular operation.

D2E Authorities

As mentioned earlier, the correctness of the block header cannot be guaranteed by Grandpa Authorities. This is because the gas required to verify the Ed25519 signature on Ethereum is very high. Therefore, if Grandpa Authorities directly verifies the block header, the cross-chain cost will be very high at the current high price of Ethereum.

So Darwinia used an additional set of Authorities to accomplish this. The Council elected the Authorities. The Council will decide the increase or decrease of members. The core element of D2E Authorities is the Grandpa protocol simulation, replacing the encryption Algorithm from Ed25519 to Ecdsa, which is not supported by Ethereum.

Anyone can apply to become an Authority, and then the Council will vote to decide whether to approve their application. Once they become an Authority, they must perform the authority’s duties. Before a Darwinia block header is submitted to Ethereum, the Ecdsa signature must be performed on the MMR Root required to verify the block header.

In addition to the responsibility of signing the MMR Root, when the Authority set is changed, the original Authorities also need to sign the new set of Authorities to complete the Authorities change process.

Authority will be motivated when it completes its duties. If it fails to complete its duties within a certain period of time (before “the block height at the time of the signature request sent + 100”), it will be punished. All RINGs staked at the time of application will be slashed.

Ethereum Backing Module on Darwinia

Ethereum Backing is a module that backs the issuance of Darwinia assets on Ethereum. Simply put, assets transferred to Ethereum need to be locked in this module.

Therefore, when users want to transfer assets to Ethereum through the D2E bridge, the first step to do is to lock the assets in the Ethereum Backing module. Wormhole application will help you accomplish this and collect cryptographic proof-of-lock.

Security Mechanism

At the beginning of the Darwinia-Ethereum bidirectional bridge, we applied several security modules:

Daily Cross-Chain Transfer Limit

A daily transfer limit is set. Once the limit is reached, the bridge will suspend service. The used quota will be reset, and the service will re-activate after 24 hours.

Guardian Module

A guardian system is introduced in the bi-directional bridge. It is a multi-signature system composed of the technical committee members of the Darwinia network. Their sole responsibility is to monitor the bridge miners’ block data (relayers) and watch the optimistic verification game process. If an accident occurs, such as an error block header is not successfully challenged for the absence of honest miners or MMR calculation errors, the guardians will kick in and flag the block as illegal after the multi-signature operation. The guardian system can ensure that no false verification occurs, and the verification game enters the next round until it succeeds. The guardian system can only invalidate the error block header. It cannot access the user assets locked in the module.

With the iteration of the development and the contracts auditing, the daily transfer limit will be gradually increased and eventually removed together with the guardian system.

D2E future improvement

The decentralized cross-chain transfer bridge between Darwinia and Ethereum has design difficulties and some engineering challenges. For example, the current Grandpa Justification Proof contains the cryptographic signature of Ed25519, but the current Ethereum Smart contracts have not yet supported Ed25519’s signature verification in precompiled contracts. If you directly use smart contracts to implement the signature algorithm, you will face excessive gas costs. Although there have been related improvement proposals, such as EIP665, it is still in the Draft state and has not been implemented yet. In order to solve these practical engineering problems, we innovatively designed a set of Grandpa Authorities proxy mechanisms. By embedding this set of proxy modules in Darwinia Runtime, we successfully implemented a set of Ethereum standard secp256k1 ECDSA encryption signatures to proxy Ed25519 signatures.

The D2E bridge will not stop here, and its development work will continue. The next improvement plan will focus on the following aspects.

1. Before Ethereum does not adopt EIP-665, BEEFY will be a more general way.

Parity is developing a secondary protocol of GRANDPA called BEEFY (Bridge Efficiency Enabling Finality Yielder) for Substrate. This protocol is based on GRANDPA Finality, and its purpose is to allow Substrate-based chains to more efficiently bridge non-Substrate blockchains. Currently mainly ETH mainnet.

This protocol is on top of GRANDPA Finality. It will run a separate round of BFT agreement where each voter will be voting on the same thing. Namely, each voter will be voting on the MMR root of the latest block finalized by GRANDPA.

The D2E bridge plans to use BEEFY to implement the light clients after BEEFY matures in the future.

2. Directly use GRANDPA Justification for block verification in the super-light client on the Ethereum side.

If Ethereum adopts EIP-665, the cost of verifying GRANDPA Justification in Ethereum smart contracts will be greatly reduced, and then GRANDPA Authorities can be used to replace Authorities for block verification.

3. Reduce the numbers of public keys and signatures through Merkle trees

4. Generalization framework

5. Support arbitrary token registration and cross-chain transfer

Wormhole

The wormhole is a web3 application that connects various chains to provide a user-friendly interface for users to perform cross-chain asset transfer. The wormhole will guide users through the multiple steps process and help collect and generate required cryptographic proofs for Lock/Burn/Redeem events. It provides a friendly interactive wizard and on-chain transaction status display and helps users interact with various chains’ wallets to complete cross-chain operations.

D2E cross-chain asset transfer tutorial

All you need to know about Darwinia

[Website] [Twitter] [Telegram] [GitHub] [Discord]

As an open cross-chain bridge protocol based on Substrate, Darwinia focuses on the construction of future Internet of Tokens. TG: http://t.me/DarwiniaNetwork