Skip to main content
. 2022 Apr 27;11(9):1269. doi: 10.3390/foods11091269
Algorithm A4: Supervise cross-chain smart contract B(SCSC-B)
InputData; N; SCSC-A; skp; T; DATA
1: func Decrypt(DATA)// Decrypt DATA with skp
{
For t in range (m)
  IfDATA processing:
     Get user private key skp
    Decrypt DATA, get Dn, H(N)
}
2: func Get(N)// Get N, pass S
{
For t in range (m)
    If   S processing:
        Use the same H(N) for data encryption
If      data exchange:
Transfer(SCSC-B)
Return SCSC-AS; NSCSC-B// Exchange N and S to obtain
Return   false
}
3: func Get(Data)// Decrypt to get Data
{
For t in range (m)
If  Dn processing:
   Decrypt Dn to get Data
   Hash Ds to verify whether it has been tampered with
   Return ture
Return false
}
4: func Transport(Data)
{
For t in range (m)
IfData verification without tampering
   Return Regulatory Authority and ture
Return false
}
5: func Self-defense(T, SCSC-A)// Anti-attack design
{
For t in range (m)
If   Step 4 Back ture
    Send (V)SCSC-A
If Attack handling:
   Received the attack information of SCSC-A
   ReturnData is automatically encrypted
}