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
npx hardhat compileCompiles EnergyRegistry, EnergyAttestationResolver, and required EAS contracts. Solidity 0.8.28 with optimizer enabled (200 runs, viaIR, Cancun EVM).
2. Deploy Core Contracts
npx hardhat run scripts/deploy.ts --network <network>This deploys both contracts and authorizes the resolver in one script:
- Deploys EnergyRegistry (permanent state contract)
- Deploys EnergyAttestationResolver (points to EAS + registry)
- Calls registry.authorizeResolver(resolverAddress)
- Saves addresses to deployments/<network>.json
Add the deployed addresses to your .env:
REGISTRY_ADDRESS=0x...
RESOLVER_ADDRESS=0x...3. Register Schema
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.
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
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.