공개 검증기

PAX 운영 원장(ledger)의 모든 이벤트는 해시 체인으로 연결되고, 머클 트리(Merkle tree)로 배치되며, 외부 변조 방지 저장소에 앵커링됩니다. 이 페이지는 검증자 서면을 공개하여 감사인, 투자자 또는 제3자 개발자가 PAX 지원에 문의하거나 PAX API를 신뢰하지 않고도 체인을 독립적으로 재구성하고 모든 체결(fill)의 포함을 확인할 수 있도록 합니다.

실시간 상태

GET /v1/audit/status에서 페이지 로드 시 새로고침됩니다. 카운트가 표시되면 체인이 실행 중입니다.

—
해시 체인 이벤트
로딩 중…
—
Merkle 배치
로딩 중…
—
앵커 지연(초)
마지막 R2 게시 이후 경과 시간
—
퍼블리셔 모드
R2 = Cloudflare 변조 방지 버킷

체인 모델

서로 독립적으로 제3자가 검증할 수 있는 3단계 변조 증거:

레이어 1 — 해시 체인 이벤트 로그(행 단위)

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는 원시 바이트가 아니라 64자의 소문자 hex 텍스트(TEXT)로 이어 붙입니다. payload를 직접 다시 직렬화하지 마세요. 받은 그대로의 canonical을 해시한 뒤, JSON.parse(canonical)로 그것이 커밋하는 필드를 읽습니다.

변조 감지: 과거의 어떤 행이든 수정하면 그 행의 event_hash와 이후 모든 행의 prev_event_hash가 깨집니다.

레이어 2 — Merkle 배치 루트(배치 단위, 약 60초 주기)

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)
}

알고리즘: 정렬된 원시 32바이트 다이제스트 쌍마다 SHA-256을 계산합니다(keccak256 아님). 노드 수가 홀수인 레벨은 마지막 노드를 복제합니다.

모든 원소가 32바이트 다이제스트이고 proof.length == ceil(log2(last_seq - first_seq + 1))일 때만 증명이 유효합니다. 증명 응답에는 leaf_count와 expected_proof_length도 들어 있습니다. 길이를 확인하지 않으면 트리의 내부 노드를 짧아진 증명과 함께 리프로 위장할 수 있으므로, 항상 길이를 확인하고 리프를 항상 이벤트에 연결하세요(레이어 1).

레이어 3 — 외부 앵커(Cloudflare R2)

모든 배치는 JSON 객체로 Cloudflare R2에 게시됩니다:

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, ... }

2026-11-22부터 해당 버킷은 pax-audit/ 접두사에 대한 쓰기 방지 잠금(write-once lock)이 적용됩니다. 즉, 고정된(anchored) 객체는 덮어쓰거나 삭제할 수 없습니다. 고정된 객체의 merkle_root를 /v1/audit/batches/{batch_num} 및 직접 재구축한 루트와 비교하십시오. anchor_ref는 내부 S3 주소이며(자격 증명이 필요하고 공개적으로 가져올 수 없음), anchor_public_url을 사용해야 합니다. HMAC 서명은 PAX를 키로 사용하므로 PAX는 변조를 감지할 수 있지만 제3자 증명은 아닙니다. 독립적이고 신뢰를 최소화하는 계층은 출시 후 계획된 Polygon 앵커입니다.

2026-11-22에 재게시된 배치

2026-11-22에 22,118개의 배치(batch)가 락(lock) 설정 전에 재발행되었습니다: 배치 1–21,990, 21,993과 22,465 사이의 125개 배치, 그리고 배치 31,071, 40,737, 45,318 (전체 목록). 해당 파일들은 잘못 구성된 비-프로덕션 퍼블리셔에 의해 덮어쓰여 복구할 수 없었으므로 저장된 이벤트로부터 재구축되었습니다. 각 재구축은 배치에 변경되지 않은 merkle_root에 대해 확인되었으며, 모든 이벤트 해시(hash)는 여전히 검증됩니다: 이벤트, 이벤트 해시 또는 머클 루트(Merkle root)는 변경되지 않았습니다. 다른 모든 배치의 앵커링된(anchored) 객체는 처음 발행된 객체와 바이트 단위로 동일합니다.

