Skip to main content
. 2023 Feb 10;23(4):2000. doi: 10.3390/s23042000
Algorithm 1 Cross-chain data circulation
  • 1:

    Input:

  • 2:

       CHAINS: the set of chains in the cross-chain system

  • 3:

       AG: the set of auto agents

  • 4:

       AGRobot: the set of AGRobots

  • 5:

       CrossCon: the set of cross-chain contracts

  • 6:

    Output:

  • 7:

       True or False

  • 8:

    ————————————————————————————————————————

  • 9:

    1. Propose (ui from ACi to ACj):

  • 10:

       FromChainIDChainIDi

  • 11:

       ToChainIDChainIDj

  • 12:

       txiCrossConi(FromChainID,ToChainID,Options)

  • 13:

       Broadcast txi in ACi

  • 14:

       invoke (Cross-chain broadcast)

  • 15:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  • 16:

    2. Cross-chain broadcast:

  • 17:

       AGi receives txi

  • 18:

       if FromChainIDToChainID then

  • 19:

          txsAGRobot(txi)

  • 20:

          Broadcast txs in SC

  • 21:

          invoke (Response)

  • 22:

       else

  • 23:

          Broadcast txi in ACi

  • 24:

          return false

  • 25:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - – - - - - - - - - - - - - - - - - - - -

  • 26:

    3. Response (AGk receives txs):

  • 27:

       if ToChainID=ChainIDk then

  • 28:

          txkAGRobot(txs)

  • 29:

          Broadcast txk in ACk

  • 30:

          CrossConk(FromChainID,ToChainID,Options)

  • 31:

          Return True

  • 32:

       else

  • 33:

          Broadcast txs in SC

  • 34:

          Return False