| Literature DB >> 33834098 |
Tahmid Hasan Pranto1, Akm Bahalul Haque1, Abdulla All Noman1, Atik Mahmud1.
Abstract
The agricultural sector is still lagging behind from all other sectors in terms of using the newest technologies. For production, the latest machines are being introduced and adopted. However, pre-harvest and post-harvest processing are still done by following traditional methodologies while tracing, storing, and publishing agricultural data. As a result, farmers are not getting deserved payment, consumers are not getting enough information before buying their product, and intermediate person/processors are increasing retail prices. Using blockchain, smart contracts, and IoT devices, we can fully automate the process while establishing absolute trust among all these parties. In this research, we explored the different aspects of using blockchain and smart contracts with the integration of IoT devices in pre-harvesting and post-harvesting segments of agriculture. We proposed a system that uses blockchain as the backbone while IoT devices collect data from the field level, and smart contracts regulate the interaction among all these contributing parties. The system implementation has been shown in diagrams and with proper explanations. Gas costs of every operation have also been attached for a better understanding of the costs. We also analyzed the system in terms of challenges and advantages. The overall impact of this research was to show the immutable, available, transparent, and robustly secure characteristics of blockchain in the field of agriculture while also emphasizing the vigorous mechanism that the collaboration of blockchain, smart contract, and IoT presents.Entities:
Keywords: Agricultural process; Agriculture; Automation; Blockchain; IoT; Secure; Smart contract; Supply chain; Traceability; Transparent
Year: 2021 PMID: 33834098 PMCID: PMC8022535 DOI: 10.7717/peerj-cs.407
Source DB: PubMed Journal: PeerJ Comput Sci ISSN: 2376-5992
Figure 1Structure of blockchain.
Figure 2Transaction in blockchain.
Figure 3Steps of building a typical smart contract.
Figure 4Overall system overview.
Figure 5System interaction with blockchain.
Figure 6Smart contracts used for storage in the system.
Figure 7Smart contracts used during distribution.
Figure 8IoT enabled environment interaction with the MQTT server.
Figure 11Triggering a violation through self check of temperature condition (A) and example of initiating a distribution (B).
Figure 9Timestamping distribution data to blockchain.
Product trace initiation algorithm.
| 1 Only producer account can start the distribution process. |
| 2 |
| 3 Set the product CurrentTrace enumerator to producer ; |
| 4 Set initiation date to the current timestamp of the block ; |
| 5 Set name, id, price, quantity to the associated variables ; |
| 6 emit DistributionInitiate method with producer address and a message describing the product distribution starting ; |
| 7 |
| 8 Do Nothing ; |
| 9 |
Figure 10Add seed to the system (A) and temperature self-check in the storage (B).
System comparison with existing methods.
| Outcome | Proposed System | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Provide system implementation | ✗ | ✓ | ✗ | ✗ | ✓ | ✓ | ✗ | ✗ | ✓ | ✓ | ✓ |
| Traceability | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Control over the system (Smart Contract) | ✓ | ✓ | ✓ | ✗ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Enable informed purchase decision ability of customers | ✓ | ✓ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✓ | ✗ | ✓ |
| Real-time data | ✓ | ✗ | ✓ | ✓ | ✓ | ✗ | ✓ | ✗ | ✗ | ✗ | ✓ |
| Reduce fraud | ✓ | ✗ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✓ | ✓ |
| Remove third party | ✓ | ✓ | ✓ | ✓ | ✗ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Fair pricing | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✓ | ✗ | ✗ | ✗ | ✓ |
Gas costs of different operations.
| Task | Associated actor | Transaction cost | Execution cost |
|---|---|---|---|
| addSeed() | Storage | 168,402 | 144,314 |
| temperatureSelfCheck() | Storage | 50,681 | 29,217 |
| hummiditySelfCheck() | Storage | 50,812 | 29,348 |
| lightExpoSelfCheck() | Storage | 35,503 | 14,039 |
| violationTrigger() | Storage | 48,625 | 26,969 |
| initiateDistribution() | Producer | 132,122 | 108,610 |
| startDistribution() | Distributor | 106,442 | 84,786 |
| startWholesale() | Wholesaler | 91,530 | 69,874 |
| retailSell() | Retailer | 91,464 | 69,808 |
Self check algorithms.
| 1 |
| 2 |
| 3 call violationTrigger() method with violation type and category ; |
| 4 |
| 5 |
| 6 call violationTrigger() method with violation type and category ; |
| 7 |
| 8 |
| 9 call violationTrigger() method with violation type and category ; |
| 10 |
| 11 |
| 12 |
| 13 Do Nothing ; |
| 14 |
Violation trigger algorithm.
| 1 |
| 2 |
| 3 |
| 4 set the temperature condition Enum to Over ; |
| 5 set the violation type Enum to temperature ; |
| 6 |
| 7 |
| 8 set the temperature condition Enum to Under ; |
| 9 set the violation type Enum to Temperature ; |
| 10 |
| 11 |
| 12 set the temperature condition Enum to Optimum; |
| 13 set the violation type Enum to Non; |
| 14 |
| 15 |
| 16 Do Nothing; |
| 17 |
| 18 |
| 19 follow statement 3-18 with associated values, parameters and conditions; |
| 20 |
| 21 follow statement 3-18 with associated values, parameters and conditions; |
| 22 |
| 23 Do Nothing; |
| 24 |
| 25 Do Nothing; |