跳至主要內容

X Layer API Overview

更新於
2026年4月28日

Quicknode supports the following X Layer APIs on all endpoints. Using your X Layer endpoint, you can call any of the methods available in these APIs. For a complete list of supported RPC methods, refer to the documentation for each API.

支援的 API

支援的網路

Quicknode 以下X Layer 的連線服務:

Mainnet
類型:製作
鏈 ID:
196
HTTP:
WSS:
檔案:
修剪:
Testnet
類型:Testnet
鏈 ID:
1952
HTTP:
WSS:
檔案:
修剪:
註:

XLayer 在區塊中使用「重新生成」機制 42,810,021. 此區塊之前的歷史資料雖然可用,但儲存於舊版節點上,當您針對諸如 eth_getBlockByNumber, eth_getBalance,以及 debug_trace*.

區塊 42,810,021 本身無法追蹤,且可能會返回 {"code":4444,"message":"pruned history unavailable"}.

交易節點需求

X Layer 兩種不同的節點客戶端,其分界點位於重新創世邊界(區塊42,810,021):

  • 區塊 42,810,021 以及更早之前 — 需要一個 cdk-Erigon 節點。Geth 節點會傳回 null 針對這些歷史交易。
  • 區塊之後 42,810,021 — 需要一個 蓋斯 節點。Erigon 節點會傳回 null 針對這些當前的交易。

若要查詢重生前的資料,請包含 x-qn-height 請在您的請求中加入包含目標區塊編號的標頭,以便將其路由至 cdk-Erigon 節點。若未指定此標頭,請求將預設使用 蓋斯 節點,因此對於「再生成」後的區塊而言,不需包含此標頭。

「重生前」範例(cdk-Erigon,區塊 ≤ 42,810,021):

curl --location 'https://docs-demo.xlayer-mainnet.quiknode.pro/' \
--header 'Content-Type: application/json' \
--header 'x-qn-height: 42810020' \
--data '{"method":"eth_getBlockByNumber","params":["0x28D3AA4",false],"id":1,"jsonrpc":"2.0"}'

重生後範例(蓋斯,區塊編號 > 42,810,021):

curl --location 'https://docs-demo.xlayer-mainnet.quiknode.pro/' \
--header 'Content-Type: application/json' \
--data '{"method":"eth_getBlockByNumber","params":["0x28D3AA6",false],"id":1,"jsonrpc":"2.0"}'

支援的產品