오라클 API

PAX 마켓의 정산 방식 및 오라클 API: 플랫폼 잔액의 PAX 보증으로 결과를 제안하고 제안을 챌린지할 수 있습니다. 모든 요청은 curl을 사용하며, SDK는 제공되지 않습니다.

오라클은 API 호스트에 있습니다: https://api.predictasiax.com — 거래와 동일한 호스트입니다. 공개 읽기에는 키가 필요하지 않으며, 쓰기는 oracle:write 스코프를 가진 api-key가 필요합니다. 거래 API와 달리 오라클 응답은 직접 반환됩니다({ data, meta } 엔벨로프로 포장되지 않습니다). 프로바이더와 어테스테이션의 공개 읽기에는 계정 ID가 포함되지 않습니다.

마켓 정산 방식

마켓이 마감되면 플랫폼 오라클이 결과를 제안합니다. 결과는 지급 전 2시간 동안 공개되며, 누구나 PAX 본드를 잠금하여 이의를 제기할 수 있고, 이의 제기는 독립적인 리플레이에 의해 자동으로 결정됩니다. 오라클이 마켓을 결정하지 못할 경우, 누구나 PAX 본드를 잠금하여 결과를 제안할 수 있으며, 제안은 24시간 동안 이의 제기에 열려 있습니다. 두 작업 모두 predictasiax.com/dispute 또는 이 API를 통해 플랫폼 잔액의 PAX로 수행할 수 있습니다.

API와 분쟁 페이지는 동일한 프로세스를 향한 두 개의 문입니다: 여기서 제출한 제안 또는 챌린지는 동일한 제안 또는 챌린지로, 동일한 보증금 규모, 동일한 자동 심판, 동일한 지급이 적용됩니다. 어떤 결과도 수동으로 결정되지 않습니다.

증언 및 이의제기

어테스테이션의 state:

보드

보딩은 predictasiax.com 계정의 플랫폼 잔액에서 PAX로 락되며, 결과가 결정되면 자동으로 해제되거나 몰수됩니다. 보딩이 락된 동안에는 어떤 자산도 이전되지 않습니다.

다음 정확한 본드는 항상 GET /v1/oracle/bond-account의 next_bond_pax에 있으며, 실제로 잠금된 본드는 attestations 또는 challenge의 bond_pax입니다.

제안자 보증금에 대한 처리:

챌린지 보증금(verdict)에 대해 발생하는 일:

몰수된 PAX는 플랫폼에 귀속됩니다. 보너스는 없습니다: 유지되는 제안이나 챌린지는 보증을 반환받습니다.

인증

쓰기 엔드포인트(register, propose, challenge)에는 oracle:write 스코프가 있는 oracle api-key가 필요합니다. 자신의 보증 계정을 읽는 데에는 유효한 api-key가 필요합니다. 어떤 경우에도 다음을 전송하십시오:

-H "Authorization: Bearer sk_live_..."     # or, equivalently:
-H "X-API-Key: sk_live_..."

공개 읽기(providers, attestations, proposable markets)에는 키가 필요하지 않습니다. api-key는 PAX 사용자와 연결되며, 게이트웨이는 키에서 사용자 신원을 해석하고 클라이언트가 제공한 X-PAX-User-Id 헤더를 무시합니다. 보증금은 해당 사용자의 플랫폼 잔액에서 지급되므로, 키는 predictasiax.com에 로그인된 상태에서 발급되어야 합니다. 그렇지 않으면 쓰기 요청은 403 PLATFORM_ACCOUNT_REQUIRED를 반환합니다. 거래 api-key와 마찬가지로, oracle 키는 거래 PIN을 요구하지 않습니다. 이 키를 가진 사람은 사용자의 PAX를 보증금으로 잠글 수 있으므로, 거래 키와 동일하게 보관하십시오.

1단계 — 오라클 API 키 발급

키는 플랫폼 로그인에 대해 발급됩니다. 가장 쉬운 방법은 Builder 포털의 오라클 프로바이더 콘솔입니다 — 로그인한 후 오라클 프로바이더를 열고 생성을 클릭하세요. 키는 한 번만 표시되므로 즉시 복사하세요.

프로그래밍 방식으로 민트하려면 플랫폼 세션 또는 Builder Portal 세션 토큰을 사용해야 합니다(api-key도, 제3자 앱이 받은 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}로 하나를 폐기할 수 있습니다(메타데이터만 포함되며, 시크릿 자료는 다시 반환되지 않음).

2단계 — 프로바이더로 등록 (선택 사항)

프로바이더는 공개된 리졸버 식별자입니다. 해당 provider_id로 만든 제안은 공개 기록에 집계되며, 프로바이더 없이도 제안과 챌린지가 가능합니다. adapter_kind는 feed, official_source, regional_data, manual 중 하나이며, display_name은 1–80자입니다. 계정당 프로바이더는 1개입니다.

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
}

레코드는 각 변경 사항 후 약 1분 이내에 업데이트됩니다: attestations_total은 이 프로바이더로 생성된 제안 수를, staked_pax는 여전히 잠겨 있는 PAX를, disputed_total은 챌린지를 받은 수를, slashed_total은 보증이 몰수되거나 분배된 수를 나타냅니다. rewards_pax는 0을 유지합니다(보너스 없음). 누구나 GET /v1/oracle/providers/{id}로 읽거나, GET /v1/oracle/providers로 활성 프로바이더 목록(가장 많이 증명한 순)을 조회할 수 있습니다.

3단계 — 보딩 계정 확인

보드에 사용 가능한 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의 플랫폼 잔액에 입금하세요.

4단계 — 제안할 마켓 찾기

오라클이 결정하지 못하고 현재 진행 중인 제안이 없는 마켓의 결과를 제안할 수 있습니다. 제안은 공개됩니다:

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는 커뮤니티 제안에 부여되는 챌린지 기간입니다. 목록은 대부분 비어 있습니다: 대부분의 마켓은 오라클에 의해 결정됩니다.

단계 5 — 결과 제안

proposed_outcome은 YES 또는 NO이며, 다중 결과 마켓의 경우 마켓의 outcomes 중 하나여야 합니다. reason은 20–2000자이며, evidence_urls에는 결과를 보여주는 공개 http(s) 링크가 최소 1개(최대 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. 제안이 거부되면 아무것도 잠금되지 않습니다.

단계 6 — 공개된 인증에 대한 챌린지

제안자가 아닌 모든 계정은 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.

7단계 — 결과 추적

이 읽기 요청은 공개되어 있습니다(키 불필요):

# 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 태그)에 있습니다. 요약:

쓰기 작업에는 키가 아닌 플랫폼 잔액에 PAX가 필요합니다. 계정의 가용 PAX가 next_bond_pax보다 적은 키는 프로바이더를 등록하고 모든 것을 읽을 수 있지만, 제안이나 챌린지를 할 수 없습니다.

다음 단계