| Algorithms A8. Smart Contract 8: Add Stakeholder |
| Input: name, type, location, details[], addr |
| 1. if addr is valid && addr has adding authentication |
| 2. if type ==internal |
| 3. if name==Processing Centre |
| 4. ProcessingCentre_ID=addProcessingCentre(name, location, details[]) |
| 5. end |
| 6. if name==Collection Centre |
| 7.CollectionCentre_ID addColdStorage(name, location, details[]) |
| 8. end |
| 9. if name==Cold Storage |
| 10. ColdStorage_ID=addColdStorage(name, location, details[]) |
| 11. end |
| 12. else |
| 13. addFarm(name, location, details[]) |
| 14. end |
| 15. end |
| 15. if type==external |
| 16. if name==Distributor |
| 17. Distributor_ID=addDistributor(name, location, details[], true) |
| 18. end |
| 19. if name==Retailer |
| 20. Retailer_ID=addRetailer(name, location, details[], true) |
| 21. end |
| 22. end |
| 23. else |
| 24. Invalid Stakeholder type |
| 25. go to step 2 |
| 26. end |
| 27. else |
| 28. Invalid or authorised address |
| 29. go to step 1 and enter a valid address |
| 30. end |