Skip to content

Kaisman9746/Subsidy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌾 AgriSubsidy: Smart Farming Support System

A decentralized agricultural subsidy platform powered by the Cardano blockchain. AgriSubsidy enables governments to distribute funds directly to farmers, verify compliance conditions (rain, crop, and community validation), and ensure secure, transparent, and fraud-resistant subsidy claims.

All subsidy data is stored on-chain through Plutus V2 smart contracts, making the system fully verifiable and trustless.


🌐 Live Demo

🔗 https://agrisubsidyapp.vercel.app


✨ Features

  • 👨‍🌾 Register Farmers — Farmers’ wallets are verified using on-chain PKHs
  • 💸 Lock Subsidies — Government funds securely deposited to smart contract
  • 🌧️ Conditional Verification — Subsidy release depends on rainfall, crop health, and community validation flags
  • 🔓 Claim Subsidy — Farmers can withdraw ADA once all checks are marked “OK”
  • 🚨 Report Fraud — Government can revoke funds for unverified claims
  • 🧾 Fully On-Chain — All datums and redeemers are handled within the Plutus V2 contract
  • Lucid SDK — Browser-based Cardano interaction with Blockfrost API
  • 🔍 Transparent & Auditable — Every transaction verifiable via Cardano explorer

🛠️ Tech Stack

  • Cardano Preprod Testnet
  • Plutus V2 Smart Contracts
  • Lucid Cardano SDK
  • Blockfrost API
  • Lace Wallet (CIP-30)
  • HTML + JavaScript Frontend

📋 Requirements

  • 🦊 Lace Wallet browser extension
  • 🪙 Preprod ADA from Cardano Faucet
  • 🌐 Chromium-based browser
  • 📜 Deployed AgriSubsidy smart contract

🚀 How to Use

  1. Connect your Lace Wallet
  2. Government locks subsidy amount for a farmer
  3. Farmer verifies crop, rainfall, and community compliance
  4. Claim subsidy once all verification flags are true
  5. Report Fraud if subsidy misuse is detected

All transactions are handled through the Lucid SDK and confirmed on the Cardano testnet blockchain.


🧠 Smart Contract Overview

  • Network: Cardano Preprod Testnet

  • Script Type: Plutus V2

  • Datum Schema:

    {
      sdFarmerPKH: Bytes,
      sdGovPKH: Bytes,
      sdRequiredAmount: Integer,
      sdRainOK: Boolean,
      sdCropOK: Boolean,
      sdCommunityOK: Boolean
    }
  • Redeemers:

    Action Redeemer Description
    ClaimSubsidy Constr(0) Farmer claims approved subsidy
    ReportFraud Constr(1) Government retrieves funds for fraud
    UpdateData Constr(2) Update verification flags
  • State Model: Inline Datum (UTXO-based)

  • Script Address: Generated dynamically after wallet connection


💡 Core Actions

Action Description Access Redeemer Index
LockSubsidy Government deposits ADA with conditions Government N/A
ClaimSubsidy Farmer withdraws approved subsidy Farmer Constr(0)
ReportFraud Revokes invalid subsidy and returns funds Government Constr(1)
UpdateData Updates compliance flags (rain, crop, community) Both Constr(2)

🔗 Resources


🧪 Testing Checklist

✅ Wallet connection initializes Lucid successfully ✅ Government can lock subsidy with correct datum ✅ Farmer can claim only when all flags = true ✅ Fraud reports recover locked funds ✅ Transactions visible via Cardano Preprod Explorer


📜 License

MIT License © 2026 AgriSubsidy Developers


👨‍💻 Author

Kaisman Built with Lucid + Plutus V2 on Cardano Preprod Testnet


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •