ทุกเหตุการณ์ในบัญชีปฏิบัติการของ PAX จะถูกเชื่อมโยงด้วยแฮช (hash-chained) จัดกลุ่มเป็น Merkle tree และยึดโยงกับพื้นที่จัดเก็บภายนอกที่ป้องกันการแก้ไขข้อมูล (tamper-evident storage) หน้านี้เปิดใช้งานส่วนตรวจสอบ (verifier surface) เพื่อให้ผู้ตรวจสอบบัญชี นักลงทุน หรือผู้พัฒนาบุคคลที่สาม สามารถสร้างลำดับข้อมูลใหม่และยืนยันการรวมข้อมูลของการจับคู่คำสั่งใด ๆ ได้อย่างอิสระ โดยไม่ต้องติดต่อฝ่ายสนับสนุนของ PAX และโดยไม่ต้องไว้วางใจ API ของ PAX
รีเฟรชเมื่อโหลดหน้าจาก GET /v1/audit/status หากคุณเห็นจำนวนข้อมูล แสดงว่าเชนกำลังทำงานอยู่
หลักฐานการป้องกันการแก้ไขข้อมูลสามชั้น ซึ่งแต่ละชั้นสามารถตรวจสอบได้โดยบุคคลที่สามอย่างอิสระ:
ชั้นที่ 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 ถูกนำมาต่อกันในรูปข้อความ hex ตัวพิมพ์เล็กยาว 64 อักขระ (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)
}
อัลกอริทึม: คำนวณ SHA-256 กับไดเจสต์ดิบขนาด 32 ไบต์ทีละคู่ที่เรียงลำดับแล้ว (ไม่ใช่ keccak256) ระดับที่มีจำนวนโหนดเป็นเลขคี่จะทำสำเนาโหนดสุดท้าย
proof จะถูกต้องก็ต่อเมื่อทุกองค์ประกอบเป็นไดเจสต์ขนาด 32 ไบต์ และ proof.length == ceil(log2(last_seq - first_seq + 1)) เท่านั้น การตอบกลับของ proof ยังมี leaf_count และ expected_proof_length ด้วย หากไม่ตรวจความยาว โหนดภายในของทรีอาจถูกแอบอ้างเป็นใบด้วย proof ที่สั้นลง จึงต้องตรวจความยาวทุกครั้ง และผูกใบกับเหตุการณ์ทุกครั้ง (ชั้นที่ 1)
ชั้นที่ 3 — จุดยึดภายนอก (Cloudflare R2)
ทุกแบตช์จะถูกเผยแพร่ไปยัง Cloudflare R2 ในรูปออบเจ็กต์ JSON:
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 บัคเก็ตมีการล็อกแบบเขียนครั้งเดียวบน prefix pax-audit/: วัตถุที่ถูกปักหมุด (anchored object) จะไม่สามารถเขียนทับหรือลบได้ เปรียบเทียบ merkle_root ในวัตถุที่ถูกปักหมุดกับ /v1/audit/batches/{batch_num} และกับ root ที่คุณสร้างขึ้นใหม่ anchor_ref คือที่อยู่ S3 ภายใน (ต้องใช้ข้อมูลประจำตัวและไม่สามารถดึงข้อมูลแบบสาธารณะได้) ให้ใช้ anchor_public_url ลายเซ็น HMAC ถูกเข้ารหัสด้วย PAX ดังนั้นจึงช่วยให้ PAX ตรวจจับการแก้ไขได้ แต่ไม่ใช่การพิสูจน์โดยบุคคลที่สาม เลเยอร์อิสระที่ลดความน่าเชื่อถือคือ Polygon anchor ที่วางแผนไว้หลังการเปิดตัว
ชุดข้อมูล (Batches) ที่เผยแพร่ซ้ำเมื่อ 2026-11-22
มีการเผยแพร่แบตช์ใหม่ 22,118 แบตช์เมื่อวันที่ 2026-11-22 ก่อนที่จะมีการตั้งค่าการล็อก: แบตช์ 1–21,990, 125 แบตช์ระหว่าง 21,993 ถึง 22,465 และแบตช์ 31,071, 40,737 และ 45,318 (รายการทั้งหมด) ไฟล์ของแบตช์เหล่านี้ถูกเขียนทับโดย Publisher ที่ไม่ได้ตั้งค่าการผลิตอย่างถูกต้องและไม่สามารถกู้คืนได้ทีละไบต์ ดังนั้นจึงถูกสร้างขึ้นใหม่จากเหตุการณ์ที่จัดเก็บไว้ การสร้างใหม่แต่ละครั้งได้รับการตรวจสอบกับ merkle_root ของแบตช์ที่ไม่เปลี่ยนแปลง และแฮชของเหตุการณ์ทั้งหมดก็ยังคงตรวจสอบได้: ไม่มีเหตุการณ์, แฮชของเหตุการณ์ หรือ Merkle root ที่เปลี่ยนแปลง วัตถุที่ปักหมุดของแบตช์อื่นๆ ทั้งหมดเหมือนกันทุกประการกับวัตถุที่เผยแพร่ครั้งแรก
สำหรับแบตช์เหล่านี้ อ็อบเจกต์ที่ถูกยึด (anchored object) จะมี updated_at และค่าแฮชของไฟล์ที่ถูกแทนที่ ได้แก่ previous_events_content_sha256, previous_events_r2_etag และ previous_metadata_etag ซึ่งทั้งหมดอยู่ภายใต้ลายเซ็น ตั้งแต่วันที่ 2026-12-02 เป็นต้นไป anchor_proof ใน /v1/audit/batches/{batch_num} จะมีข้อมูลเดียวกันนี้ คือ events_content_sha256, events_r2_etag และ metadata_etag ปัจจุบัน, ค่า previous_* ทั้งสามค่า และเวลาที่เผยแพร่ซ้ำเป็น reanchored_at_ms ก่อนหน้านั้น ระบบยังคงให้ค่าแฮชของไฟล์ก่อนหน้าสำหรับแบตช์เหล่านี้
endpoint ทั้งหกเป็นสาธารณะ อ่านอย่างเดียว และมีขีดจำกัดอัตราคำขอตาม IP ต้นทาง การตอบกลับมีโครงสร้าง {data, meta} มาตรฐาน พร้อม trace_id สำหรับดีบักการสนับสนุน
| Endpoint | วัตถุประสงค์ |
|---|---|
GET /v1/audit/head | Ledger head: Merkle batch ล่าสุด {batch_num, last_seq, merkle_root, created_at_ms} + จำนวน event ทั้งหมด + last_event_at_ms. |
GET /v1/audit/root | แฮช root ของ chain-tip ปัจจุบัน + เวลาที่เขียน + เป้าหมายการยึดโยงภายนอกที่แต่ละชุดข้อมูลถูกเผยแพร่ไป (ปัจจุบันคือ Cloudflare R2; หลังเปิดตัวคือ on-chain anchor บน Polygon) |
GET /v1/audit/batches?limit=25 | หน้าล่าสุดก่อนของ Merkle batches (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 inclusion proof สำหรับเหตุการณ์นั้น: merkle_proof, leaf_index, leaf_count, expected_proof_length และ batch (merkle_root, first_seq, last_seq, anchor_public_url). |
GET /v1/audit/health | สถานะเชน: จำนวนเหตุการณ์ทั้งหมด, timestamp ล่าสุด, lag_ms (มาตรวัดความล้าสมัย), ตัวระบุเป้าหมายของ external-anchor |
GET /v1/audit/anchor/{batch_num} | External anchor ต่อ batch: anchor_target (r2 ในปัจจุบัน), anchored_at, anchor_proof และ anchor_public_url (/v1/audit/anchor/{batch_num}/raw, ตัว object ที่ถูก anchor เอง) ฟิลด์ของสัญญาบนเชน (chain, address, cadence) จะถูกเติมข้อมูลเมื่อ Polygon anchor ถูกปล่อยออกหลังการเปิดตัว |
กรอกค่า seq ของ event ด้านล่าง หน้าเพจจะดึงข้อมูล event พร้อม Merkle inclusion proof และ merkle_root ของ batch แล้วคำนวณ event_hash ของ event ใหม่จากสตริง canonical และตรวจสอบ inclusion proof (SHA-256 ของคู่ที่เรียงลำดับแล้ว ความยาว proof ตรงตามกำหนด) ทั้งหมดในเบราว์เซอร์ของคุณด้วย WebCrypto การตรวจสอบทั้งสองขั้นตอนทำงานฝั่ง client อย่างเดียว ในตัวนี้แสดงว่า event, proof และ batch root ที่ API ส่งกลับมีความสอดคล้องกัน หากต้องการตรวจสอบกับ root ที่คุณได้มาอย่างอิสระ (anchored object หรือ root ที่คุณบันทึกไว้ก่อนหน้านี้) ให้วางค่าลงในฟิลด์ตัวเลือก
การตรวจสอบสองขั้นตอน ซึ่งดำเนินการในระดับ local ทั้งหมด: (1) ใบ (leaf) นี้คือเหตุการณ์นี้จริงหรือไม่ — sha256_hex(prev_event_hash + canonical) == event_hash; (2) ใบนี้อยู่ในชุดข้อมูล (batch) หรือไม่ — inclusion proof ซึ่งประกอบด้วยองค์ประกอบขนาด 32 ไบต์จำนวนเท่ากับ expected_proof_length พอดี สามารถสร้าง 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),
);
# 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))
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)
// 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;
}
event_log. หากแอปของคุณเป็นผู้ route คำสั่งซื้อขายนั้น payload ของ event จะประกอบด้วย execution_builder_id ของคุณ — ซึ่งตรวจสอบได้สาธารณะผ่าน /v1/audit/events/{seq}.computeFeeSplit ใน apps/api/src/index.ts) จะเขียนแถว financial_event แบบ idempotent โดยใช้ key เป็น fee_split:<trade_id>:<event_type>. คำสั่งซื้อขายเดียวกันไม่สามารถถูกนับซ้ำได้แม้ในสถานการณ์ retry จำนวนมากPOST /v1/fees/estimate และเส้นทางของการชำระบัญชีเมื่อมีการจับคู่คำสั่งต่างเรียกใช้ฟังก์ชัน computeFeeSplit เดียวกันพร้อมค่าคงที่ PAF_BASE_BPS / PAF_FLOOR_BPS / PAF_CEILING_BPS เดียวกัน การประมาณที่คืนกลับก่อนการเทรดของคุณใช้คณิตศาสตร์ที่เหมือนกันกับการชำระบัญชี — ความคลาดเคลื่อนจะเกิดขึ้นได้ก็ต่อเมื่อ API ต้องรันสอง build ที่แตกต่างกันพร้อมกัน ซึ่ง pipeline การ deploy ห้ามไว้api.predictasiax.com จะถูกเจาะระบบ ออราเคิลทางประวัติศาสตร์ (historical anchors) ก็ยังช่วยให้ผู้ตรวจสอบสามารถตรวจจับการเขียนทับเหตุการณ์ในอดีตได้seq ของเหตุการณ์, hash ที่คำนวณได้, และ hash ที่คาดหวัง รายงานความไม่ตรงกันที่ถูกต้องทุกฉบับจะถูกตรวจสอบภายใน 24h
ตั้งแต่ {date}
{n} ยึดกับ R2
ออฟไลน์
กรุณากรอก seq ที่ถูกต้อง (จำนวนเต็มบวก)
Anchored root ต้องมี 64 ตัวอักษร hex.
กำลังดึงข้อมูล event + proof จาก api.predictasiax.com …
ขีดจำกัดอัตราคำขอ — ลองใหม่ใน {s}s
VERIFIED ต่อกับ anchored root ที่คุณให้มา. Event seq {seq} มีค่า hash เป็น event_hash และรวมอยู่ใน batch #{batch} (merkle_root {root}…).
SELF-CONSISTENT. Event seq {seq} มีค่า hash เป็น event_hash และรวมอยู่ใต้ราก batch ที่ API ส่งกลับ (batch #{batch}, merkle_root {root}…). วางรากที่คุณได้รับอย่างอิสระเพื่อเปรียบเทียบกับมัน.
MISMATCH ({reason}) — กรุณารายงาน seq นี้ไปยัง [email protected]
event_hash ไม่ตรงกับเหตุการณ์มาตรฐาน
ขอบเขตของ batch ไม่ครอบคลุม seq นี้
Merkle inclusion proof ไม่ได้สร้าง batch root ซ้ำ
batch root ไม่ตรงกับ anchored root ที่คุณระบุไว้