Public Verifier

Every event in the PAX operational ledger is hash-chained, batched into a Merkle tree, and anchored to external tamper-evident storage. This page exposes the verifier surface so any auditor, investor, or third-party developer can independently reconstruct the chain and confirm inclusion for any fill — without contacting PAX support and without trusting the PAX API.

Live status

Refreshes on page load from GET /v1/audit/status. If you see counts, the chain is running.

—
Hash-chained events
loading…
—
Merkle batches
loading…
—
Anchor lag (seconds)
time since last R2 publish
—
Publisher mode
R2 = Cloudflare tamper-evident bucket

The chain model

Three layers of tamper evidence, each independently verifiable by third parties:

Layer 1 — Hash-chained event log (row-level)

event_log {
  seq             — monotonically increasing sequence number
  event_type      — canonical event name (e.g. fast_round.commit, order.filled)
  payload         — the full event body (JSON)
  prev_event_hash — event_hash of the previous event (64 zeros for seq 1)
  event_hash      — sha256_hex( utf8( prev_event_hash + canonical ) )
  canonical       — the exact string that was hashed, returned verbatim by
                    GET /v1/audit/events/{seq} (Postgres jsonb text of
                    {event_id, seq, event_type, payload, idempotency_key,
                     created_at (UTC, microseconds), emitter, schema_version})
}

prev_event_hash is concatenated as its 64-character lowercase hex TEXT, not as raw bytes. Do not re-serialise payload yourself — hash canonical as given, then JSON.parse(canonical) to read the fields it commits to.

Tamper-detection: modifying any past row breaks event_hash for that row AND prev_event_hash for every subsequent row.

Layer 2 — Merkle-batched roots (batch-level, ~60s cadence)

event_batches {
  batch_num       — monotonically increasing batch number
  first_seq       — inclusive lower bound
  last_seq        — inclusive upper bound
  event_count     — number of leaves
  merkle_root     — sorted-pair SHA-256 over the batch's event_hash values
                    (each hash decoded to its raw 32 bytes before hashing, NOT the hex string)
  prev_batch_hash — the previous batch's merkle_root (64 zeros for batch 1)
}

Algorithm: SHA-256 over each sorted pair of raw 32-byte digests (not keccak256); an odd level duplicates its last node.

A proof is valid only if every element is a 32-byte digest AND proof.length == ceil(log2(last_seq - first_seq + 1)) — the proof response also carries leaf_count and expected_proof_length. Without the length check an internal node of the tree could be passed off as a leaf with a shortened proof, so always check it, and always bind the leaf to the event (Layer 1).

Layer 3 — External anchor (Cloudflare R2)

Every batch is published to Cloudflare R2 as a JSON object:

Key:  pax-audit/batches/{batch_num}.json
Read: GET /v1/audit/anchor/{batch_num}/raw  (anchor_public_url)
Body: { batch_num, merkle_root, prev_batch_hash, first_seq, last_seq,
        event_count, created_at, pax_version, sig_algo, sig_key_id, ... }

Since 2026-11-22 the bucket carries a write-once lock on the pax-audit/ prefix: an anchored object cannot be overwritten or deleted. Compare merkle_root in the anchored object with /v1/audit/batches/{batch_num} and with the root you rebuilt. anchor_ref is the internal S3 address (it needs credentials and is not publicly fetchable); use anchor_public_url. The HMAC signature is keyed by PAX, so it lets PAX detect tampering but is not a third-party proof — the independent, trust-minimised layer is the Polygon anchor planned post-launch.

Batches re-published on 2026-11-22

22,118 batches were re-published on 2026-11-22, before the lock was set: batch 1–21,990, 125 batches between 21,993 and 22,465, and batches 31,071, 40,737 and 45,318 (full list). Their files had been overwritten by a misconfigured non-production publisher and could not be recovered byte for byte, so they were rebuilt from the stored events. Each rebuild was checked against the batch's unchanged merkle_root, and every event hash still verifies: no event, event hash or Merkle root changed. Every other batch's anchored object is byte-identical to the one first published.

