Skip to main content
. 2022 Apr 28;22(9):3388. doi: 10.3390/s22093388
Algorithm 3 Upload Traceability Information
Input: EnterpiseType, ID, Merkle tree root
Output: An event declaring the traceability information has been uploaded.
Data:
EnterpiseType is the type of agricultural supply chain enterprise
ID is the ID of the agricultural product
Merkle tree root is the root node of the Merkle tree constructed by traceability information
1. if FunctionCaller is not Products[ID].enterpriseAddrthen
2.   Display an error notification “You do not have permission for this product!”
3. else if EnterpiseType don’t match Products[ID].Statesthen
4.   Display an error notification “Status match error!”
5. else if EnterpriseType is ProductionEnterprise then
6.   Products[ID]. ProductionHash = Merkle tree root
7. else if EnterpriseType is ProcessingEnterprise then
8.   Products[ID]. ProcessingHash = Merkle tree root
9. else if EnterpriseType is LogisticsEnterprise then
10.   Products[ID]. LogisticsHash = Merkle tree root
11. else ifEnterpriseType is SalesEnterprise then
12.   Products[ID]. SalesHash = Merkle tree root
13. end