Return to Main Landing Page
Developer Documentation & REPL Snippets

DAN Spatial Addressing Engineering Specs

Technical documentation detailing coordinate normalization, SHA-256 modulo math, geohash spatial acceleration, and JavaScript client integration.

Spatial Resolution

11cm Centroid Grid

Coordinate bounds are truncated to 6 decimal places (~0.000001°), establishing fixed sub-meter spatial cells.

Hash Space

10⁹ Permutation Space

Modulo 10⁹ mapping generates a 9-digit numeric hash suffix for high human memorability.

Country Scope

ITU Country Prefix

Prefixes 1 to 3 digits (e.g. +234 for Nigeria, +27 for South Africa) to provide global uniqueness.

JavaScript / TypeScript Reference Implementation

/**
 * DAN Deterministic Hash Generation (JavaScript / TypeScript)
 * Grid Precision: 11cm Centroid
 */
import { createHash } from 'crypto';

export function generateDanCode(lat: number, lng: number, countryPrefix: string = "234"): string {
    // 1. Snap coordinates to 6 decimal places (~11cm precision grid)
    const normLat = lat.toFixed(6);
    const normLng = lng.toFixed(6);
    const coordString = `${normLat},${normLng}`;

    // 2. SHA-256 Hash Generation
    const hash = createHash('sha256').update(coordString).digest('hex');

    // 3. Compute Modulo 10^9 to extract 9-digit numeric payload
    const numericHash = BigInt(`0x${hash.slice(0, 12)}`);
    const hashPart = (numericHash % BigInt(1000000000)).toString().padStart(9, '0');

    // 4. Construct complete global 12-digit DAN Code
    return `${countryPrefix}${hashPart}`;
}

Core REST API Endpoints

GET/api/v1/dans/resolve?lat=9.0437&lng=7.4692

Resolves coordinates to DAN code, address record, and verification status.

POST/api/v1/emergencies/sos

Broadcasts victim emergency payload to command center WebSocket and SMS dispatch.