Documentation

Deploying the Protocol

Deploy EnergyAS to any EVM-compatible chain where EAS is available. The deployment process creates two contracts and registers the attestation schema.

Prerequisites

  • Node.js 18+ and npm installed
  • A funded deployer wallet (enough for ~3 contract deployments)
  • EAS must already be deployed on the target network

1. Compile Contracts

Terminal
npx hardhat compile

Compiles EnergyRegistry, EnergyAttestationResolver, and required EAS contracts. Solidity 0.8.28 with optimizer enabled (200 runs, viaIR, Cancun EVM).

2. Deploy Core Contracts

Terminal
npx hardhat run scripts/deploy.ts --network <network>

This deploys both contracts and authorizes the resolver in one script:

  1. Deploys EnergyRegistry (permanent state contract)
  2. Deploys EnergyAttestationResolver (points to EAS + registry)
  3. Calls registry.authorizeResolver(resolverAddress)
  4. Saves addresses to deployments/<network>.json

Add the deployed addresses to your .env:

Environment
REGISTRY_ADDRESS=0x...
RESOLVER_ADDRESS=0x...

3. Register Schema

Terminal
npx hardhat run scripts/register-schema.ts --network <network>

Registers the attestation schema on the EAS SchemaRegistry with the resolver address. The schema is revocable (corrections via revoke + re-attest). Save the returned Schema UID.

Environment
SCHEMA_UID=0x...

4. Verify Deployment

After deployment, share the following with watchers who will use the protocol:

  • REGISTRY_ADDRESS — watchers interact with this for setup
  • SCHEMA_UID — watchers use this when submitting attestations
  • Network name and chain ID
Note

Warning: The deployer wallet becomes the contract owner. Use a multisig for production deployments to ensure you can always authorize new resolvers and manage emergency pauses.