For these batches the anchored object carries updated_at and the digests of the file it replaced, previous_events_content_sha256, previous_events_r2_etag and previous_metadata_etag, all covered by the signature. Since 2026-12-02 anchor_proof in /v1/audit/batches/{batch_num} carries the same: the current events_content_sha256, events_r2_etag and metadata_etag, the three previous_* values, and the re-publish time as reanchored_at_ms. Before that, it still gave the earlier file's digests for these batches.

Verifier endpoints (no auth required)

All six endpoints are public, read-only, and rate-limited per source IP. Response envelope is the canonical {data, meta} shape with trace_id for support debugging.

EndpointPurpose
GET /v1/audit/headLedger head: newest Merkle batch {batch_num, last_seq, merkle_root, created_at_ms} + total event count + last_event_at_ms.
GET /v1/audit/rootCurrent chain-tip root hash + when it was written + the external anchor target each batch is published to (Cloudflare R2 today; Polygon on-chain anchor post-launch).
GET /v1/audit/batches?limit=25Newest-first page of Merkle batches (batch_num, first_seq, last_seq, event_count, merkle_root, anchored_at); page with before=<next_before>.
GET /v1/audit/events/{seq}One event: payload, prev_event_hash, event_hash and canonical — check sha256_hex(prev_event_hash + canonical) == event_hash.
GET /v1/audit/proof/{seq}Merkle inclusion proof for that event: merkle_proof, leaf_index, leaf_count, expected_proof_length and the batch (merkle_root, first_seq, last_seq, anchor_public_url).
GET /v1/audit/healthChain status: total events, latest timestamp, lag_ms (staleness gauge), external-anchor target identity.
GET /v1/audit/anchor/{batch_num}Per-batch external anchor: anchor_target (r2 today), anchored_at, anchor_proof and anchor_public_url (/v1/audit/anchor/{batch_num}/raw, the anchored object itself). The on-chain contract fields (chain, address, cadence) populate once the Polygon anchor ships post-launch.

Interactive verify demo

Enter an event seq below. The page will fetch the event + its Merkle inclusion proof + the batch's merkle_root, recompute the event's event_hash from its canonical string, and verify the inclusion proof (sorted-pair SHA-256, exact proof length) entirely in your browser with WebCrypto. Both checks run client-side. On its own this shows the event, proof and batch root the API returned agree with each other; to check against a root you obtained independently (the anchored object, or a root you recorded earlier), paste it in the optional field.

Try the latest seq shown in Live status above.

Reproduce it in your own code

Two checks, both local: (1) the leaf is really this event — sha256_hex(prev_event_hash + canonical) == event_hash; (2) the leaf is in the batch — the inclusion proof, of exactly expected_proof_length 32-byte elements, rebuilds merkle_root.

TypeScript / Node

// npm i @predictasiax/api@3     (3.0.0+: length check + event-hash check)
import { PaxClient, AuditResource, expectedProofLength } from '@predictasiax/api';

const pax = new PaxClient();            // audit endpoints need no key

// One call: event hash, same event, seq in batch, proof length, Merkle root
const r = await pax.audit.verify(110841);
console.log(r.ok, r.checks);

// Or step by step
const ev = await pax.audit.getEvent(110841);
const proof = await pax.audit.getProof(110841);
const n = proof.batch.last_seq - proof.batch.first_seq + 1;
const leafOk = AuditResource.verifyEventHash(ev);   // sha256(prev_event_hash + canonical)
const inBatch = AuditResource.verifyProof(          // sync; verifyProofAsync for WebCrypto
  ev.event_hash, proof.batch.merkle_root, proof.merkle_proof, expectedProofLength(n),
);

Python

# pip install "pax-api>=3"      (3.0.0+: length check + event-hash check)
from pax_api import PaxClient, expected_proof_length, verify_event_hash, verify_merkle_proof

pax = PaxClient()                       # audit endpoints need no key

r = pax.verify_audit_event(110841)      # all checks in one call
print(r["ok"], r["checks"])

