Loops HouseNEAR STREAM

NEAR HACKATHON (Test)
Links
Team
1 member- 0XOwner
0xharshragrawal
Overview
The problem: when a business pays an API or an AI agent for ongoing work, it either prepays and hopes, or pays later and argues. Nothing enforces "pay only while the work is actually delivered."
What I built: NEAR Stream, a smart contract plus two autonomous agents that pay a service per second, only for time that independent watchdogs have verified.
- The payer locks funds in a stream. A watchdog agent checks the service's real output against an independent source and attests on-chain. The contract pays only the time between consecutive attestations; unverified time and outages are never paid.
- If the service fails (even while still returning HTTP 200), attestations stop and payment freezes on its own. A guardian agent on the payer's side then cancels: the provider keeps exactly the verified time, the rest is refunded. No human involved.
- Streams can require k-of-n watchdogs, so one dishonest verifier can't release payment (shown on-chain with 2-of-3).
How NEAR fits in: each agent signs with a NEAR function-call access key that can call exactly one method on this contract (attest, or cancel) and cannot move funds. We tried to steal with both keys and the chain rejected it. The contract also supports NEP-141 token streams with rollback callbacks so failed payouts stay claimable.
Proof: deployed to NEAR mainnet and ran the full watchdog -> freeze -> guardian auto-cancel loop with real NEAR. On testnet, a complete paid-service loop (consumer pays the operator of an RPC wrapper; healthy time earns, stale data stops credit, payouts reconcile to the yocto from receipts). "npm run verify" re-checks 35 on-chain claims, read-only; 31 unit tests + 2 browser tests.
Honest limits (in the README): the commercial loop is team-run, not an external customer; all watchdogs ran on one machine; token streams were proven with wNEAR, not USDC; checks are sampled, so up to one heartbeat per incident can go undetected.