This project implements a blockchain-based solution to enhance food traceability and safety. It validates temperature conditions for food transportation through smart contracts, ensuring food safety and automating payments or penalties based on compliance.
- Smart contract validation of temperature data.
- Automated payment execution or penalties based on contract conditions.
- Transparency and immutability via blockchain.
- Frontend: ReactJS
- Smart Contracts: Solidity
- Blockchain Framework: Hardhat
- Seller deploys a smart contract with initial deposit and temperature range.
- Buyer provides details and deposits agreed amount.
- Buyer imports temperature readings for validation.
- Smart contract:
- Transfers the amount to the seller if temperature conditions are met.
- Applies penalties and refunds if conditions fail.
- Enhanced Traceability: Real-time validation of food conditions.
- Efficiency: Automated and dispute-free transactions.
- Trust: Transparent and tamper-proof validations.
- Clone the repository, under both directory hardhat and web-app, run below command to install node-modules.
- Set up the Hardhat environment for blockchain development. Use below commands under hardhat directory to run the local hardhat server
- Under same hardhat directory, in different command window compile and deploy the samrt contract Contract address will be desplayed, use this in Step 6.
- Copy the ABI code from "D:\Projects\Repos\react-dapp\hardhat\artifacts\contracts\FoodSafety.sol\FoodSafety.json" to "D:\Projects\Repos\react-dapp\web-app\src\ethereum\foodSafetyAbi.js"
- Use the React frontend to interact with the smart contracts. Go inside root directory web-app and run react app.
- Make sure your browser has Metamask installed. Connect metamask to local hardhat network and open react frontend.
- Integration with IoT sensors for real-time temperature updates.
- Expanding to other food safety conditions like humidity or contamination detection.