8.2 Interchain Services based on Poly Enterprise
8.2.1 Overview
A complete cross-chain transaction requires application contracts for multiple chains. For example, there is an application contract on the Ethereum Ropsten and a FISCO BCOS application contract on the BSN. These two contracts can interact across chains through the cross-chain protocol to ensure the correctness of the information. The cross-chain contract includes a management contract and an application contract. The management contract implements the core logic of the cross-chain protocol, developed by the BSN development team and is deployed in each chain; the application contract needs to be implemented by blockchain application publishers according to the cross-chain protocol and deployed in the blockchain network.
Management contracts include the following implementations:
1. ETH and FISCO BCOS
- EthCrossChainManager: contains logic of management.
- EthCrossChainData: used to save and manipulate data.
- EthCrossChainManagerProxy: used to implement logical contract upgrades.
2. Neo
- CCMC: contains the logic of management.
3. Fabric
- CCMC: contains the logic of management.
The application cross-chain contains the following functions:
1. Outbound: The source chain's application contract initiates a cross-chain transaction request and transfers this request from the source chain to the target chain. The user can call a self-defined method in the source chain's application contract which calls the ‘crossChain’ method of the management contract. This will send the cross-chain data through events.
2. Inbound: The target chain application contract receives the cross-chain transaction request. This request information sent from the source chain is passed to the target chain application contract. The cross-chain management contract receives and verifies the cross-chain information. The cross-chain protocol requires the target chain application contract and function name to be included in the cross-chain information. Then the management contract invokes the specified method for the specified contract address and passes the information to the target chain application contract.