Decentralized water quality monitoring on Solana. Store sensor readings on-chain with autonomous agent verification.
3SPZr1HBntkGvrTUCZnivEpCm4PsShHZ8nbxYeLUotwLDevnetView on Solana Explorer: 3SPZr1HB...
Represents a physical water monitoring sensor. Stores authority (owner), agent (authorized submitter), name, and PDA bump.
Stores the latest sensor reading with timestamp, pH, turbidity, conductivity, temperature, water level, and sequence number.
Initialize a new monitoring node. Creates PDA using seeds: ["node", authority, agent].
Submit water quality data from authorized agent. Emits ReadingEvent and updates State PDA with new readings.
Acidity/alkalinity measurement (0-14 scale)
Safe Range: 6.5 - 8.5
Water clarity measurement in NTU (Nephelometric Turbidity Units)
Safe Range: < 1.0 NTU
Electrical conductivity in µS/cm (dissolved solids indicator)
Safe Range: < 1500 µS/cm
Water temperature in Celsius
Safe Range: < 30°C
Water level measurement in meters
Safe Range: Varies
Unix timestamp of reading submission
Safe Range: Current time
Authority (sensor owner) calls create_node with agent public key and node name. Program creates Node PDA to track ownership and authorization.
Only the designated agent (autonomous AI or sensor firmware) can submit readings. Agent must sign submit_reading transactions.
Authorized agent submits ReadingInput struct with water quality metrics. Program validates agent signature against Node account.
Program creates or updates State PDA with new readings, increments sequence number, and emits ReadingEvent for indexers.
Frontend queries Node and State accounts via RPC. AI agents analyze readings and generate alerts. x402 protocol enables micropayment for data access.
6000: UnauthorizedAgentThrown when a non-authorized agent attempts to submit readings. Prevents data tampering.
npm run seedCreates demo water monitoring nodes on Solana devnet with sample readings.
npm run agentLaunches AI agent that discovers nodes, pays for data access via x402, and analyzes water quality.
npm run devStart Next.js frontend to visualize on-chain data, agent alerts, and network metrics.