X Layer RPC
What is X Layer?
X Layer is a zero-knowledge rollup (zkRollup) Layer 2 solution for Ethereum, built on zkEVM technology. It uses a hybrid proof approach — generating STARK proofs for execution and then recursively wrapping them into a SNARK for efficient on-chain verification. This ensures transactions are mathematically valid while inheriting Ethereum’s security.
Unlike optimistic rollups, X Layer does not require challenge periods for withdrawals because validity proofs provide cryptographic certainty once submitted. Finality depends on proof submission intervals — typically minutes rather than days — but is still faster than optimistic rollups. Transaction costs are significantly reduced compared to Ethereum mainnet, with savings coming from transaction batching and calldata compression.
X Layer achieves bytecode-level compatibility with the Ethereum Virtual Machine (EVM). This zkEVM architecture supports nearly all EVM opcodes and precompiles, with only minor differences in edge cases such as gas costs. This ensures that most existing Ethereum smart contracts and applications can be deployed without modification, preserving broad compatibility with Ethereum's execution environment, tooling, and developer ecosystem while providing zero-knowledge security guarantees.
Interacting with X Layer
X Layer fully supports the standard Ethereum JSON-RPC interface while also providing additional Layer 2–specific functionality. This ensures complete compatibility with existing Ethereum tooling, so developers can use X Layer seamlessly with tools such as MetaMask, Hardhat, Foundry, and Web3 libraries without code changes.
With the X Layer API, you can:
- Execute all standard Ethereum JSON-RPC methods (
eth_call,eth_sendTransaction,eth_getBalance) - Access X Layer–specific methods for rollup operations (e.g., querying proof status and bridge interactions)
- Query bridge activity, batch submissions, and proof verification status
- Subscribe to real-time L2 events via WebSocket connections
- Use available tracing and inspection utilities for deeper blockchain debugging
You can connect to the API by:
- Running a local X Layer node
- Using a hosted provider such as a Quicknode X Layer endpoint, which provides access to X Layer Mainnet with high reliability, archive data, and enhanced performance
支援的網路
Quicknode 提供以下 X Layer 網路的存取服務:
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"}'
Complete reference for developers building on X Layer with Quicknode:
快速入門
Get started with X Layer quickly. Follow our step-by-step quickstart to set up your endpoint and make your first API request.
供應商端點
Learn how to configure and manage your X Layer endpoints for optimal performance and reliability.
API 概覽
探索受支援的 API、網路、Quicknode 產品以及增強的 API 功能,以建置功能強大的應用程式。
市集
探索並整合來自 Quicknode 市集的強大外掛程式與工具,以強化您的 Web3 應用程式。
端點安全
透過身分驗證、白名單機制及最佳安全實務,確保您的端點安全。
錯誤代碼
Understand common error codes and troubleshooting steps for X Layer API requests.