Documentation

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

Terminal
git clone https://github.com/your-org/energy-attestation-service
cd energy-attestation-service
npm install

2. Configure Environment

Copy the example environment file and fill in your keys:

Environment
PRIVATE_KEY_DEPLOYER=0x...your_deployer_private_key
PRIVATE_KEY_WATCHER=0x...your_watcher_private_key

3. Deploy Contracts

Terminal
npx hardhat compile
npx hardhat run scripts/deploy.ts --network amoy

This 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:

Environment
REGISTRY_ADDRESS=0x...
RESOLVER_ADDRESS=0x...
Terminal
npx hardhat run scripts/register-schema.ts --network amoy

Save the returned Schema UID to your .env as SCHEMA_UID.

5. Register Watcher & Project

Terminal
npx hardhat run scripts/setup.ts --network amoy

The interactive script walks you through registering a watcher, creating a project (generator or consumer), and whitelisting an attester.

6. Submit Your First Attestation

Terminal
npx hardhat run scripts/attest.ts --network amoy

Submit energy readings interactively or from a JSON report file. The resolver validates the data and records it permanently in the registry.

7. Query Results

Terminal
npx hardhat run scripts/query-watcher.ts --network amoy

View your watcher's total generated and consumed energy, with a per-project breakdown.

Note

All data is public and queryable by anyone — no API keys or access controls needed.