Wormhole Update | The Substrate-to-Substrate Bridge Between Pangoro and Pangolin Testnet Deployed

The wormhole has been updated to V2.1.0, which supports the cross-chain transfer and redemption of ORINGs (native tokens of Pangoro Network) between Pangoro and Pangolin Test Network. The mapped assets of the issuing chain are managed by EVM (Ethereum Virtual Machine), so the network selection option should be from Pangoro to Pangolin Smart. Users will be able to easily use the infrastructure of Ethereum to manage the mapped assets. The later version will support the cross-chain transfer and redemption operations of RING (Darwinia Network Native Token) between Darwinia Network and Crab Network.

This article includes two sections. In the first part, we will introduce some fundamentals of the Substrate-to-Substrate Bridge. In the second part, we will demonstrate how to transfer assets between Pangoro and Pangolin through the wormhole.

Introduction to Substrate-to-Substrate Bridges

Token Protocols

They refer to the source blockchain and the target blockchain for cross-chain asset transfer via a bridge respectively, or the caller and the callee of a remote chain call. Generally, a light client of the source chain needs to be built on the target chain to perform cross-chain validation of messages or events from the source chain.

These two terms are a pair. A native asset is one that exists on its native chain, such as BTC on the Bitcoin network, as opposed to those that are wrapped or mapped, or that are transferred to other chains, such as wBTC. A native asset is typically an asset that has not been cross-chained, such as RING on Darwinia Network, while a mapped asset is one that is issued on another chain, such as ERC20-RING on the Ethereum network, by locking the native asset and with the locking proof in the CBA model.

A standalone application that provides the message relay service.

High-Level Protocol Overview

CBA stands for Cryptocurrency Backed Asset. To build the CBA model, we need to build a Backing module on the source chain and an Issuing module on the target chain. Detailed explanations can be found in the relevant sections and the technical paper.

  • Backing Module

The module that locks and unlocks the native assets on the source chain.

  • Issuing Module

The module that issues and burns the mapped assets on the target chain.

Backing Module (Source chain)

register(asset_address)

Parameter(s):

asset_address: Address of the native asset

lock_and_remote_issue(asset_address, recipient, asset_option)

Parameter(s):

asset_address: Address of the native asset

recipient: The address of the recipient on the target chain

asset_option: Attributes of the asset

Issuing Module (Target chain)

burn_and_remote_unlock(asset_address, recipient, asset_option)

Parameter(s):

asset_address: Address of the native asset

recipient: The address of the recipient on the target

asset_option: Attributes of the asset

Following are the sequence diagrams of cross-chain protocols:

A cross-chain transfer is the process in which native tokens are locked as backing assets on the source chain, and the mapped tokens are issued in the target chain. After the asset registration, assets can be transferred between two blockchains via a Darwinia cross-chain bridge.

During a cross-chain transfer, users lock a specific amount of native assets and assign a receiving account on the target chain by calling the lock_and_remote_issue() interface of the Backing module. They can get proof of locking from the source chain when succeeding. Then the relayer (a standalone application connecting two blockchains) forwards the proof to the Issuing module on the target chain. In the end, the Issuing module writes the calculated amount of mapped tokens to the receiving account after verifying the proof.

A cross-chain redemption is the inverse of a cross-chain transfer which refers to the process in which the locked assets are unlocked on the source chain after the mapped assets are burnt on the target chain. Burning the mapped assets and presenting the proof is the only way to unlock the locked assets.

During a cross-chain redemption, asset holders call the remote_unlock() interface in the Issuing module to burn an amount of mapped tokens on the target chain and assign a receiving account on the source chain. Then the relayer delivers the proof of burning to the Backing module on the source chain. In the end, the Backing module releases the locked assets to the assigned receiving account after verifying the proof.

  • Must be Delivered

The messages generated on the source chain must be delivered to the target chain as long as they are legitimate.

  • Must be verifiable

Legitimate messages can be verified between the Backing and Issuing modules, while illegitimate ones can be identified and blocked.

  • Who Pays

Those who launches the operation (registration, cross-chain transfer, cross-chain redemption etc.) pays the cross-chain fees.

  • In What Tokens

Cross-chain fees are paid in the on-chain assets of the originating blockchain of the cross-chain operation.

Mapping Token Metadata Standards

Example: If the original symbol is “RING”, the mapping token’s symbol will be “xRING”. If this token is mapped to a third chain further, the symbol will be “xxRING”.

