Zenodo DOI: 10.5281/zenodo.21898921
Physics-grounded embodied IoT for verifiable urban solar markets
From weather-aware PV modeling and FDIA detection to human review, wallet-signed registration, and blockchain-backed energy settlement.
Camera-ready release MIT License Last commit GitHub issues
Python React FastAPI Solidity Hardhat
Architecture • Quick Start • Research Artifact • Contracts • Documentation
Note
SolarChain is the product and paper name. The repository remains named SolarSave for continuity with the original project.
SolarChain is an open-source research prototype for urban distributed-energy verification and market coordination. It connects a physics-bounded solar simulator, embodied PV agents, a planner-facing map and review console, MetaMask, and a local EVM contract suite into one inspectable workflow.
The machine calculates a defensible generation boundary. The planner decides whether a candidate distributed energy resource (DER) should proceed. Approved records are signed by a wallet and registered on-chain; rejected or anomalous records remain visible in the audit trail.
| ☀️ 50 PV agents | 🕒 720 hourly steps | 📊 36,000 records | 🛡️ 11 attack scenarios |
|---|---|---|---|
| Five Chinese cities | April 2026 episode | 5% scripted FDIA | Seven detector variants |
| 🛰️ Physics-grounded verification Derives P_max_W from weather, panel geometry, efficiency, and temperature effects before evaluating reported output. |
🧑💻 Human-in-the-loop governance A planner reviews candidate DER records, residuals, risk state, and map context before registration. |
| ⛓️ Verifiable settlement MetaMask signs asset registration and EVM contracts track panels, factories, energy, rewards, trades, and SOLR. |
🔬 Reproducible evaluation Versioned datasets, experiment scripts, hash-linked traces, policy sweeps, and publication figures ship with the repository. |
The system closes the loop between physical modeling, adaptive verification, human judgment, and market settlement.
flowchart TB
subgraph INPUTS["1. Urban energy inputs"]
WEATHER["Open-Meteo weather"]
DER["PV node profiles"]
DEMAND["Factory demand"]
end
subgraph INTELLIGENCE["2. Physics and agent layer"]
MODEL["pvlib + SolarPVModel<br/>Physical P_max boundary"]
AGENTS["SolarAgents coordination<br/>trust, memory, verification"]
AUDIT["Hash-linked events<br/>audit and state traces"]
end
subgraph EXPERIENCE["3. Human decision layer"]
API["FastAPI simulator"]
UI["React + Leaflet<br/>Planner Console"]
REVIEW{"Planner review"}
end
subgraph SETTLEMENT["4. Verifiable settlement"]
WALLET["MetaMask signature"]
REGISTRY["SolarPanels + Factory"]
MARKET["EnergyExchange + PowerReward<br/>SOLR + Shop"]
end
WEATHER --> MODEL
DER --> MODEL
MODEL --> AGENTS
DEMAND --> AGENTS
AGENTS --> API
AGENTS --> AUDIT
API --> UI
UI --> REVIEW
REVIEW -->|Reject| AUDIT
REVIEW -->|Approve| WALLET
WALLET --> REGISTRY
REGISTRY --> MARKET
AGENTS -->|Verified market step| MARKET
MARKET --> UI
- Observe: weather and node metadata drive a bounded PV generation model.
- Verify: agent policies compare
P_reported_Wwith the physical boundary and update trust, calibration, and verification state. - Review: the planner inspects the candidate queue, map context, residuals, and FDIA status.
- Sign: an approved candidate is signed through MetaMask and registered as an on-chain solar panel.
- Settle: verified supply enters the configurable reward/liquidity market, where factories purchase energy and rewards accrue.
- Audit: event, decision, market, and state records form reproducible, hash-linked traces.
The bundled benchmark is a reproducible, weather-driven simulation over
Beijing, Chengdu, Hangzhou, Shanghai, and Shenzhen. It uses city-level
Open-Meteo observations, pvlib solar modeling, synthetic PV node profiles,
scripted false-data injection, and controlled market construction.
Release record Evaluation map Dataset provenance
- Node.js 18+ and npm
- Python 3.9+
- Git
- MetaMask for wallet-signed interactions
git clone https://github.com/sunshineluyao/SolarSave.git
cd SolarSavecd smart_contract
npm install
npx hardhat nodeKeep the Hardhat node running. In a second terminal, deploy the contracts:
cd smart_contract
npx hardhat run scripts/deployAll.js --network localhostThe deployment script authorizes the contract relationships, funds local test accounts, and synchronizes contract addresses with the frontend and simulator.
cd Simulator python -m venv .venv source .venv/bin/activate pip install -r requirements.txt python -m uvicorn main:app --reload
The API is available at http://127.0.0.1:8000; interactive API documentation is available at http://127.0.0.1:8000/docs.
cd client
npm install
npm run devOpen http://127.0.0.1:3000 and connect MetaMask to:
| Setting | Local value |
|---|---|
| RPC URL | http://127.0.0.1:8545 |
| Chain ID | 31337 |
| Network | Hardhat Local |
Caution
Import only a Hardhat test key for local development. Never commit private keys or use a production wallet with the local prototype.
The camera-ready artifact centers on the April 2026 controlled benchmark and the EIoT evaluation suite.
| Artifact | Scale | Purpose |
|---|---|---|
| PV node metadata | 50 nodes | Five-city panel geometry and installation profiles |
| Hourly generation | 36,000 rows | Physical bounds, reports, FDIA labels, and decisions |
| Market liquidity | 720 rows | Selected 20/80 reward-liquidity policy vs. baseline |
| P2P trades | 1,185 trades | Factory purchases, token burn, and exergy estimates |
| Attack taxonomy | 11 scenarios | Detector behavior across physical and contextual attacks |
| Event-chain verification | Hash checks | Tamper-evident trace validation |
| Ratio selection | Policy summary | Evidence for the default rewardRatioBps = 2000 |
Run from the repository root after installing the simulator dependencies:
python Simulator/data/generate_monthly_datasets.py python Simulator/experiments/run_all_eiot_experiments.py python Simulator/data/visualizations.py
python -m pytest tests
cd smart_contract npm test
cd client
npm run build| Contract | Responsibility |
|---|---|
SolarPanels.sol |
Solar asset registry, ownership, and panel state |
Factory.sol |
Factory registration and demand-side entities |
EnergyExchange.sol |
Supply, demand, configurable reward allocation, claims, and purchases |
SolarToken.sol |
ERC-20 SOLR payment and reward token |
Shop.sol |
Solar-panel marketplace operations |
PowerReward.sol |
DC-power-linked reward distribution |
The default market allocation is 20% producer reward / 80% liquidity,
represented on-chain as rewardRatioBps = 2000.
| Endpoint | Method | Purpose |
|---|---|---|
/run_model/ |
POST | Run the PV prediction model |
/run_combined_model/ |
POST | Combine solar prediction inputs |
/agents/status |
GET | Inspect the current embodied-agent loop |
/agents/step |
POST | Execute one coordination step |
/agents/run_episode |
POST | Run a configured agent episode |
/agents/events |
GET | Read recent agent events |
/agents/audit |
GET | Inspect audit events |
/agents/market_summary |
GET | Read market-level results |
/agents/settle_verified_step |
POST | Submit a verified market step for settlement |
| Path | What lives there |
|---|---|
client/ |
React, Leaflet, planner console, market views, and wallet interactions |
Simulator/ |
FastAPI service, PV physics model, agents, datasets, and experiments |
smart_contract/ |
Solidity contracts, Hardhat deployment scripts, and contract tests |
tests/ |
Research-artifact and embodied-agent evaluation tests |
docs/ |
Release record, evaluation map, and supporting research documentation |
| Variable | Default | Purpose |
|---|---|---|
SIMULATOR_RPC_URL |
http://127.0.0.1:8545 |
EVM JSON-RPC endpoint |
SIMULATOR_PRIVATE_KEY |
unset | Local signer used for simulator settlement |
SIMULATOR_STEP_SECONDS |
3600 |
Coordination and market-step interval |
ENABLE_ENERGY_SIM |
auto |
Enable, disable, or auto-detect settlement |
SIMULATOR_CORS_ORIGINS |
local frontend origins | Allowed simulator API origins |
VITE_SOLAR_AGENT_API |
http://localhost:8000 |
Frontend simulator API base URL |
VITE_URBAN_DATASET_DIR |
bundled public dataset | Frontend CSV dataset directory |
| Guide | Description |
|---|---|
| Camera-ready release record | Publication identity, checksum, artifact map, and scope |
| EIoT evaluation artifacts | Claims-to-evidence map for datasets and experiments |
| Dataset documentation | Dataset organization, fields, and generation workflow |
| Simulator guide | API and model-specific setup |
| Contract guide | Contract deployment and interaction notes |
Common troubleshooting
- No contracts in the UI: deploy with
deployAll.jsafter starting the Hardhat node, then confirm the generated address files were updated. - Empty candidate queue: confirm
client/public/datasets_2026_04_month/spatiotemporal_generation.csvexists. - Only 50 map markers: expected; 36,000 hourly records are grouped by
node_idinto 50 locations. - Simulator cannot settle: check
SIMULATOR_RPC_URL,SIMULATOR_PRIVATE_KEY, andENABLE_ENERGY_SIM. - Rewards stay at zero: run at least one simulator market step and ensure the reward contract has been funded with local SOLR.
Important
SolarChain is a controlled research prototype, not a utility deployment. Weather is city-level rather than per-panel telemetry; PV nodes, FDIA labels, demand, and trades are simulated for benchmark control. The repository does not claim production readiness, sensor authenticity, economic optimality, or a completed smart-contract security audit.
This repository is the final artifact release for:
SolarChain: A Physics-Grounded Embodied IoT System for Verifiable Urban Solar Market Design
UbiComp Companion '26, Shanghai, China
See the camera-ready release record for the paper checksum and the evaluation artifact map for reproducibility links.
Contributions are welcome:
- Fork the repository.
- Create a focused branch.
- Add or update tests for behavioral changes.
- Open a pull request describing the motivation, implementation, and evidence.
For questions or proposals, open a GitHub issue.
SolarChain is released under the MIT License.