Quick Start
Get up and running with EnergyAS in minutes. This guide walks you through the complete flow from deployment to your first attestation.
Prerequisites
- Node.js 18+ and npm
- A wallet with testnet funds (e.g., Polygon Amoy)
- Basic familiarity with Hardhat and Ethereum transactions
1. Install Dependencies
git clone https://github.com/your-org/energy-attestation-service
cd energy-attestation-service
npm install2. Configure Environment
Copy the example environment file and fill in your keys:
PRIVATE_KEY_DEPLOYER=0x...your_deployer_private_key
PRIVATE_KEY_WATCHER=0x...your_watcher_private_key3. Deploy Contracts
npx hardhat compile
npx hardhat run scripts/deploy.ts --network amoyThis deploys the EnergyRegistry (permanent state) and EnergyAttestationResolver (validation logic), then authorizes the resolver. Addresses are saved to deployments/amoy.json.
4. Register Schema
Add the deployed addresses to your .env:
REGISTRY_ADDRESS=0x...
RESOLVER_ADDRESS=0x...npx hardhat run scripts/register-schema.ts --network amoySave the returned Schema UID to your .env as SCHEMA_UID.
5. Register Watcher & Project
npx hardhat run scripts/setup.ts --network amoyThe interactive script walks you through registering a watcher, creating a project (generator or consumer), and whitelisting an attester.
6. Submit Your First Attestation
npx hardhat run scripts/attest.ts --network amoySubmit energy readings interactively or from a JSON report file. The resolver validates the data and records it permanently in the registry.
7. Query Results
npx hardhat run scripts/query-watcher.ts --network amoyView your watcher's total generated and consumed energy, with a per-project breakdown.
All data is public and queryable by anyone — no API keys or access controls needed.