LIVE WEBSITE : https://agri-verify-lake.vercel.app
The demo video for the given website explaining all the features and the functionalities is :
DEMO VIDEO
This is a decentralized website that helps farmers to easily certify their produced crops and generate QR codes that consumers can scan for instant verification. A NFT is minted for every generated QR-code to ensure authenticity. For every process as the farmers add their name to adding their crops, notifications are sent containing the important info using the Push Protocol. In short, this project implements a FarmManagement smart contract for managing farmers and crops as NFTs.
Here the project initially contains two parts - Hardhat and Agriproject
- Hardhat requires ethers version atleast 6.0 version or higher
- PushProtocol requires ethers version 5.7.2
So we have put two folders for the same reason to avoid version mismatch
- FarmManagement.sol: Main smart contract
- FarmManagement.js (Ignition): Deployment module
- FarmManagement.js (Test): Contract tests
- hardhat.config.js: Hardhat configuration
On running the
npx hardhat test
addFarmer(string memory _name)
: Add a new farmeraddCrop(uint _farmerId, string memory _cropName, uint _quantity, string memory _ipfsHash)
: Add a crop and mint NFTgetCrop(uint _farmerId, uint _cropId)
: Get crop detailsownerOfCropNFT(uint _farmerId, uint _cropId)
: Check crop NFT owner- We have used
@openzeppelin/contracts
(@4.9.3) to import necessary contracts to integrate NFT into our project
Each crop is represented as an ERC721 NFT, allowing for unique identification and potential trading.
IPFS hashes can be stored with each crop for off-chain data storage.
- The application uses Web3.js to interact with the Ethereum blockchain.
- A smart contract is deployed at the address:
0xEe4F162B6b261Bc6260D70b2785431B3e44136B1
on the Sepolia testnet through HardHat.
- Utilizes the Push Protocol for sending notifications.
- Channel address (in CAIP format):
eip155:11155111:0x210406844A1B98EF2729398c4BF9700238fF0a76
- Notifications are sent when:
- A new farmer is added
- A new crop is added
- Uses Pinata for pinning metadata to IPFS
- Generates and uploads metadata for each crop entry, including QR code data
-
Farmer Management
- Add new farmers to the blockchain
- View farmer details
-
Crop Management
- Add new crops for registered farmers
- Generate unique QR code for a dynamic route which redirects to authentication page for the crops added
- Mint NFTs for crop entries
-
Dashboard
- View all registered farmers
- Search functionality to find specific farmers
- Display crop details for each farmer
- Radio button to filter out all farmers created by you
- Complete transperency of blockchain
-
Blockchain Integration
- Interaction with a smart contract deployed on the Sepolia testnet
- Use Web3.js for blockchain interactions
-
Push Protocol Integration
- Send notifications for new farmer registrations and crop additions
- Subscribe users to the notification channel
-
QR Code Generation
- Create unique QR codes for dynamic route created with every crop added
- QR codes link to a verification page with crop details
addFarmer()
: Registers a new farmer on the blockchainfetchFarmerDetails()
: Retrieves farmer information from the blockchain
addCrop()
: Adds a new crop for a farmer and mints an NFTgenerateNFTMetadata()
: Creates metadata for the crop NFTgenerateQRCode()
: Generates a QR code for each crop entry
sendNotificationForFarmerAdded()
: Sends a notification when a new farmer is registeredsendNotificationForCropAdded()
: Sends a notification when a new crop is added
pinJSONToIPFS()
: Uploads metadata to IPFS using Pinata