PAX 市場如何結算,以及 oracle API:用平台餘額中的 PAX 鎖定保證金,提出結果、挑戰提案。全部 curl,無需 SDK。
https://api.predictasiax.com — 與交易使用同一主機。公開讀取不需要金鑰;寫入需要具有 oracle:write 權限範圍的 api-key。與交易 API 不同,預言機回應直接回傳(不包裝在 { data, meta } 信封中)。提供者與證明的公開讀取不包含帳戶 id。
市場關閉後,平台預言機提出結果。該結果在賠付前公開 2 小時;任何人都可以鎖定 PAX 保證金發起挑戰,挑戰由獨立回放自動裁決。預言機無法判定的市場,任何人都可以鎖定 PAX 保證金提出結果,該提案開放挑戰 24 小時。兩者都可在 predictasiax.com/dispute 或透過本 API 完成,使用你平台餘額中的 PAX。
API 與爭議頁面是同一流程的兩個入口:在這裡提出的提案或挑戰,與在頁面上提出的完全相同,保證金規模、自動裁決與賠付都一樣。沒有任何人手動決定結果。
att_<n>)— 針對某個市場提出的結果。proposed_by 為 oracle(平台預言機的提案,挑戰期 2 小時)或 community(帳戶鎖定保證金的提案,挑戰期 24 小時)。挑戰期在 liveness_expires_at_ms 結束。chl_<n>)— 針對進行中證明鎖定的 PAX 保證金。你不需要指定結果:獨立回放會根據資料來源重新結算該市場,判斷提出的結果是否成立。證明的 state:
open — 挑戰期間進行中。final — 挑戰期已結束,且每項挑戰都已有裁決。resolved_outcome 是將被賠付的結果:即提出的結果,或挑戰成立時修正後的結果。settled — 市場已透過 resolved_outcome 完成賠付。superseded — 撤回且不賠付;原因見 resolution_note。被挑戰且獨立回放無法確認的社群證明會進入此狀態,市場交回預言機處理。保證金從你平台餘額(你的 predictasiax.com 帳戶)中的 PAX 鎖定,結果確定後自動退還或沒收。鎖定期間不發生任何轉帳。
你下一筆保證金的確切金額一律見 GET /v1/oracle/bond-account 的 next_bond_pax,實際鎖定的保證金是證明或挑戰上的 bond_pax。
提案者保證金的處理方式:
bond_state released)。forfeited)。split)。挑戰保證金的處理方式(verdict):
shadow_correct — 挑戰成立:保證金將全額退還,市場將以 corrected_outcome 進行賠付。primary_correct — 獨立回放確認了提出的結果:保證金被沒收。ambiguous — 獨立回放無法判定:退還 50% 的保證金。本不應被受理的挑戰會以全額退款結束。被沒收的 PAX 歸平台。沒有額外獎勵:提案或挑戰成立時,退還其保證金。
寫入端點(註冊、提案、挑戰)需要具有 oracle:write 權限範圍的 oracle api-key;讀取你自己的保證金帳戶只需任何有效的 api-key。兩種方式皆可傳送:
-H "Authorization: Bearer sk_live_..." # or, equivalently:
-H "X-API-Key: sk_live_..."
公開讀取(提供者、證明、可提案市場)不需要金鑰。api-key 綁定到你的 PAX 使用者;閘道會從金鑰解析你的身分,並忽略客戶端自行提供的 X-PAX-User-Id 標頭。保證金從該使用者的平台餘額支付,因此金鑰必須在登入 predictasiax.com 的狀態下產生,否則寫入會回傳 403 PLATFORM_ACCOUNT_REQUIRED。與交易 api-key 相同,oracle 金鑰不需要交易 PIN:任何持有它的人都能用你的 PAX 鎖定保證金,請像保管交易金鑰一樣保管它。
金鑰是針對你的平台登入身分產生的。最簡單的路徑是在 Builder 入口網站 中的 Oracle Provider 控制台——登入後,開啟 Oracle Provider,然後點擊產生。金鑰只會顯示一次;請立即複製。
以程式方式操作時,請使用平台會話或 Builder Portal 會話權杖進行鑄造(不可使用 api-key,也不可第三方應用程式收到的 OAuth 權杖):
curl -X POST https://api.predictasiax.com/v1/provider/keys \
-H "Authorization: Bearer <your platform session token>" \
-H "Content-Type: application/json" \
-d '{"name":"my-resolver"}'
回應 — 立即複製 key,它只會顯示一次:
{
"key": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"key_prefix": "sk_live_a1b2c3",
"scopes": ["oracle:write", "read"],
"name": "my-resolver",
"note": "store this key now; it is shown only once"
}
# Save it:
export OK=sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
每位使用者最多可持有 5 個活躍金鑰。使用 GET /v1/provider/keys 列出它們,並使用 DELETE /v1/provider/keys/{id} 撤銷其中一個(僅限中繼資料——密鑰資料絕不會再次返回)。
提供者是公開的結算方身分。使用其 provider_id 提出的提案會計入它的公開紀錄;不使用提供者也可以提案和挑戰。adapter_kind 為 feed、official_source、regional_data 或 manual 之一;display_name 為 1–80 個字元。每個帳戶限一個提供者。
curl -X POST https://api.predictasiax.com/v1/oracle/providers \
-H "Authorization: Bearer $OK" \
-H "Content-Type: application/json" \
-d '{
"display_name": "Acme Regional Desk",
"adapter_kind": "regional_data"
}'
回應 — 201 與你的新供應商:
{
"id": "ovp_9f8e7d6c5b4a39281706f5e4d3c2b1a0",
"user_id": "usr_0011223344556677889900aabbccddee",
"display_name": "Acme Regional Desk",
"adapter_kind": "regional_data",
"status": "active",
"staked_pax": "0",
"attestations_total": "0",
"disputed_total": "0",
"slashed_total": "0",
"rewards_pax": "0",
"created_at_ms": 1796274000000,
"updated_at_ms": 1796274000000
}
每次變化後約一分鐘內更新:attestations_total 為使用該提供者提出的提案數,staked_pax 為其中仍鎖定的 PAX,disputed_total 為其中被挑戰的數量,slashed_total 為保證金被沒收或按比例拆分的數量。rewards_pax 始終為 0(沒有額外獎勵)。任何人都可以用 GET /v1/oracle/providers/{id} 讀取,或用 GET /v1/oracle/providers 列出活躍提供者(按提案數由多到少)。
讀取可用於保證金的 PAX、已鎖定的金額,以及你下一筆保證金的規模:
curl https://api.predictasiax.com/v1/oracle/bond-account \
-H "Authorization: Bearer $OK"
{
"user_id": "usr_0011223344556677889900aabbccddee",
"available_pax": "2500",
"locked_pax": "1000",
"bonds": [
{
"kind": "proposal",
"attestation_id": "att_42",
"challenge_id": null,
"market_id": "seed_crypto_7b1702e60e39",
"bond_pax": "1000",
"state": "locked",
"created_at_ms": 1798733100000
}
],
"next_bond_pax": { "proposal": "2000", "challenge": "1000" }
}
bonds 列出仍處於鎖定狀態的保證金。要增加 PAX,請在 predictasiax.com 儲值到你的平台餘額。
你可以為預言機無法判定、且目前沒有進行中提案的市場提出結果。這些市場可公開查詢:
curl https://api.predictasiax.com/v1/oracle/proposable
{
"liveness_secs": 86400,
"markets": [
{
"market_id": "seed_crypto_7b1702e60e39",
"title": "Will BTC close above $100,000 on 31 Dec?",
"outcomes": ["YES", "NO"],
"multi_outcome": false,
"settlement_time": "2026-12-31T16:00:00.000Z"
}
]
}
liveness_secs 是社群提案獲得的挑戰期間。此清單通常為空:大多數市場由預言機判定。
proposed_outcome 為 YES 或 NO,多結果市場則為該市場 outcomes 之一。reason 為 20–2000 個字元,evidence_urls 至少包含一個能證明結果的公開 http(s) 連結(最多 10 個)。provider_id 為選填,且必須是你自己處於活躍狀態的提供者。
curl -X POST https://api.predictasiax.com/v1/oracle/attestations \
-H "Authorization: Bearer $OK" \
-H "Content-Type: application/json" \
-d '{
"market_id": "seed_crypto_7b1702e60e39",
"proposed_outcome": "YES",
"reason": "Official close on 31 Dec was above the threshold.",
"evidence_urls": ["https://example.com/official-close"],
"provider_id": "ovp_9f8e7d6c5b4a39281706f5e4d3c2b1a0"
}'
回應 — 201;保證金已鎖定,挑戰期間已開始:
{
"id": "att_42",
"market_id": "seed_crypto_7b1702e60e39",
"proposed_by": "community",
"provider_id": "ovp_9f8e7d6c5b4a39281706f5e4d3c2b1a0",
"proposed_outcome": "YES",
"outcome_index": null,
"state": "open",
"liveness_expires_at_ms": 1798819500000,
"bond_pax": "1000",
"bond_state": "locked",
"bond_released_pax": null,
"bond_forfeited_pax": null,
"challenges": [],
"resolved_outcome": null,
"resolution_note": null,
"created_at_ms": 1798733100000,
"finalized_at_ms": null,
"settled_at_ms": null,
"updated_at_ms": 1798733100000,
"note": "..."
}
如果鎖定尚未完成,回應為 202,包含 "pending": true、bond_pax,bond_state 為 pending_lock;證明會在一兩分鐘內開啟。可用 GET /v1/oracle/markets/{market_id}/attestation 讀取。
拒絕:400 INVALID_REQUEST、EVIDENCE_REQUIRED 或 INVALID_OUTCOME(附市場的 outcomes);402 INSUFFICIENT_PAX(已知時附 bond_pax 與 platform_pax_free);403 PLATFORM_ACCOUNT_REQUIRED 或 NOT_PROVIDER_OWNER;404 MARKET_NOT_FOUND;409 NOT_PROPOSABLE、ALREADY_PROPOSED、DUPLICATE_PROPOSAL 或 PROVIDER_INACTIVE;429 RATE_LIMIT_EXCEEDED。提案被拒絕時不會鎖定任何 PAX。
證明處於 open 狀態時,除提案人外的任何帳戶都可以發起挑戰,無論該證明由預言機還是社群提出。reason 為 20–2000 個字元;evidence_urls 為選填(最多 10 個連結)。
curl -X POST https://api.predictasiax.com/v1/oracle/attestations/att_42/challenge \
-H "Authorization: Bearer $OK" \
-H "Content-Type: application/json" \
-d '{
"reason": "The official source shows a close below the threshold.",
"evidence_urls": ["https://example.com/counter-evidence"]
}'
回應 — 200;保證金已鎖定,挑戰將自動裁定:
{
"pending": false,
"challenge": {
"id": "chl_311",
"attestation_id": "att_42",
"bond_pax": "1000",
"state": "received"
},
"attestation": { "id": "att_42", "state": "open", "challenges": [ ... ], "...": "..." },
"note": "..."
}
回傳 202 且 "pending": true 表示鎖定仍在進行中。拒絕回應:400 INVALID_REQUEST 或 OWN_PROPOSAL;402 INSUFFICIENT_PAX;403 PLATFORM_ACCOUNT_REQUIRED;404 NOT_FOUND;409 PROPOSAL_NOT_OPEN、DISPUTE_WINDOW_CLOSED 或 DUPLICATE_CHALLENGE;429 RATE_LIMIT_EXCEEDED。
這些讀取操作是公開的(無需金鑰):
# Attestations open for challenges now, soonest deadline first (limit 1-200, default 100)
curl "https://api.predictasiax.com/v1/oracle/attestations?limit=50"
# A single attestation by id
curl https://api.predictasiax.com/v1/oracle/attestations/att_42
# A market's latest attestation, or {"attestation": null}
curl https://api.predictasiax.com/v1/oracle/markets/seed_crypto_7b1702e60e39/attestation
結果判定後,相同的證明會顯示結果以及每筆保證金的處理方式:
{
"id": "att_42",
"state": "settled",
"resolved_outcome": "YES",
"bond_state": "released",
"bond_released_pax": "1000",
"bond_forfeited_pax": "0",
"challenges": [
{
"id": "chl_311",
"bond_pax": "1000",
"state": "resolved_forfeited",
"verdict": "primary_correct",
"corrected_outcome": null,
"created_at_ms": 1798794720000,
"resolved_at_ms": 1798794840000
}
],
"finalized_at_ms": 1798819560000,
"settled_at_ms": 1798819620000,
"...": "..."
}
完整的請求/回應結構定義請參閱 REST API 參考(標記為 Oracle 與 Provider Keys)。摘要如下:
POST /v1/provider/keys · GET /v1/provider/keys · DELETE /v1/provider/keys/{id} — 建立、列出、撤銷金鑰(工作階段驗證)GET /v1/oracle/providers · POST /v1/oracle/providers · GET /v1/oracle/providers/{id} — 預言機供應商GET /v1/oracle/proposable — 開放社群提案的市場POST /v1/oracle/attestations · GET /v1/oracle/attestations · GET /v1/oracle/attestations/{id} · POST /v1/oracle/attestations/{id}/challenge — 證明GET /v1/oracle/markets/{market_id}/attestation · GET /v1/oracle/bond-account — 市場檢視、你的保證金next_bond_pax,該金鑰可以註冊提供者並讀取全部內容,但無法提案或挑戰。