Skip to main content
. 2020 Sep 16;20(18):5297. doi: 10.3390/s20185297
Algorithm 5 Algorithm for traceability query.
Input: Query object: obj
Output: traceability information chain: C0 and C1
  • 1:

    while All obj have been queried on the privacy-chain do

  • 2:

     (Diffp(TDn), BHn) ← Find the obj on the privacy-chain, BH is the height of the block.

  • 3:

     Add (Diffp(TDn), BHn) to the C1.

  • 4:

    end while

  • 5:

    Then get a complete C1 and Sort it by timestamp.

  • 6:

    C1 = (Diffp(TD0),BH0)←(Diffp(TD1),BH1)←...← (Diffp(TDn), BHn).

  • 7:

    while All obj have been queried in C1 do

  • 8:

     According to the (Diffp(TDn),BHn), Query data from its management node.

  • 9:

     The management node query TD from its self-chain based on BHn and its hash(TD).

  • 10:

     Add TDn to the C0.

  • 11:

    end while

  • 12:

    Then get a complete C0.

  • 13:

    C0 = TD0←TD1←...←TDn.