Docs / H3 System

H3 Hexagonal Grid System

How Opacus divides the Earth into hexagonal cells — and uses them for agent routing, land ownership, and geospatial identity.

What is H3?

H3 is Uber's open-source hierarchical geospatial indexing system. It divides the Earth into hexagonal cells arranged in 16 resolution levels (0–15). Each resolution level subdivides every hexagon into approximately 7 child cells.

ℹ️
Hexagons are used instead of squares because every neighboring hexagon has the same edge-distance from the center cell — making proximity calculations uniform and eliminating directional bias in routing algorithms.

Opacus uses the h3-js library (Uber's official JavaScript port) to compute cell IDs, distances, and neighborhoods. Every agent, Nitro node, and land title is indexed to an H3 cell.

Resolution Levels

The table below shows all H3 resolution levels with approximate cell counts and areas. Each level has ~7× more cells than the previous.

ResolutionCell Count (approx.)Area / CellScaleOpacus Use
0122~4,357,449 km²Continent
1842~609,788 km²Sub-continent
25,882~86,745 km²Large country
341,162~12,393 km²Region / State
4288,122~1,770 km²Large metro
52,016,842~252 km²City / Metro Routing V1
Nitro node anchors, spam filter, market infra anchors
614,117,882~36 km²District
798,825,162~5.2 km²Neighborhood
8691,776,122~0.74 km²Neighborhood (~860m) SDK default
latLngToH3Cell() default, H3 Beacon Globe
94,842,432,842~0.1 km²Block (~300m) Agent Registry
h3-registry.ts, ERC-7751 agent registration, discovery
1033,897,029,882~0.015 km²Building
11237,279,209,162~2,150 m²Large room
121,660,954,464,122~307 m²Room (~17m) WorldEvent
agent-kernel WorldEvent spatial index, IoT precision
1311,626,681,248,842~44 m²Person-scale
1481,386,768,741,882~6.3 m²Desk-scale
15569,707,381,193,162~0.9 m²Object-scale

Hexagonal Grid Visualization

Each parent hexagon contains exactly 1 center cell + 6 neighbors at the next resolution level. The diagram below shows res 5 cells (blue = city anchors, green = agent zone, purple = agent registered, orange = Nitro node).

City anchor Agent zone Agent Nitro City anchor (res 5) Agent zone Registered agent Nitro node

How H3 Works in Opacus

Opacus uses H3 at three distinct layers, each at a different resolution:

Layer 1 — Routing
Res 5
~252 km² per cell
2,016,842 cells
+
Layer 2 — Identity
Res 8–9
~0.74–0.1 km² per cell
691M–4.8B cells
+
Layer 3 — Events
Res 12
~307 m² per cell
1.6T cells

Request Flow: GPS → H3 Cell → Nitro Node

Agent sends
lat/lon
h3js.latLng
ToCell(lat,lon,5)
H3 Cell
85283473fffffff
Nearest
Nitro node
QUIC 0-RTT
established
GPS or
IP geo
latLngToCell
(lat,lon,9)
CitadelDID
did:opacus:v1:h3:...
ERC-7751
registry
On-chain
identity

Nitro Nodes & H3 Anchors

Each Opacus Nitro node is assigned to an H3 resolution 5 cell representing its geographic region. The routing engine uses great-circle distance between cell centers to select the nearest healthy node.

Virginia (US-East)
38.9072, -77.0369
H3: 85283473fffffff
↔ Gemini · Kraken · Binance.US · Uniswap · Aerodrome
Singapore (AP-SE)
1.3521, 103.8198
H3: 85264523fffffff
↔ OKX · Bybit · 0G Jaine DEX
Frankfurt (EU-Central)
50.1109, 8.6821
H3: 8521e30ffffffff
↔ EU RPC endpoints
Tokyo (AP-NE)
35.6762, 139.6503
H3: 8530e1affffffff
↔ Binance primary matching engine
Dublin (EU-West)
53.3331, -6.2489
H3: 85158d2ffffffff
↔ Coinbase EU · Ankr
Mumbai (AP-South)
19.0760, 72.8777
H3: 853b48affffffff
↔ South Asia DePIN nodes

CitadelDID: H3 + Wallet Identity

A CitadelDID encodes both the agent's geospatial position (H3 cell) and its wallet address into a single on-chain identity string:

// Format
did:opacus:v1:h3:{h3CellIndex}:{walletAddress}

// Example (res 9, Istanbul)
did:opacus:v1:h3:891e353c0affff:0x1a2b3c4d...

// Core DID (no geo — always free, assigned to all agents)
did:opacus:v1:{agentId}

The CitadelDID is stored in the ERC-7751 registry contract on 0G Network. Any agent can query it to discover nearby agents by capability and proximity.

GPS Input
lat: 41.0082
lon: 28.9784
h3.latLngToCell()
891e353c0affff
res 9, ~0.1 km², Istanbul
CitadelDID
did:opacus:v1:h3:
891e353c0affff:0x1a2b...
0G Registry
ERC-7751
on-chain

SDK Usage

import { latLngToH3Cell, H3RoutingClient, citadelDID } from 'opacus-sdk/h3';
import { ethers } from 'ethers';

// 1. Convert GPS → H3 cell (res 9, ~0.1 km² block scale)
const h3Index = latLngToH3Cell(41.0082, 28.9784, 9); // Istanbul
// → '891e353c0affff'

// 2. Build a CitadelDID
const did = citadelDID(h3Index, wallet.address);
// → 'did:opacus:v1:h3:891e353c0affff:0xabc...'

// 3. Register on ERC-7751 (0G Network)
const h3Client = new H3RoutingClient(signer, process.env.ERC7751_CONTRACT);
await h3Client.register({
  h3Index:      ethers.id(h3Index),
  quicEndpoint: 'quic://my-agent.example.com:4433',
  capabilities: [
    ethers.id('exec.evm.public_tx'),
    ethers.id('data.oracle.price'),
  ],
  kineticScore: 75,
  value: ethers.parseEther('0.001')  // registration bond
});

// 4. Discover nearby agents by capability (within ~5 km at res 9)
const nearby = await h3Client.findAgents({
  h3Index:    ethers.id(h3Index),
  radiusCells: 2,                              // H3 grid steps
  capability:  ethers.id('exec.evm.public_tx')
});
// → [{ wallet, h3Index, quicEndpoint, kineticScore }, ...]

// 5. Resolve nearest Nitro node for this H3 cell
const node = await opacus.nitro.resolve({ h3Index });
// → { endpoint: 'quic://us-iad-1.0g.network:4433', latencyMs: 12 }

H3 API Reference

GET /v1/routing/anchors

Returns the H3 cell and nearest Nitro nodes for a GPS coordinate.

ParamTypeDescription
latfloatLatitude (-90 to 90)
lonfloatLongitude (-180 to 180)
resolutionintH3 resolution 0–12 (default: 8)
curl "https://opacus.xyz/api/v1/routing/anchors?lat=41.0082&lon=28.9784&resolution=9" \
  -H "Authorization: Bearer obr_agent_..."

// Response
{
  "ok": true,
  "cellId": "891e353c0affff",
  "resolution": 9,
  "area_km2": 0.1,
  "center": { "lat": 41.0097, "lng": 28.9801 },
  "anchors": [
    { "endpoint": "quic://de-fra-1.0g.network:4433", "region": "eu-central",
      "distanceKm": 2174, "latencyMs": 9 }
  ],
  "nitroNode": {
    "id": "de-fra-1", "label": "Frankfurt",
    "endpoint": "quic://de-fra-1.0g.network:4433", "latencyMs": 9
  }
}

GET /v1/land/:h3Index

Query iNFT land ownership for a specific H3 cell.

curl "https://opacus.xyz/api/v1/land/891e353c0affff" \
  -H "Authorization: Bearer obr_agent_..."

// Response — unowned cell
{ "ok": true, "h3Index": "891e353c0affff", "owned": false }

// Response — owned cell
{
  "ok": true,
  "h3Index": "891e353c0affff",
  "owned": true,
  "owner": "0x1a2b3c4d...",
  "inft_token_id": "0x0000...0042",
  "chain": "0g",
  "micro_fee_bps": 25
}

POST /v1/land/register

Register an iNFT land title for an H3 cell. Requires pay.gas_subsidy scope token.

curl -X POST "https://opacus.xyz/api/v1/land/register" \
  -H "Authorization: Bearer obr_pay_..." \
  -H "Content-Type: application/json" \
  -d '{
    "h3_index": "891e353c0affff",
    "inft_token_id": "0x0000...0042"
  }'

