AquaRunnel is an innovative web platform that merges blockchain technology with real-time weather data to promote and reward sustainable agricultural practices. By leveraging a Soroban smart contract on the Stellar testnet, AquaRunnel enables farmers to make informed decisions based on localized weather forecasts, earn AquaTokens for correctly timed farming activities, and support fellow farmers through token transfers.
| Network | Stellar Testnet |
| Contract Address | CDMPDO7SKG3JUZCU4DA5IZDLID5GT4HJ5JPETNLEXVWM7IHU2ABRK3WJ |
| Deploy Transaction | ddb0035326d4419b793250ded648a3975e58466acbe13e92774f689e442f4797 |
- Contract Explorer: https://stellar.expert/explorer/testnet/contract/CDMPDO7SKG3JUZCU4DA5IZDLID5GT4HJ5JPETNLEXVWM7IHU2ABRK3WJ
- Transaction Explorer: https://stellar.expert/explorer/testnet/tx/ddb0035326d4419b793250ded648a3975e58466acbe13e92774f689e442f4797
-
Real-Time Agricultural Recommendations:
- Farmers select their city and crop type to receive tailored guidance on optimal farming actions.
- Recommendations incorporate current and forecasted weather data (e.g., βWheat is ideal in Konya this week, but water conservation remains crucialβ).
-
Weather-Based Action Tracking:
- When a farmer executes a recommended action at the right time (e.g., harvesting during dry conditions), AquaRunnel detects and rewards the activity.
- Actions include fertilization, irrigation, planting, and harvesting, each with specific eligibility criteria based on weather patterns.
-
AquaToken Economy:
- Farmers earn 10 AquaTokens for each correctly timed action, incentivizing eco-friendly practices (e.g., fertilize right before expected rainfall).
- AquaTokens can be transferred to other farmers as community support or saved for future benefits within the platformβs ecosystem.
-
Farmer Support Panel:
- A dedicated UI component allows users to send AquaTokens directly to other farmersβ wallets, fostering collaboration and mutual assistance.
- Farmers in need of resources or guidance can receive tokens from experienced peers.
-
Freighter Wallet Integration:
- Seamless connection with the Freighter browser extension for Stellar wallets enables secure transactions on the testnet.
- Users connect their Freighter wallet, and backend operations handle minting and transfers via Soroban CLI.
- Smart Contract ID:
CDMPDO7SKG3JUZCU4DA5IZDLID5GT4HJ5JPETNLEXVWM7IHU2ABRK3WJ
-
Frontend & Backend Architecture:
- Frontend: Built with Next.js, Tailwind CSS, and Shadcn UI for a responsive and farmer-friendly interface.
- Backend: Node.js (Express) serves API endpoints that internally invoke Soroban CLI commands to mint and transfer tokens on Stellar testnet.
- Decoupled design ensures maintainability and ease of deployment.
βββ frontend # Next.js application (UI layer)
β βββ components # Reusable React components (WeatherPanel, RewardCenter, etc.)
β βββ lib # Business logic, API wrappers, config (weather-service, wallet)
β βββ pages # Routes: home page, weather page, API routes under /api
β βββ public # Static assets (icons, images)
βββ backend # Express.js server (API layer)
βββ index.js # Main entry point, sets up routes and middleware
βββ routes # API route handlers: mint-reward, transfer, balance
βββ soroban # soroban.js: functions that invoke Soroban CLI to mint/transfer/balance
βββ .env # Environment variables: contract ID, secrets, network config
βββ stellar-contract # Rust-based Soroban token contract
βββ src/contract.rs # Token contract implementation: initialize, mint, transfer, balance
βββ Cargo.toml # Build configuration for the contract
βββ test/ # Rust unit tests for contract functionality
- Node.js & npm (v14+)
- Rust & Cargo (for Soroban CLI)
- Soroban CLI (v20.0.0-rc.3 or newer)
- Freighter Browser Extension (for Stellar wallets)
git clone https://github.com/suarksoft/rustdevelop.git
git checkout main```
NEXT_PUBLIC_OPENWEATHER_API_KEY=a94...
NEXT_PUBLIC_USE_MOCK=false
- NEXT_PUBLIC_OPENWEATHER_API_KEY: Obtain from OpenWeather.
- NEXT_PUBLIC_USE_MOCK: Set to
trueto bypass real API calls and use predefined mock data.
ADMIN_SECRET=SBBLSBDPAAWFMT5TQMGROUMEDAZ77X5WXVUWWOZWKMFQHMRC3NNEE3QS
CONTRACT_ID=CBUFRFE3BHY527RPOCTUJMIJKADW7CSJ4DSH5CHQRLRFYEE3XFRDZ6DL
SOROBAN_RPC_URL=https://soroban-testnet.stellar.org:443 SOROBAN_NETWORK_PASSPHRASE="Test SDF Network ; September 2015" ADMIN_ALIAS=admin CONTRACT_ALIAS=token STELLAR_NETWORK=testnet
- ADMIN_SECRET: The secret key of the admin/Stellar account that has permission to mint tokens.
- CONTRACT_ID: The unique ID of the Soroban token contract deployed on testnet.
- SOROBAN_RPC_URL and SOROBAN_NETWORK_PASSPHRASE: Testnet configuration for Soroban CLI.
- ADMIN_ALIAS / CONTRACT_ALIAS: Used by Soroban CLI to identify key aliases and contract alias (mapped in
~/.config/stellar/identity).
cd frontend
npm installcd backend
npm installcd frontend
npm run dev
# Serves at http://localhost:3000cd backend
node index.js
# Serves API at http://localhost:4000Note: Contract is already deployed. Use the following commands to set up your admin key locally and verify deployment:
# 1. Install Soroban CLI
cargo install --locked --version 20.0.0-rc.3 soroban-cli
# 2. Create a new key for admin if not already in your local identity
soroban keys generate --name admin --secret-key SBBLSBDPAAW... (admin secret)
# 3. Verify contract deployment on testnet
soroban contract invoke \
--id $CONTRACT_ID \
--source admin \
--network-passphrase "Test SDF Network ; September 2015" \
--rpc-url https://soroban-testnet.stellar.org:443 \
-- balance --id [WALLET_PUBLIC_KEY] # Should return initial balance (0 or minted value)- Connect Wallet: Click βConnect Walletβ and approve via Freighter extension.
- Select City & Crop: Choose your region and crop; recommendations display instantly.
- Perform Action: Follow suggested timing (e.g., fertilize before predicted rain). Click βI Did Itβ to record your action.
- Earn Tokens: If action meets criteria, the backend mints AquaTokens to your wallet and balance updates.
- View & Send Tokens: Check your token balance in the TokenPanel. Use the βSupport Farmerβ panel to transfer tokens to peers.
- Track History: View past farming actions and success rates in the RewardHistory section.
All endpoints are under http://localhost:4000/api:
-
POST /mint-reward
- Description: Mint AquaTokens to a userβs wallet when they complete a valid action.
- Request Body:
{ "wallet": "<PUBLIC_KEY>", "amount": <integer> } - Response:
{ "success": true, "tx": "<TRANSACTION_DETAILS>" }or{ "success": false, "error": "<ERROR_MESSAGE>" }
-
POST /transfer
- Description: Transfer AquaTokens from one user to another to support farmers.
- Request Body:
{ "fromWallet": "<SENDER_PUBLIC_KEY>", "toWallet": "<RECIPIENT_PUBLIC_KEY>", "amount": <integer> } - Response:
{ "success": true, "tx": "<TRANSACTION_DETAILS>" }or{ "success": false, "error": "<ERROR_MESSAGE>" }
-
GET /balance/:wallet
- Description: Retrieve the current AquaToken balance of the specified wallet.
- URL Params:
wallet=<PUBLIC_KEY> - Response:
{ "success": true, "balance": <number> }or{ "success": false, "error": "<ERROR_MESSAGE>" }
-
initialize(admin: Address, decimal: u32, name: String, symbol: String)
- Sets admin address and token metadata (decimal places, name, symbol).
-
mint(to: Address, amount: i128)
- Mints
amountof tokens toto. Only callable by admin.
- Mints
-
transfer(from: Address, to: Address, amount: i128)
- Transfers
amountfromfromtoto.frommust authorize.
- Transfers
-
balance(id: Address) -> i128
- Returns the token balance of the given address.
-
Author: Ahmet BuΔra Kurnaz
-
Tech Stack:
- Frontend: Next.js, React, Tailwind CSS, Shadcn UI, Lucide icons
- Backend: Node.js, Express.js, Child Process (exec) to interact with Soroban CLI
- Smart Contract: Rust, Soroban SDK
- Blockchain: Stellar Testnet, Soroban smart contracts, Freighter for wallet integration
- Fully Functional MVP: End-to-end integration demonstrates token minting and transfers on Stellar testnet.
- User-Centric Design: Intuitive, mobile-responsive UI tailored for farmers.
- Sustainability Focus: Aligns with green agriculture initiatives by incentivizing correct farming practices.
- Community Support: Farmer Support Panel enables peer-to-peer token transfers, enhancing solidarity.
- External Data Integration: Incorporate satellite imagery and soil-moisture sensors for more precise recommendations.
- Mobile App Development: Build native or hybrid mobile app to increase accessibility in rural areas.
- Token Staking & Pools: Introduce staking pools and yield farming features to reward long-term token holders.
- Multi-Language Support: Add localization for Turkish, English, and other major languages.
- Governance & DAO: Enable token holders to vote on platform updates and new features.