Skip to main content
. 2022 Apr 27;11(9):1269. doi: 10.3390/foods11091269
Algorithm A3: Supervise cross-chain smart contract A(SCSC-A)
Input H(S); Ds; S; SCSC-B; V; IR;DATA
1: func Certification(H(S))// Verify Permissions
{
For t in range (m)
If HS permissions comply with
Return Accept cross-chain requests
     Return false
}
2: func Pretreatment(D)// Cross-chain request preprocessing
{
If  Data request preprocessing:
   Request preprocessing based on concurrency mechanism based on K-means algorithm and Bloom filter
  Return The location of the parachain where the requested data resides
}
3: func Integration(Data)// Form a supervised cross-chain data Data
{
For t in range (m)
     If Cross-chain supervision data processing:
      Extract each parachain data to form Data
      Generate a random number N, take the hash H(N), use H(N) to encrypt the Data, and get Dn
      Get user pkp, encrypt H(N), Dn, get DATA
      Return true
Return false
}
4: func Slice(DATA)// DATA slices are stored in the relay chain
{
For t in range (m)
   If   Relay chain data processing:
       Set the hash lock T
       Data slices are stored to relay chain nodes
       Each node of the relay chain plays a game, sorts the DATA, and transmits it to SCSC-B
       If T ends
        Return The DATA fragments of each node in the relay chain are automatically encrypted, and H(D) is sent to SCSC-A
        If H(D)>=51%
        Return true
       Return false
     Return false
}
5: func Storage(IR)// Interactive record storage
{
  If  IR deal with:
   IR: {Initiate the request related person information, request information, data transmission process information}
Stored in the blockchain main chain
   Return ture
else
   Return false
}