8.3.2 Interchain Architecture based on IRITA

1. Cross-chain Contract

1) Service Core

As the core of the entire cross-chain contract, Service Core is responsible for receiving a cross-chain request from the application contract, the request result from the relayer, and return the cross-chain call result, including the following functions:

  • Call Service: Function to make a cross-chain request. It is invoked by the application contract by passing the interchain service name, input parameters, callback contract info, etc. A successful invocation will return a unique request ID.

  • Set Response: Return the cross-chain invocation result called by relayer and write the result to the application chain. If an application contract method needs to be called back during service invocation, it needs to be called in this function.

  • Get Response: Query the cross-chain invocation result by request ID.

2) Target Core

TargetCore is the entrance of the target contract on the target chain, responsible for receiving cross-chain requests from the cross-chain to the target chain, redirecting requests to the target contract, and generating events containing the response message after getting the response, including the following functions:

  • Call Service: Call the function of the target contract, called by the provider, pass in the requestID of the cross-chain request, target contract address, call parameters, and return the call result after successful call.

2. Application Contract Application contract is developed by the developer for the interchain services. In an application contract, the developer can invoke the call service function of the cross-chain contract to make a cross chain call. A callback function in the application contract also needs to be provided to get the call result, otherwise developers will have to call the Get Response function in an application contract to query the service invocation results.

3. Relayer Relayer is a service that listens for the cross-chain request submitted to ICH by a source chain. It is responsible for listening the call service function event, and submitting to the ICH.

4. Service Provider Service provider, connects the HUB to the destination chain. It is a service that listens for the cross-chain request from the ICH, invokes the destination chain, and returns the transaction results to the ICH.

5. Interchain Service The interchain service is developed by the service provider. It could be the smart contract deployed on one blockchain for an application on another blockchain to call across the chain. Support from the service provider is required to turn a service into an interchain service.

6. Interchain Communications Hub As the core component of BSN's interchain service, the ICH is responsible for receiving cross chain requests submitted by the source chain Relayer, verifying the transaction and initiating the cross-chain transaction with the Service Provider of the destination chain. After the transaction is complete, it is also responsible for obtaining the transaction result from the Service Provider, verifying and returning the result to the source chain Relayer.

© 2019-2023 Red Date (Hong Kong) Technology Limited. all right reserved,powered by GitbookFile Modify: 2023-02-16 12:21:44

results matching ""

    No results matching ""

    results matching ""

      No results matching ""