API for Autonomous Vehicles

Authentication

POST /auth/register

Register the vehicle and receive a device token.

json{
"vehicle_id": "AV-001",
"hardware_fingerprint": "a1b2c3d4e5f6",
"validator_alias": "relay1"
}
POST /auth/verify

Verify integrity of the AV system (heat, tamper, sensors).

json{
"vehicle_id": "AV-001",
"temp_readings": [42.1, 44.0],
"firmware_hash": "sha256:abcd1234...",
"system_flags": ["NO_TAMPER", "SECURE_BOOT"]
}

Mission and Navigation

POST /mission/start

Begin a mission and create a verifiable IPFS log.

json{
"vehicle_id": "AV-001",
"mission_hash": "abc123mission",
"gps_start": [38.8951, -77.0364],
"timestamp": "2025-05-22T13:00:00Z"
}
POST /mission/complete

Complete the mission, log it to IPFS, and earn OTA.

jso{
"vehicle_id": "AV-001",
"gps_end": [38.9100, -77.0400],
"distance_km": 3.2,
"duration_sec": 942,
"mission_hash": "abc123mission"
}

Returns:

json{
"cid": "QmZx123...",
"ota_reward": 12.4,
"ledger_entry

Live Telemetry and CID Logging

POST /telemetry/stream

Push live telemetry to the CID ledger (queued if offline).

json{
"vehicle_id": "AV-001",
"lat": 38.899,
"lon": -77.033,
"speed_kph": 28,
"obstacle": false,
"battery_level": 76
}
GET /cid/ledger/:vehicle_id

Return recent CID logs for the vehicle.


Payments and Rewards

GET /wallet/balance/:vehicle_id

Returns OTA token balance of vehicle.

POST /wallet/send

Send OTA to another address (e.g. toll gate, data buyer).

json{
"from_vehicle": "AV-001",
"to_address": "ota1abc...",
"amount": 5.0,
"note": "Autonomous toll payment"
}

Data Upload / Snapshot

POST /data/upload

Upload full mission log, camera footage, or sensor snapshot.

Payload: multipart form (file + metadata)

Response:

json{
"cid": "QmSnapshot123...",
"tag": "flight-log",
"upload_success": true
}

Threat Detection and Alerts

POST /threat/report

Send alert if hostile device or terrain hazard detected.

json{
"vehicle_id": "AV-001",
"threat_type": "RF_INTERFERENCE",
"location": [38.905, -77.038],
"signal_strength_db": -42
}

OTA Updates and Sync

GET /firmware/check/:vehicle_id

Check if firmware update is available.

POST /firmware/confirm

Send confirmation of OTA update install.


System State Sync

POST /state/publish

Push full vehicle configuration/state to IPFS.

json{
"vehicle_id": "AV-001",
"firmware_version": "1.2.3",
"active_modules": ["LIDAR", "CAMERA", "GNSS"],
"sync_time": "2025-05-22T13:45:00Z"
}

Returns:

json{
"cid": "QmConfig123...",
"sync_status": "queued"
}

/route/optimize – AI-Driven Route Selection for Validators

POST /route/optimize

Returns an optimal path for autonomous vehicles based on validator presence, toll cost, safety, and battery constraints.

Request Example:

json{
"vehicle_id": "AV-001",
"start": [38.8951, -77.0364],
"end": [38.9200, -77.0500],
"battery_level": 82,
"avoid_threats": true,
"route_policy": "fastest" // or "safest", "cheapest"
}

Response:

json{
"optimized_route": [
{"lat": 38.896, "lon": -77.036},
{"lat": 38.901, "lon": -77.038},
{"lat": 38.910, "lon": -77.042}
],
"estimated_duration_sec": 310,
"estimated_ota_cost": 1.25,
"validators_nearby": ["relay1", "relay2"],
"risk_score": 0.03
}

/alias/resolve/:vehicle_hash – Public Key ↔ Alias Mapping

GET /alias/resolve/:vehicle_hash

Maps a vehicle or validator’s public key hash to a registered alias.

Example:
GET /alias/resolve/6fbc27ae1cd2193b43fa

Response:

json{
"alias": "drone-alpha-7",
"type": "vehicle",
"registered_by": "relay1",
"last_updated": "2025-05-20T09:44:00Z"
}

/signature/verify/:cid – Signature Validation for Telemetry Logs

GET /signature/verify/:cid

Verifies digital signatures attached to mission logs or telemetry files stored in IPFS.

Example:
GET /signature/verify/QmXYZabc456

Response:

json{
"cid": "QmXYZabc456",
"signature_valid": true,
"signed_by": "ota-validator",
"pubkey": "hmRfapBR5kW3O/Hm80PYqnh1KibF7L6Qd/EnYb7aLXc=",
"timestamp": "2025-05-21T22:00:00Z"
}

If invalid:

json{
"cid": "QmXYZabc456",
"signature_valid": false,
"error": "Signature mismatch or missing public key."
}

/zones/map – Geo-Fence & Validator Zones

GET /zones/map?lat=38.900&lon=-77.030&radius_km=5

Returns active regulatory zones such as no-fly, toll, hazard, and validator areas around the coordinate.

Response:

json{
"zones": [
{
"type": "no-fly",
"name": "GovRestrictedArea-9",
"radius_m": 300,
"center": [38.902, -77.035]
},
{
"type": "toll",
"cost_ota": 2.0,
"center": [38.905, -77.037],
"zone_id": "toll-zone-A1"
},
{
"type": "validator",
"alias": "relay2",
"coverage_radius_m": 1500,
"location": [38.908, -77.041]
}
]
}