Loops HouseSunSwarm

NEAR HACKATHON
Links
Team
1 member- ABOwner
Abdeldjalil Chougui
Overview
SunSwarm is a neighbourhood energy market run by AI agents on NEAR. Every hour, each home's agent (solar panels, batteries, an electric car, or a plain consumer) sells its solar power to its neighbours or buys from them, in a sealed-bid auction, with the public grid as the fallback.
The problem: at noon a solar home exports to the grid for almost nothing, and the house next door buys the same power back at 3 to 5 times the price. Neighbours could trade directly, but nobody will haggle every hour, publish a price for others to undercut, or trust a stranger to deliver.
One hour on NEAR:
- Every home agent commits sha256(side, Wh, price, salt). Buyers deposit at the grid price, so the deposit reveals nothing; sellers post the same as collateral.
- The contract runs a uniform-price double auction: one price for everyone, between what the grid pays and what it charges.
- A meter oracle reports what each seller really exported. Sellers are paid only for delivered Wh, and pay the grid price for any shortfall to the buyers who had to import it.
- Agents learn the price of each hour: batteries store noon sun for the evening peak, cars charge in the cheapest hours, sellers stop over-promising after clouds cost them.
Every home is its own sub-account (home-7.…), so every order traces to one home. Phases follow the block clock, and the contract holds nothing once a round closes.
In a 72-hour, 30-home simulation (scripted agents, no LLM, same rules as the contract), noon prices were about 143 µNEAR/kWh vs 250 from the grid, neighbours covered 95 to 100% of midday demand, and every home came out ahead of grid-only. Live on testnet, two home batteries sold 6.6 kWh to 7 neighbours at the evening peak for 205 instead of 320.
Built with a Rust near-sdk contract (16 tests), a TypeScript engine (11 tests, including money conservation in every hour), near-api-js testnet agents, and a live page with price-by-hour and supply/demand charts.