ev = pax.audit_event(110841)["data"]
proof = pax.audit_proof(110841)["data"]
n = proof["batch"]["last_seq"] - proof["batch"]["first_seq"] + 1
leaf_ok = verify_event_hash(ev)
in_batch = verify_merkle_proof(ev["event_hash"], proof["batch"]["merkle_root"],
                               proof["merkle_proof"], expected_proof_length(n))

Bare curl + shasum (no SDK)

SEQ=110841
API=https://api.predictasiax.com/v1/audit

# 1. The leaf is this event: sha256(prev_event_hash + canonical) == event_hash
curl -s $API/events/$SEQ > ev.json
printf '%s%s' "$(jq -r .data.prev_event_hash ev.json)" "$(jq -r .data.canonical ev.json)" \
  | shasum -a 256 | cut -c1-64        # must equal: jq -r .data.event_hash ev.json

# 2. The leaf is in the batch (sorted-pair sha256 over the RAW 32-byte digests)
curl -s $API/proof/$SEQ > proof.json
verify() {   # verify LEAF ROOT EXPECTED_LEN SIBLING...
  local h=$1 root=$2 want=$3; shift 3
  [[ $# -eq $want ]] || { echo "MISMATCH: proof length $# != $want"; return 1; }
  for s in "$@"; do
    [[ $s =~ ^[0-9a-f]{64}$ ]] || { echo "MISMATCH: bad element"; return 1; }
    if [[ "$h" < "$s" ]]; then pair="${h}${s}"; else pair="${s}${h}"; fi
    # xxd -r -p decodes the 128 hex chars to the 64 raw bytes BEFORE hashing.
    h=$(printf '%s' "$pair" | xxd -r -p | shasum -a 256 | cut -c1-64)
  done
  [[ "$h" == "$root" ]] && echo OK || echo MISMATCH
}
verify $(jq -r '.data.event_hash, .data.batch.merkle_root, (.data.batch.last_seq - .data.batch.first_seq + 1 | if . <= 1 then 0 else (log2 | ceil) end)' proof.json) \
       $(jq -r '.data.merkle_proof[]' proof.json)

Solidity (on-chain)

// PAX anchors with SHA-256 sorted-pair. OpenZeppelin's MerkleProof.verify
// hashes with keccak256, so it will NOT match these roots — use the SHA-256
// verifier below. abi.encodePacked lays the two bytes32 down as 64 raw bytes
// and the sha256 precompile hashes those raw bytes — identical to the publisher.
// root, firstSeq and lastSeq must come from the anchored batch you trust (the
// anchored object, or a root your contract already stores), never from the
// proof response alone: whoever serves the proof also chooses those values.
// The proof length is derived here from the batch bounds and checking it is
// REQUIRED: a shorter proof would let an internal node of the tree pass as a
// leaf. Bind the leaf to the event off-chain (Layer 1) or by recomputing
// event_hash on-chain before calling this.
function paxProofLength(uint256 leafCount) internal pure returns (uint256 len) {
  uint256 width = leafCount;      // an odd level duplicates its last node
  while (width > 1) { width = (width + 1) / 2; len++; }
}

function verifyPaxEvent(
  bytes32 leaf,               // event_hash from /v1/audit/proof/{seq}
  bytes32[] calldata proof,   // merkle_proof array
  uint256 seq,                // the event's seq
  bytes32 anchoredRoot,       // merkle_root of the anchored batch
  uint256 firstSeq,           // first_seq of the anchored batch
  uint256 lastSeq             // last_seq of the anchored batch
) public pure returns (bool) {
  if (firstSeq == 0 || firstSeq > seq || seq > lastSeq) return false;
  if (proof.length != paxProofLength(lastSeq - firstSeq + 1)) return false;
  bytes32 h = leaf;
  for (uint256 i = 0; i < proof.length; i++) {
    bytes32 s = proof[i];
    h = h <= s
      ? sha256(abi.encodePacked(h, s))
      : sha256(abi.encodePacked(s, h));
  }
  return h == anchoredRoot;
}

What this proves for you

Reporting a discrepancy. If your independent verification produces a mismatch, please open a ticket at Request access with the event seq, the computed hash, and the expected hash. Every legitimate discrepancy report is investigated within 24h.