이 배치들의 앵커링된 객체는 updated_at과 대체된 파일의 다이제스트, 즉 previous_events_content_sha256, previous_events_r2_etag, previous_metadata_etag를 포함하며, 이 모두는 서명으로 보호됩니다. 2026-12-02 이후 /v1/audit/batches/{batch_num}의 anchor_proof는 현재의 events_content_sha256, events_r2_etag, metadata_etag, 세 개의 previous_* 값, 그리고 reanchored_at_ms로서의 재발행 시간을 동일하게 포함합니다. 그 이전에는 이 배치들에 대해 이전 파일의 다이제스트를 제공했습니다.

Verifier 엔드포인트(인증 불필요)

여섯 개의 엔드포인트 모두 공개, 읽기 전용이며 소스 IP별로 요청 한도가 적용됩니다. 응답 봉투는 trace_id를 포함하여 지원 디버깅에 사용되는 정형 {data, meta} 형식입니다.

엔드포인트목적
GET /v1/audit/head장부 헤드: 최신 머클 배치 {batch_num, last_seq, merkle_root, created_at_ms} + 총 이벤트 수 + last_event_at_ms.
GET /v1/audit/root현재 체인 팁 root 해시 + 기록 시점 + 각 배치의 외부 앵커 대상 (현재는 Cloudflare R2, 출시 후 Polygon 온체인 앵커).
GET /v1/audit/batches?limit=25최신순 Merkle 배치 페이지(batch_num, first_seq, last_seq, event_count, merkle_root, anchored_at); before=<next_before>로 페이지네이션.
GET /v1/audit/events/{seq}하나의 이벤트: payload, prev_event_hash, event_hash 및 canonical — sha256_hex(prev_event_hash + canonical) == event_hash를 확인합니다.
GET /v1/audit/proof/{seq}해당 이벤트의 Merkle 포함 증명: merkle_proof, leaf_index, leaf_count, expected_proof_length 및 배치(merkle_root, first_seq, last_seq, anchor_public_url).
GET /v1/audit/health체인 상태: 총 이벤트 수, 최신 타임스탬프, lag_ms(오래됨 지표), 외부 앵커 대상 ID.
GET /v1/audit/anchor/{batch_num}배치별 외부 앵커: anchor_target (현재 r2), anchored_at, anchor_proof 및 anchor_public_url (/v1/audit/anchor/{batch_num}/raw, 앵커링된 대상 자체). 온체인 컨트랙트 필드(chain, address, cadence)는 Polygon 앵커가 출시 후 배포되면 채워집니다.

인터랙티브 검증 데모

아래에 이벤트 seq를 입력하세요. 페이지는 이벤트와 해당 Merkle 포함 증명, 배치의 merkle_root를 가져오고, canonical 문자열로부터 이벤트의 event_hash를 재계산한 뒤, 포함 증명(정렬된 쌍 SHA-256, 정확한 증명 길이)을 WebCrypto를 사용하여 브라우저에서 완전히 검증합니다. 두 가지 검사는 모두 클라이언트 측에서 실행됩니다. 이 기능만으로는 API가 반환한 이벤트, 증명 및 배치 루트가 서로 일치하는지 확인할 수 있습니다. 독립적으로 확보한 루트(앵커링된 객체 또는 이전에 기록한 루트)와 대조하려면 선택 필드에 해당 값을 붙여넣으세요.

위 라이브 상태에 표시된 최신 seq를 시도해 보세요.

자체 코드에서 재현해 보세요

두 가지 검사, 모두 로컬에서 수행: (1) 리프가 실제로 이 이벤트인지 — sha256_hex(prev_event_hash + canonical) == event_hash; (2) 리프가 배치에 포함되는지 — 정확히 expected_proof_length개의 32바이트 요소로 구성된 포함 증명이 merkle_root를 재구성하는지.

타입스크립트 / 노드

// 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))

기본 curl + shasum (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 (온체인)

// 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;
}

이것이 귀하에게 증명하는 것

불일치 보고. 독립적 검증 결과 불일치가 발생하면, 이벤트 seq, 계산된 해시, 예상 해시를 포함하여 Request access에서 티켓을 개설해 주세요. 모든 정당한 불일치 보고는 24시간 이내에 조사됩니다.