User guide

更新时间:
复制 MD 格式

This topic describes how to use the Cross-chain Service console. It covers registering a blockchain, configuring cross-chain authorization for ledger data access and contract message pushes, viewing permissions, and checking contract messages.

Register a blockchain

Registering your blockchain is the first step in establishing a cross-chain connection. After you register a blockchain, the cross-chain data connection service accesses your blockchain and deploys a cross-chain contract to it. This contract is used for cross-chain information exchange.

Note

This service currently supports Ant Blockchain and Hyperledger Fabric. To register other types of blockchains, contact the product team.

Register an Ant Blockchain

  1. Log on to the Cross-chain Service console.

  2. Click Register Blockchain to open the registration page.

  3. Set Blockchain Type to Ant Blockchain, and then complete the registration steps.

  4. Follow the on-screen instructions to provide the basic information, account information, and certificate information for the Ant Blockchain. The cross-chain service uses this information to access the blockchain, deploy the cross-chain system contract, and submit cross-chain transactions.

    注册

Register a Fabric blockchain

  1. Log on to the Cross-chain Service console.

  2. Click Register Blockchain to open the registration page.

  3. Set Blockchain Type to Hyperledger Fabric, and then complete the registration steps.

  4. Follow the on-screen instructions to register.

    5

    1. Download the cross-chain chaincode package, create a channel, and install the chaincode package.

      1. Download the cross-chain chaincode package from the page.

      2. On your Hyperledger Fabric blockchain, create a channel for the cross-chain service.

      3. Install the chaincode package in the created channel.

    2. Create an account or request a certificate to obtain the configuration file.

      1. On your Hyperledger Fabric blockchain, register an account or request a certificate for the cross-chain service to use.

      2. If you are an Alibaba Cloud Hyperledger Fabric user, download the software development kit (SDK) configuration file. After you decompress the file, obtain the connection-profile-standard.yaml configuration file. If you are not an Alibaba Cloud Hyperledger Fabric user, contact Ant technical support to obtain the configuration file.

    3. Register the blockchain, provide the account or certificate, and upload the configuration file.

      1. On the page, create a blockchain domain name and upload the `connection-profile-standard.yaml` configuration file that you obtained in the previous step.

      2. After the registration is successful, provide the blockchain anchoring information. This information includes the cross-chain channel name, selected validation nodes, and the username and password that you created in the previous step.

        6

        Alternatively, you can directly upload the certificate and private key.

        7

    After the registration is complete, you can view information about the registered chain in the console.

Cross-chain management

View cross-chain domain name details

  1. Log on to the Cross-chain Service console.

  2. Click the Details button next to the registered blockchain to open the details page.

  3. On the Basic Information tab, you can view details about the cross-chain domain name.

    On this tab, you can view the blockchain's basic information within the cross-chain system, the domain name certificate, and the UDSN certificate.

View cross-chain system contracts

  1. Log on to the Cross-chain Service console.

  2. Click the Details button next to the registered blockchain to open the details page.

  3. On the Contract Information tab, you can view information about the cross-chain contracts that the cross-chain system has deployed to this blockchain.

    • Ant Blockchain cross-chain contract information

    • Fabric cross-chain contract information

Cross-chain authorization - Ledger data access

  1. Log on to the Cross-chain Service console.

  2. Click the Details button next to the registered blockchain to open the product page.

  3. Click the Cross-chain Authorization tab to open the authorization page.

  4. In the upper-right corner, click New Authorization.

  5. In the dialog box that appears, you can authorize another registered blockchain to access the current blockchain's ledger data through the cross-chain service.

    10

Cross-chain authorization - Contract message push

  1. Log on to the Cross-chain Service console.

  2. Click the Details button next to the registered blockchain to open the product page.

  3. Click the Cross-chain Authorization tab to open the authorization page.

  4. In the upper-right corner, click New Authorization.

  5. In the dialog box that appears, you can authorize a specific contract on another registered blockchain to send messages to a specific contract on the current blockchain.

    合约消息推送

    In the authorization example shown in the preceding figure, the blockchain crosschain1.oracle.chain allows the contract sourceContract on the blockchain crosschain2.oracle.chain to send messages to the contract destContract on the local blockchain.

    Important

    If you do not configure authorization settings, cross-chain ledger data access and message pushes through the cross-chain data connection service will fail.

View my permissions

If other blockchains have granted you permissions, you can view them in the My Permissions section.

12

Business contract development

Ledger data access development flow

The development flow for a user smart contract to use the ledger data access API operation is as follows:

  1. On the BaaS platform, obtain the name of the ledger data contract.

  2. Obtain the ledger data access API definition (ChainDataInterface.sol).

  3. In the user contract, import the ledger data access API definition.

  4. The user contract implements a callback interface to asynchronously receive ledger data.

  5. The user contract builds a ledger data access request (ChainDataCmdHelper.sol).

  6. The user contract sends a request to the ledger data contract. For a specific example, see the API usage examples.

  7. The ledger data service returns data in JSON format. For details about the format, see the ledger data structure section.

For more information about contract development, see Developer guide.

Contract message push development flow

The development flow for a user smart contract to use the contract message push service API operation is as follows:

  1. On the BaaS platform, obtain the name of the message contract.

  2. Obtain the contract message push API definition.

  3. In the user contract, import the contract message push API interface.

  4. The user contract implements a message receiving interface to be called by the cross-chain message sending and receiving contract.

  5. The user contract calls the message sending interface of the cross-chain message sending and receiving contract.

For more information about contract development, see Developer guide.