Skip to content

NTARI-RAND/Agrinet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

466 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Agrinet - Decentralized Agricultural Marketplace 🌱

Overview

Agrinet is a decentralized agricultural trading and service platform built to enhance transparency, trust, and efficiency in agricultural markets. It connects producers, consumers, and service providers while ensuring secure transactions, reputation-based ratings, and localized economic sustainability.

Features

Marketplace System πŸͺ

  • Direct Market Access: Producers list goods, services, and contracts.
  • Agrotourism Integration: Farmers can offer farm tours, events, and educational workshops.
  • Service Marketplace: Users can provide or request agricultural services (e.g., logistics, maintenance).

Secure Transactions πŸ”’

  • LBTAS (Leveson-Based Trade Assessment Scale): Ensures a trust-based rating system.
  • Dialog Recorder: Logs key transaction details for security and auditing.
  • Machine Scrub Module: Filters and verifies transaction data.

Key & Authentication System πŸ”‘

  • McEliese Key Generation: Ensures secure user identification.
  • Key Transmission Limits: Auto-retirement after 3, 6, 9, 12, or 365 transmissions.
  • Multi-Factor Verification: Email/phone validation with retry & lockout security.

PING System πŸ“‘

  • Production Progress Reporting: Allows contract buyers to track order status.
  • Real-Time Notifications: Updates on market trends, contract changes, and service requests.

SMS Access πŸ“±

  • Query market and weather data through SMS using simple text commands.
  • Supports local languages and queues messages offline with delivery confirmation.

Financial Transactions 🏦

  • Deposit & Donations to NTARI Account: Supports decentralized funding.
  • Automated Payouts: Ensures secure fund disbursements upon transaction completion.

Decentralized Data Management 🌍

  • User Profiles & Logs: Maintains key issuance logs parallel to user profiles.
  • Geo-Filtering & Search Optimization: Enables market visibility based on location.

Square Foot Gardening Calculator 🌿

  • Plant spacing recommendations for common crops.
  • Compatibility matrix to plan companion planting.
  • Growth projections and seasonal schedules with visual grid layouts.

Technology Stack

  • Frontend: React with Next.js (responsive site structure)
  • Backend: Node.js (API handling)
  • Database: Amazon DynamoDB (for storing users, contracts, and transactions)
  • Security: OAuth 2.0 / McEliese Key Cryptography
  • Real-Time Processing: Webhooks & PING System

Installation & Setup

  1. Clone the repository
git clone https://github.com/YOUR_USERNAME/Fruitful.git
cd Agrinet
  1. Setup the backend
cd backend
npm install
node server.js
  1. Deploy the frontend
cd frontend
npm install
npm run dev

For local development, set the NEXT_PUBLIC_BACKEND_URL environment variable to your backend's URL before running the frontend, for example:

NEXT_PUBLIC_BACKEND_URL=http://localhost:5000 npm run dev

Only environment variables prefixed with NEXT_PUBLIC_ are exposed to the browser, so this prefix is required. Alternatively, configure a proxy so that requests to /api are forwarded to the backend.

Environment Variables

The backend now uses Amazon DynamoDB. Set the following variables in your environment or .env file:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_REGION
  • DYNAMODB_ENDPOINT (optional, for DynamoDB Local e.g. http://localhost:8000)
  • TWILIO_SID
  • TWILIO_AUTH_TOKEN
  • TWILIO_FROM_NUMBER
  • TWILIO_STATUS_CALLBACK_URL (optional for delivery confirmation)

Square Foot Gardening Usage

The backend includes a utility for planning square foot gardens.

const { planSeason } = require('./backend/utils/squareFootGardening');

const layout = [
  ['tomato', 'basil'],
  ['lettuce', null],
];

const plan = planSeason(layout, '2024-03-01', 'spring');
console.log(plan.grid);
console.log(plan.schedule);

The planner validates companion planting, projects growth timelines, and renders an ASCII grid of the garden.

API Endpoints

Additional chat interface endpoints (e.g., /conversations, /messages/:id, /stream/:id) and their expected JSON structures are documented inline in the frontend components Sidebar.jsx and ChatWindow.jsx.

User Registration

POST /userRegistration

{
  "name": "John Doe",
  "email": "johndoe@example.com",
  "location": "Kentucky, USA",
  "role": "producer"
}

Create Contract

POST /createContract

{
  "producerId": "user123",
  "type": "Tomato",
  "variety": "Roma",
  "category": "food",
  "amountNeeded": "500 lbs",
  "dateNeeded": "2025-03-15",
  "pingRate": "weekly"
}

Submit LBTAS Rating

POST /submitRating

{
  "transactionId": "tx987",
  "rating": 4
}

Contributing

We welcome contributions from the community! πŸš€

  1. Fork the repo
  2. Create a feature branch
  3. Submit a pull request

Checking for hardcoded URLs

Run the following script to detect any hardcoded localhost references before committing code:

./scripts/list-hardcoded-urls.sh

The script lists offending lines and exits with a nonzero status if any are found. Existing references known to be safe are tracked in scripts/hardcoded-url-allowlist.txt.

License

AGPL, GNU-3οΏ½

Contact & Support