GET /api/v1/agents/h3

List all agents registered to H3 cells. Filter by proximity.

curl "https://opacus.xyz/api/v1/agents/h3?h3Index=891e353c0affff&radius=3" \
  -H "Authorization: Bearer obr_agent_..."

iNFT Land Registry

Every H3 cell can be claimed as a land title — represented as an iNFT on 0G Chain. When an agent executes a transaction inside a claimed cell, a 0.25% micro-fee is automatically routed to the land owner.

💡
This is Phase 2 functionality. Land titles allow passive income for node operators and early network participants — similar to owning virtual real estate in a geographic zone.

Zone Revenue Distribution

Transaction

Agent executes in an H3 cell
(swap/bridge/task)

Zone Revenue Pool

0.25% micro-fee collected
per transaction

Distribution (daily epoch)

20% Protocol treasury
56% Land owner (70% of 80%)
24% Node sponsor (30% of 80%)

How to Claim a Cell

  1. Mint an iNFT on 0G Chain representing the H3 cell index.
  2. Call POST /v1/land/register with the h3_index and inft_token_id.
  3. All transactions in that cell automatically trigger micro-fee routing.
  4. Claim earnings each daily epoch via the land registry contract.
📝
Key values:
  • Micro-fee: _INFT_LAND_MICRO_FEE_BPS = 25 → 0.25% per transaction
  • Protocol cut: 20% of zone revenue
  • Land owner share: 70% of zone royalty pool
  • Node sponsor share: 30% of zone royalty pool
  • Epoch duration: 24 hours (UTC 00:00 – 23:59)

Spam Filter & H3 Reputation

Each agent × H3 cell pair has an independent rate-limit bucket. Exceeding 100 submissions per 100ms window counts as a violation. 5 violations triggers a slash (agent removed from discovery).

ParameterValueNotes
Window size100msSliding window per agent × cell pair
Max burst100 submissionsPer window
Violations → slash5Agent removed from H3 discovery index
Reputation scoremax(0, 100 − violations × 10)Decays with violations

Related Pages

H3 Location Capability →
How to activate H3 for your agent in Agentboard
Nitro Routing API →
QUIC node selection by H3 cell and exchange anchor
Full API Reference →
All endpoints in one place
← Cap Monitor Full API Reference →