| Algorithms A1. Smart Contract 1: Add Entity |
| Input: entity name, entity type, entity quantity, addr, seller, buyer |
| 1. if addr is valid && addr has adding authentication |
| 2. dairy_farm_details=getFarm(seller) |
| 3. addProduct_Adulteration_Info(entity name, entity type) |
| 4. addProduct_Contamination_Info(entity name, entity type) |
| 5. addProduct_Nutrition_Info(entity name, entity type) |
| 6. x=addProduct(entity name, entity type, entity quantity, dairy_farm_details, buyer) |
| 7. if x==1 |
| 8. Entity Added Successfully |
| 9. Entity ID Generated |
| 10. Initiate the payment procedure to the farmer |
| 11. Execute Product Purchase1 smart contract |
| 12. end |
| 13. else |
| 14. Revert the contract and display an error message |
| 15. end |
| 16. end |
| 17. else |
| 18. Invalid or authorised address |
| 19. go to step 1 and enter a valid address |
| 20. end |