Skip to main content
. 2022 Sep 5;11(17):2716. doi: 10.3390/foods11172716
Algorithms A4. Smart Contract 4: Shipping
Input: product id, order number, product quantity, addr, source, destination[]
1. if addr is valid && addr has authentication
2. if source ==”dairy farm”
3. dairy_farm_details=getFarm(source)
4. x[]=addShipmentInfo(dairy_farm_details, entity id, order number, product quantity, addr, destination.name)
5. if x.order_details = destination.order_details
6. Original Products Received
7. Execute Add Entity smart contract
8. Ownership of the product transferred
9. end
9. else
10. Products are missing or incorrect
11. go to step 4
12. end
13. end
14. else
15. x[]=addShipmentInfo(source, product id, order number, product quantity, addr, destination.name)
16. if x.order_details = destination.order_details
17. Original Products Received
18. Execute Add Product smart contract
19. Ownership of the product transferred
20. end
21. else
22. Products are missing or incorrect
23. go to step 15
24. end
25. end
26. else
27. Invalid or authorised address
28. go to step 1 and enter a valid address
29. end