name postfix: “[${backing_chain_short_name}>”

Example: If RING is mapped from Darwinia to Crab, assume RING’s name on Darwinia is “Darwinia Network Native Token”.

Note: It is using balances pallet instead of ERC20, so the name was newly created in Backing Pallet.

The mapping ERC20 token’s name on Crab will be “Darwinia Network Native Token[Darwinia>”, the token is mapped from Crab to Moonriver again, the name will be “Darwinia Network Native Token[Darwinia>[Crab>”.

Mapping Token Factory

Every bridge has a sub-module called Mapping Token Factory in the Issuing module. Its responsibilities include creating, issuing and burning mapping assets. Bridges to different target blockchains can share a singleton of Mapping Token Factory to manage different types of mapping tokens.

Before the creation of mapping assets, the Mapping Token Factory has defined a set of criteria for creating a mapping asset, the properties and methods of which are aligned as closely as possible to the native asset but are allowed to differ. The bridge can choose which criteria to use when creating a mapping relationship, but only one criterion is allowed for a native asset, meaning that the mapping asset and the native asset are in a one-to-one relationship. The standards are open for future upgrade. In addition, the mapping asset keeps the native property of the native asset.

The Issuing module system account manages the creation, issuance and redemption of mapped assets. The system account’s permission to operate is derived from the asset backing and burning proofs.

When a bridge between two chains is established using this protocol for native and mapped assets, it has independent security guarantees. That is, the security of any other path or bridge does not affect the security of that bridge.

How to Use Substrate-to-Substrate Bridge?

We will go on to demonstrate how to transfer assets between the Pangoro and Pangolin networks through the Wormhole. Before using Substrate-to-Substrate Bridge, we must do the following preparation:

  • Download and install the polka{.js} plugin;
  • Click Polkadot Apps , select TEST NETWORKS, switch the network toPangoro, and check Accounts after the switching is complete.
  • Copy the Pangoro address and send it in an email to ran.ji@itering.com to apply for the test token ORING.

Note: Cross-chain fees are charged based on the source chain assets at the initiating end of the cross-chain operation. Pangoro → Pangolin-Smart: Take ORING as the cross-chain fee. Pangolin-Smart → Pangoro: Take PRING as the cross-chain fee.

The full name of Pangolin-Smart is called Pangolin Smart Module, which is a module on the Pangolin chain. Since this module relies on DVM (Darwinia Virtual Machine) technology, at the same time, DVM and EVM (Ethereum Virtual Machine) are consistent in the underlying paradigm, users can use wallets in the existing Ethereum ecosystem to manage assets in Pangolin-Smart, such as MetaMask.

Since Pangolin-Smart relies on DVM technology, DVM and EVM are consistent in the underlying paradigm, its address format is consistent with the Ethereum account address format and generation method. The same starts with “0x…”. The Pangolin-Smart address can be obtained by adding a custom network in MetaMask.

  • Add a custom network in MetaMask, click Custom RPC.
  • Add Pangolin Test Network configuration parameters.

Network Name : Pangolin

New RPC URL: http://pangolin-rpc.darwinia.network

Chain ID: 43

Currency: PRING

Block Explorer URL:https://pangolin.subscan.io/

  • After the connection is successful, as shown in the figure below.
  • This address is the Pangolin-Smart address, which is usually referred to as DVM Address.
  • Apply for the test token PRING. For detailed operations, please refer to this document.
  1. Click the wormhole, turn on the testnet switch in the upper right corner, select Pangoro as the source chain, and select Pangolin-Smart as the target chain, click Connect To Pangoro ;

2. Select Sender Account, and fill in the Pangolin-Smart Address of the receiving asset;

3. Select the asset that needs to be cross-chain operation and fill in the amount;

Cross-chain Fee: The cross-chain fee uses source chain assets. Here, the source chain is Pangoro, and the native token on this chain is ORING, so ORING will be used as a fee for cross-chain operations.

Recipient will receive: The user is prompted for the name and quantity of the mapping token that will be received on the target chain.

4. Select Submit, after confirming the cross-chain information, click Confirm ;

5. After the transaction is completed, you can click Cross-chain history to view the cross-chain history;

Source Chain: Pangoro

Target Chain: Pangolin-Smart

Pangoro Network Address : 5HCRABCkEuB39MBM2gp54R1ja15s2L2nTMLMvJesr4eRY6DY

6. You can manage the mapping tokens through MetaMask.

xORING smart contract address: 0x368b27B3Ae3EB885266FCE70896A7e5C54C93c1E

  1. Click the wormhole, select Pangolin-Smart as the source chain, and select Pangoro as the target chain, click Connect To Pangolin-Smart ;

2. Select Sender Account, and fill in the Pangoro address of the receiving asset;

Recipient: It can be any Pangoro network account(address), not just the Pangoro network account(address) that has been transferred from Pangoro to Pangolin-Smart. Asset: xORING refers to the symbol of the mapping token, Darwinia Pangoro Network Native Token refers to the name of the mapping token, [Pangoro> indicates that the asset is cross-chain from the Pangoro network to the current network. The smart contract address of xORING is0x368b27B3Ae3EB885266FCE70896A7e5C54C93c1E . Recipient will receive: Pangoro address will receive ORING. Due to the transfer of assets from Pangolin-Smart to Pangoro, Pangolin-Smart's native asset PRING will be charged as a cross-chain fee.

3. Select Submit, after confirming the cross-chain information, click Confirm ;

4. After the transaction is completed, you can click Cross-chain history to view the cross-chain history.

What other Operations are Available by Using the Substrate-to-Substrate Bridge?

For more detailed operations, please refer to the Builders.

Version preview

After the Substrate-to-Substrate test bridge is deployed in the production environment, some continuous upgrades and tests will be carried out before the official network bridge is released, including:

  1. Important dependency updates and upgrades, including Substrate version and parity-bridge-common version;
  2. Substrate Pallet and contract security check;
  3. Template check of Mapping Token Factory and Mapping Token contract, as well as precompile quality check and cleanup related to interaction with EVM;
  4. Access test of Relayer Fee Market and test operation of Bridger client;
  5. Wormhole public testing and bug fixes.

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