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.
4. BSN Testnet Cross-chain management contract address
The following table shows the framework names, chain IDs, and cross-chain contract names or addresses for Poly Enterprise-based cross-chain services.
Cross-chain contract names/addresses:
Testnet | Framework | Chain ID | Cross-chain contract names/addresses |
---|---|---|---|
China | Fabric | 88 | ccm |
FISCO BCOS | 98 | 0x8f866dE652d34308De82E7DaF504D1af4B4b05E9 | |
International | Fabric | 89 | ccm |
FISCO BCOS | 99 | 0xaF92fAe702C24CF5B214645AdFE25821b5664667 | |
Ropsten | Ethereum | 2 | 0xBeB102965dcA6a9Cc37f013343E867191558C922 |
Testnet | Neo | 4 | 0x10b6edbb6e44188d0ff39065442081b13bbd109b |
- Application Example Contract:
Testnet | Framework | Chain ID | Application Example Contract |
---|---|---|---|
China | Fabric | 88 | myhellopoly |
FISCO BCOS | 98 | 0x2e98f68147887288f1eb2ebd065ccc46be9bc4f9 | |
International | Fabric | 89 | myhellopoly |
FISCO BCOS | 99 | 0xd8e0013aa9b41bb946aee1a848b5665c17951200 | |
Ropsten | Ethereum | 2 | 0x7210c828d9455C5319f50d206C9EdD603CE1F999 |
Testnet | Neo | 4 | 0x73090f73056cfc40895799c2a061da7904d8b53d |
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.