Foreword

As a distributed ledger technology, blockchain can be used in various sectors, such as finance, health care, supply chain, and asset management. However, limited throughput and scalability, and network isolation prevent blockchain projects from better serving business applications. Among these limitations, network isolation hinders the collaboration between different blockchains and significantly limits what blockchain can do.

Introduction

In the previous tech point article, we talked about the six components of the Ontology multichain design: Multichain Management Contract, Block Header Synchronization Contract, Cross-Chain Management Contract, ONG (x) Contract, dApp Contract, and Relayer.

This article will focus on what the Multichain Management Contract can do and how to implement it.

Multichain Management Contract

The Multichain Management Contract manages all side-chains, including side-chain index, asset status, validator staking status, and other information. The contract has the following functionalities:

Side-Chain Registration

When side-chains register with the main chain, they need to use their ONT ID to complete the KYC process and submit basic information such as genesis block information and stake size to the main chain. At the same time, the side-chain needs to stake a certain amount of ONG into the main chain, which is jointly staked by the initial validator of the side-chain. The amount of the ONG staked by the side-chain validators is agreed by themselves, but should not be lower than the promised total amount of ONG. Before submitting the registration information, the side-chain validators need to stake enough ONG into the main chain. If the staked amount is insufficient, the registration will fail.

If there are malicious acts on the side-chain (for example, the side-chain validators increase the supply of ONGx maliciously), a corresponding amount will be deducted from the staked ONG as a penalty. The main chain governance committee reviews the basic information submitted by the side-chain, and after approving it, allocates a fund pool for the side-chain based on the amount of the staked tokens, which is used to manage the assets used by that chain to interact with other chains. At this point, side-chain registration is completed.

As we can see, the ONGx assets on the side-chain are determined by the size of the fund pool on the main chain. If side-chain acts maliciously, then the staked token by that side-chain on the main chain can be used to compensate users. Therefore, to ensure safety, normally the size of the side-chain fund pool should be smaller than its staked token amount.

2. Change of Validator Information

In the event of a change of side-chain validator information, then the new validator needs to stake enough ONG on the main chain beforehand and the stake amount cannot be lower than that of the old validator. When the information state synchronization program Relayer submits the validator’s block header of the new consensus round to the main chain, the main chain verifies whether the stake amount is large enough. If not, the block header synchronization will be rejected. Otherwise, the ONG staked by the old validator of the side-chain will be unlocked after the validator’s information has been changed twice.

3. Cross-Chain Asset Exchange

After the side-chain has been registered, users can lock their ONG on the main chain into the fund pool of the side-chain registered with the main chain in exchange for the assets on that side-chain accordingly.

Figure: Cross-Chain Asset Exchange

After users lock their ONG on the main chain into the fund pool of the side-chain registered with the main chain, the main chain will generate the corresponding IOU information. If the fund pool on the main chain has been filled up, then the locking fails. If the locking is successful, then the Relayer or users can release the corresponding amount of ONGx based on the IOU information generated by the main chain. Reversely, if users burn ONGx on the side-chain, then they can release the corresponding amount of ONG on the main chain based on the IOU information generated by the side-chain.

4. Side-Chain Asset Management

If the sidechain wants to increase the capacity of the fund pool on the main chain, it can increase its staked amount on the main chain and submit an application to the main chain. If its application is approved, then its fund pool will be enlarged and the asset supply on the side-chain will be increased accordingly.

Similarly, if the side-chain wants to reduce the capacity of the fund pool on the main chain, it can submit an application to the child chain. If its application is approved, then its fund pool will be reduced and the asset supply on the side-chain will be decreased accordingly. Please note that the staked amount corresponding to the lower limit of the sidechain fund pool capacity is not allowed to be less than the total amount of ONG currently locked by all users.

5. Side-Chain Logout

If the side-chain needs to log out, it needs to submit a logout application to the main chain and there will be a challenge period, during which users can convert the assets on the sidechain back to the main chain. After the challenge period, any unconverted ONGx on the side-chain cannot be transferred back to the main chain.

Afterword

We will share more details about the Ontology multichain design in future tech point articles. Also, the Ontology cross-chain TestNet was launched in May and we have prepared detailed Developer Manual and video tutorials for fellow developers. Try developing on the TestNet and give us your feedback.

Ontology Multichain Documentation Link:

Ontology Multichain Developer Manual

Cross-Chain Tutorial

Video Tutorials Link:

Ontology Multichain TestNet

Ontology Cross-chain Contract Development