
AgriShield
Securing Crops, Empowering Farmers, Onchain.
Demo
About
The problem it solves **The Problem AgriShield Solves** Agriculture faces significant challenges, including unpredictable weather patterns, lack of access to affordable and timely crop insurance, fragmented financial services, and limited transparency in carbon credit management. Traditional insurance processes are often slow, manual, and prone to delays in payouts, leaving farmers vulnerable to losses from droughts, floods, and other climate risks. Additionally, farmers struggle to access credit due to a lack of verifiable digital identity and collateral, and sustainable farming efforts are hindered by inefficient carbon credit tracking and trading. AgriShield addresses these issues by leveraging blockchain technology and decentralized oracles to automate insurance payouts based on real-time weather data and provide transparent carbon credit tokenization. This creates a more secure, efficient, and accessible ecosystem for farmers and stakeholders. **How AgriShield Makes Existing Tasks Easier and Safer** AgriShield empowers farmers and agricultural stakeholders by providing a suite of blockchain-powered tools that simplify and secure critical farming-related financial tasks: - Automated Weather-Triggered Insurance: Farmers can purchase parametric insurance policies that automatically trigger payouts based on real-time weather data, eliminating paperwork and delays. - Carbon Credit Tokenization: Track, mint, and trade carbon credits earned through sustainable farming practices, promoting environmental responsibility and additional income streams. - Real-Time Dashboard: Monitor insurance status, weather conditions, loan details, and carbon credit balances in one intuitive interface. By automating complex processes and leveraging blockchain’s transparency and security, AgriShield makes agricultural finance more accessible, efficient, and trustworthy, helping farmers mitigate risks and improve livelihoods
How it's made
Challenges we ran into 1. Frontend Integration with Wagmi & Viem Faced compatibility issues with wagmi hooks when connecting wallets. Solved this by configuring wagmi with viem instead of ethers (since wagmi v1+ uses viem by default). Debugged connector duplications and ensured the configuration was SSR-safe for deployment. 2. Wallet Connection Bugs Sometimes useConnect and useAccount hooks did not update state correctly. Fixed this by checking the config order, filtering duplicate connectors, and adding a fallback connector. 3. Chainlink Request Gas Estimation Failures Major blocker: Gas estimation failed when sending requests to the decentralized oracle network. Root cause: The gas limit was set too high (around 8 million). Solution: Lowered the gas limit to around 3 million and the requests started working. 4. Chainlink Custom Automation Tried to use Chainlink’s custom logic automation on the Sepolia testnet. The custom automation job did not respond, probably due to network congestion on Sepolia. Plan to test this again on another testnet or a Mainnet fork later. 5. Solidity Source Code Challenges Needed to initialize dynamic strings or bytes in a constructor. Initially unclear how to do this, because abi.encodePacked() must be used correctly. Solved it by properly encoding the input with abi.encodePacked inside the constructor. **Lessons Learned** Always double-check your gas limits — setting them too high can break estimation just like setting them too low. wagmi and viem need careful configuration, especially if migrating from ethers. Busy testnets like Sepolia can delay transactions because of network congestion, not just contract issues. Solidity low-level encoding can solve tricky initialization problems, but always test it thoroughly