Introducing the Darwinia Universal Cross-Chain Messaging SDK
We are happy to announce the Darwinia Universal Cross-Chain Messaging SDK, a solidity library that provides the easiest way for decentralized applications to become cross-chain applications. By simply importing the SDK, developers can integrate cross-chain messaging capabilities into their new or existing Dapps.
The SDK abstracts away the technical bits of LCMP and other cross-chain protocols for developers, reducing the level of difficulty required to use them. It allows developers to focus on integrating only the capabilities they need, from the blockchains that provide them.
We’ve currently implemented the Substrate-based Messaging SDK, which provides a wrapper for LCMP on Substrate.
The Substrate-based Messaging SDK (S2S SDK) is implemented in solidity (shown in hot pink). It calls Darwinia Messaging Modules through precompiled contracts on the Darwinia Smart Chain(EVM). The Darwinia Messaging Modules are a series of pallets running on the Substrate-based chain, which utilize LCMP protocol to package and transmit cross-chain messages.
The EVM-compatible Messaging SDK (E2E SDK) for general use is currently under development. It is based on a set of LCMP implementations developed entirely for EVM. The underlying layer does not depend on Substrate, which means that it can run on any EVM-compatible blockchain. It should be noted that the E2E SDK is not intended to replace the S2S SDK. We choose the best underlying tech stack for different platforms, and hope to eventually provide developers with a unified cross-chain operation interface.
In addition, our cross-chain capability is currently utilizing LCMP, but we are also exploring support for different cross-chain protocols, see What is DARWINIA? for more information.
Dapp developers only need to deploy an endpoint contract on the source and destination chains to use the capabilities provided by the SDK.
An endpoint is a cross-chain operation entry point. it is prepared and deployed by Dapp developers. An endpoint represents a bridge between the local chain and the remote chain. Therefore, if a Dapp needs to interact with multiple chains, you need to prepare multiple endpoint pairs, each endpoint pair responsible for interacting with one chain.
Implementing an endpoint is very simple, just inherit an abstract contract and implement some simple functions. You can see an example here, and we also provide a guide, so you can start right away.
Why do Dapp developers need to implement endpoints themselves? Because the endpoint needs to have access control. Dapp developers can add permissions according to their own needs. Also, If others can call your endpoint’s functions or modify your endpoint parameters, it is definitely not safe! So, an access control strategy should be added to endpoints to restrict access to their functions. For example, you can use openzeppelin’s access-control to limit access to endpoints to only certain accounts.
You only need to deploy your endpoint pairs once, as these endpoints can be shared by your contracts.
After the paired endpoints are set up with their counterpart’s respective contract address, they can communicate cross-chain with one another.
HelixBridge utilized Darwinia Universal Cross-Chain Messaging SDK to implement cross-chain asset transfers. HelixBridge is a secure and easy to use platform for cross-chain asset transfers. It integrates the best asset bridging projects in the industry, providing users with a filtered list of asset bridges and a cross-chain portal.
HelixBridge manages cross-chain asset transfers using the Cryptocurrency Backed Asset(CBA) model, which has several functions requiring cross-chain interaction:
- Register token. Register a token type to the bridge.
- Remote issuing. The issue method on the target chain is called remotely through the SDK.
- Confirmation. The target chain calls back the confirmation method of the source chain.
You can learn more here.
- EVM-compatible Messaging SDK
The underlying layer is completely implemented in solidity and can run on any EVM-compatible chain, such as ETHEREUM, BSC, etc., and can provide a wider range of cross-chain capabilities.
- XCM support
Cross-Consensus Message (XCM) is a general-purpose cross-chain message format developed by Polkadot that defines a language around how to transfer messages between two interoperable blockchains. XCM is not specific to Polkadot, it aims to be a generic and extensible language between different consensus systems. Darwinia will also use this format to define cross-chain messages.
- Hybrid Message Routing
Darwinia’s cross-chain vision is not limited to the Polkadot ecosystem, but geared toward expanding to multiple ecosystems in the future. The life cycle of a cross-chain message may span multiple ecosystems. Therefore, there will be a hybrid routing system. The Messaging SDK will provide a set of libraries that support hybrid routing to simplify message packaging.
About Darwinia Network
Github | Website | Medium | Twitter | Telegram
Darwinia is a cross-chain messaging infrastructure, which provides a light client-based, programmable, universal cross-chain messaging network for decentralized applications. Now, we’ve successfully used Darwinia’s light-client cross-chain messaging protocol(LCMP) to bridge cross-chain messages between substrate-based chains, and even between substrate-based chains and EVM chains, meanwhile, Darwinia provides developers with the SDK, and developers can easily integrate cross-chain capabilities into their Dapps. This will have profound implications for cross-chain interoperability, and Darwinia will as a cross-chain messaging infrastructure to prompt the building of a hybrid cross-chain network for Polkadot.