Getting Started (Timeverse v4.6)

Build a time‑bound application with tick‑canonical windows, signed requests, anti‑replay, TSAE receipts, and optional HS‑Carbon, T‑WATCH witness, and Clockchain anchoring (v4.6-compatible).

Reference Flow

Frontend
SignedTemporalRequest
Gateway
TSAE Receipt
Audit / Anchor

timeverse.ma

Core documentation, API Reference, and Protocol Kernels.

binutecoin.com

Explorer & Wallet UI for Clockchain anchors and block finality.

harmonysegment.com

T‑WATCH device site (optional physical witness).

What you get

Deterministic time windows (ticks, integer‑only)
Signed requests (Ed25519, canonical JSON)
Anti‑replay protection (nonce horizon)
Signed audit receipts (TSAE) ready for anchoring
Optional HS‑Carbon gating (fixed‑point integers)
Optional T‑WATCH witness (signed device observation bound to anchor)
Offline Autonomy: No continuous cloud connection required
0

Prerequisites

  • Next.js app (or any web backend)
  • Timeverse SDK (reference implementation)
  • Node 18+ recommended
Resilience First
The Timeverse SDK is fully autonomous. Once configured, it calculates the protocol state locally, ensuring your app remains functional even if timeverse.ma is unreachable.
1

Key Concepts (MUST READ)

Tick‑canonical windows

Timeverse uses integer ticks instead of floats to avoid boundary ambiguity.

d_ticks(a,b) = min(|a-b|, R - |a-b|)
in_window ⇔ d_ticks(phi_now, phi_center) ≤ deltaPhi_ticks

No‑Float rule

Enforcement logic MUST NOT use floats. Floats are strictly for display (UI).

Canonicalization (TV-CANON-JSONSORT-2026-01)

Signatures MUST be computed over UTF-8 JSON with sorted keys and no extra whitespace.

Handling Big Integers (u64)

JavaScript cannot safely represent integers > 2^53-1. Any u64 field MUST be encoded as a decimal string.

Example u64 string encoding
{ 
  "estimated_emissions_mgco2_u64_str": "123456789012345" 
}
2

Configure your app

Add environment variables to your .env file:

.env
TIMEVERSE_API_KEY="dev-key"
TIMEVERSE_CONVENTION_ID="TV-CONV-EARTH-2026-01:DAILY;timescale=TV_MONO_NOLEAP;t0=1663912800;T_cycle=86400;encoding=ticks;R=86400;boundary=inclusive_le"
TIMEVERSE_SWT_ZONE="12"
TIMEVERSE_TILE_ID="600"

Instantiate the client:

lib/timeverse.ts
import { TimeverseClient } from '@/lib/timeverse/client';

export const timeverse = new TimeverseClient({
  apiKey: process.env.TIMEVERSE_API_KEY,
  conventionId: process.env.TIMEVERSE_CONVENTION_ID,
});
3

Get the current Timeverse state

Public

Use the public API to render UI and align agents:

Usage
const state = await fetch('/api/timeverse/state').then(r => r.json());
// Current state includes day_index, phi_ticks, hs_local, binute

3B) Fetch pinned keys (recommended)

Offline verification requires pinning SecProf and Clockchain agent keys. Pinned keys are usually served from /api/v1/keys.

Expected keys format
{
  "schema":"TV-KEYS-2026-01",
  "security_profile_id":"TV-SP-2026-BASELINE-v1",
  "secprof_allowlist":[
    {"node_id":"ORCH","public_key_raw_hex":"..."},
    {"node_id":"T-WATCH-7421","public_key_raw_hex":"..."}
  ]
}
4

Issue a server challenge

Freshness Rule
Browsers do not have a trustworthy monotone clock. A server-issued challenge provides robust freshness.
API Route: /api/v1/challenge
{
  "schema":"TV-TEMPORAL-CHALLENGE-2026-01",
  "day_index":1240,
  "phi_ticks":59318,
  "ttl_s_u32":120,
  "nonce_rand_128_hex":"..."
}
5

Create a SignedTemporalRequest

The frontend creates an intent locked in a specific tick window:

Frontend Logic
async function sendSecureAction(payload: any) {
  const challenge = await fetch('/api/v1/challenge').then(r => r.json());

  const req = await timeverse.createSignedRequest({
    scope: 'demo.action.example',
    payload,
    // tick window, integer-only
    deltaPhiTicks: 120, // ±120 ticks
    // bind to challenge for freshness
    challenge,
    swtZone: 12,
    tileId: 600,
  });

  return fetch('/api/secure-action', {
    method: 'POST',
    body: JSON.stringify(req),
  });
}
6

Verify on the server (Gateway)

Wrap your API routes with the Timeverse gateway middleware:

api/secure-action.ts
import { timeverseGateway } from '@/lib/timeverse/gateway';
import { NextResponse } from 'next/server';

const handler = async (req, enriched) => {
  // 1. Signature valid?
  // 2. Identity pinned?
  // 3. Tick window satisfied?
  // 4. Nonce not replayed?
  
  return NextResponse.json({ ok: true });
};

export const POST = timeverseGateway(handler);
7

Generate a TSAE receipt

A TSAE is your compliance artifact. It proves exactly when, where and under which policy an action happened.

TSAE Core (int-only)
{
  "tsae_schema":"TV-TSAE-2025-12",
  "scope":"tsae.now.trust",
  "day_index":1240,
  "phi_action_ticks":59340,
  "fidelity_u16":61000,
  "action_hash_hex":"<sha256_hex>"
}
8

Advanced Options

HS‑Carbon Gating

Enforce energy-aware execution thresholds using fixed-point integers (mWh, mgCO2/kWh).

T‑WATCH Witness

Include a physical device witness signature bound to your anchor hash for maximum non-repudiation.

9

Anchor into Clockchain

Enterprise

Create permanent audit trails by anchoring receipt hashes.

anchor_hash = sha256(canonical_json(tsae_or_anchor_envelope))

Submit via POST /v1/clockchain/anchor and verify with Merkle inclusion proofs.

Common errors & Fixes

STALE_PHASEIncrease deltaPhi_ticks or ensure the server uses monotone arithmetic time.
REPLAY_DETECTEDEach request must have a unique nonce/challenge pair.
CONTEXT_MISMATCHVerify that day_index and swt_zone match the signature envelope.
FLOATS_REJECTEDUse integers, fixed-point fields (_u16), or decimal strings (_u64_str).

Ready to go deeper?