🛡️ Carbon Attestation & Compliance — app4.2
Developer CourseModule 4: Carbon Attestation & Complianceapp4.2
Reading10 min

grid.attest() — Create a Tamper-Proof Carbon Record

🛡️ Module 4: Carbon Attestation & Compliance

grid.attest() — Create a Tamper-Proof Carbon Record

The attest primitive creates an append-only carbon record with SHA-256 hash chain integrity. Each record links to the previous one, making the chain tamper-evident.

Creating a Carbon Record

curl -X POST -H "Authorization: $EAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "meter_id": "meter-001",
    "facility_id": "00000000-0000-0000-0000-000000000001",
    "timestamp": "2026-02-27T10:00:00Z",
    "kwh": 250.5
  }' \
  https://app.energyatit.com/api/v1/carbon/record
# Create a carbon record
curl.exe --% -X POST -H "Authorization: $env:EAT_KEY" -H "Content-Type: application/json" -d "{"meter_id": "meter-001", "facility_id": "00000000-0000-0000-0000-000000000001", "timestamp": "2026-02-27T10:00:00Z", "kwh": 250.5}" "https://app.energyatit.com/api/v1/carbon/record"

What You Get Back

{
  "success": true,
  "data": {
    "id": "uuid-here",
    "meter_id": "meter-001",
    "kwh": 250.5,
    "carbon_intensity_gco2_kwh": 420,
    "total_co2_kg": 105.21,
    "hash": "sha256-hash-here",
    "previous_hash": "previous-sha256-hash",
    "status": "attested"
  }
}

Key Fields

  • carbon_intensity_gco2_kwh: Auto-looked up from Electricity Maps for your grid zone
  • total_co2_kg: Calculated as kwh × intensity / 1000
  • hash: SHA-256 of this record's data + previous_hash
  • previous_hash: Links to the last record for this meter

The Auto-Lookup

You do not need to know the carbon intensity of your grid. EnergyAtIt looks it up automatically from the Electricity Maps API based on your facility's grid zone. UAE facilities get UAE intensity. German facilities get DE intensity.

# You just provide the kWh — carbon intensity is automatic
curl -X POST -H "Authorization: $EAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"meter_id": "meter-001", "facility_id": "FAC_UUID", "timestamp": "2026-02-27T10:30:00Z", "kwh": 125.3}' \
  https://app.energyatit.com/api/v1/carbon/record
# Carbon intensity is automatic
curl.exe --% -X POST -H "Authorization: $env:EAT_KEY" -H "Content-Type: application/json" -d "{"meter_id": "meter-001", "facility_id": "FAC_UUID", "timestamp": "2026-02-27T10:30:00Z", "kwh": 125.3}" "https://app.energyatit.com/api/v1/carbon/record"

Log in to track your progress and earn certifications.