🚀 Dispatch & Control — app3.4
Developer CourseModule 3: Dispatch & Controlapp3.4
Reading10 min

grid.settle() — Cryptographic Proof Your Command Ran

🚀 Module 3: Dispatch & Control

grid.settle() — Cryptographic Proof Your Command Ran

A settlement is a tamper-proof record that proves: this command was sent, this device executed it, and here is the cryptographic proof.

Why Settlements Matter

In energy markets, money changes hands based on dispatch records. A utility pays you for demand response participation. A tenant pays for battery usage. An auditor checks your carbon claims.

All of them need proof. Not "trust me" proof. Cryptographic proof.

How It Works

# Generate a settlement for site 1
curl -X POST -H "Authorization: $EAT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "site_id": 1,
    "period_start": "2026-02-01",
    "period_end": "2026-02-28"
  }' \
  https://app.energyatit.com/api/v1/settlements
# Generate a settlement for site 1
curl.exe --% -X POST -H "Authorization: $env:EAT_KEY" -H "Content-Type: application/json" -d "{"site_id": 1, "period_start": "2026-02-01", "period_end": "2026-02-28"}" "https://app.energyatit.com/api/v1/settlements"

What You Get Back

{
  "success": true,
  "data": {
    "id": 42,
    "site_id": 1,
    "period_start": "2026-02-01",
    "period_end": "2026-02-28",
    "total_dispatches": 156,
    "total_energy_kwh": 45230.5,
    "hash": "a1b2c3d4e5f6...",
    "previous_hash": "f6e5d4c3b2a1...",
    "verified": true
  }
}

The Hash Chain

Each settlement contains a SHA-256 hash that links to the previous settlement. If anyone changes a historical record, the hash chain breaks and verified returns false.

# Verify a settlement's integrity
curl -H "Authorization: $EAT_KEY" \
  https://app.energyatit.com/api/v1/settlements/42/verify
# Verify a settlement's integrity
curl.exe -H "Authorization: $env:EAT_KEY" "https://app.energyatit.com/api/v1/settlements/42/verify"

SHA-256 in Plain English

SHA-256 is a math function that turns any input into a unique 64-character fingerprint. Change one character of the input, and the fingerprint completely changes. It is impossible to reverse — you cannot figure out the input from the output.

This is how EnergyAtIt makes records tamper-proof without needing a blockchain.

Log in to track your progress and earn certifications.