X-Layer Chain (OKB)
X Layer is OKX's EVM-compatible Layer-2, built on the Polygon CDK as a zkEVM that settles to Ethereum with validity proofs. It is EVM-equivalent — standard Solidity contracts, the eth_* JSON-RPC surface, and tooling such as Foundry, Hardhat, Ethers.js, and Viem work without modification — while the native gas token is OKB. This reference documents the Ethereum-compatible JSON-RPC interface, available over HTTP and WebSocket.
Key Features
- Polygon CDK zkEVM: A zero-knowledge Layer-2 by OKX that settles to Ethereum with validity proofs
- OKB Gas: Transaction fees are paid in OKB, the network's native gas token
- EVM Compatible: Runs standard Ethereum bytecode and tooling (Foundry, Hardhat, Ethers, Viem) unchanged
- EIP-1559 Fees: Base-fee pricing with
eth_feeHistoryand priority fees - WebSocket Subscriptions: Live
eth_subscribestreams for new heads, logs, and pending transactions - Core Trace Support: The core
debug_trace*tracers for transaction and block inspection
TECHNICAL DISCLAIMER: AUTHORITATIVE JSON-RPC API SPECIFICATION.
GetBlock's RPC API reference documentation is provided exclusively for informational purposes and to optimize the developer experience. X Layer implements the standard Ethereum JSON-RPC interface; the canonical specification for these methods is the Ethereum JSON-RPC specification at ethereum.org, and X Layer-specific behaviour is documented at web3.okx.com/xlayer.
As a zkEVM, X Layer does not expose a standard Merkle-Patricia state trie, so eth_getProof is not served. Polygon CDK chains additionally expose a zkevm_* namespace (batch and verification queries) that is not covered by this core reference.
Network Information
| Property | Value |
|---|---|
| Network Name | X Layer Mainnet |
| Chain ID | 196 |
| Native Currency | OKB |
| EVM Compatible | Yes (EVM-equivalent, Polygon CDK zkEVM) |
| Network Type | zkEVM Layer-2 |
| Fee Model | EIP-1559 |
Base URL
https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/Supported Networks
| Network | Chain ID | JSON-RPC | WSS | GraphQL | MEV protected (WebSocket) | MEV protected (JSON-RPC) | Frankfurt, Germany | New York, USA | Singapore, Singapore |
|---|---|---|---|---|---|---|---|---|---|
| Mainnet | 196 | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ |
Quickstart
Setup project
bash
mkdir xlayer-api-quickstart && cd xlayer-api-quickstart && npm init --yesInstall dependency
bash
npm install axiosAdd code
index.js
javascript
const axios = require('axios'); const url = 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/'; const payload = { jsonrpc: '2.0', method: 'eth_blockNumber', params: [], id: 'getblock.io' }; axios.post(url, payload, { headers: { 'Content-Type': 'application/json' } }) .then(response => { console.log('Latest block:', parseInt(response.data.result, 16)); }) .catch(error => console.error(error));Run the script
bash
node index.jsResponse
bash
Latest block: 73285114
Setup project
bash
mkdir xlayer-api-quickstart && cd xlayer-api-quickstart python -m venv venv && source venv/bin/activateInstall dependency
bash
pip install requestsAdd code
main.py
python
import requests import json url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/" payload = json.dumps({ "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": "getblock.io" }) headers = { 'Content-Type': 'application/json' } response = requests.post(url, headers=headers, data=payload) print(response.text)Run the script
bash
python main.py
Available API Methods
Chain & Client Info
| Method | Description |
|---|---|
| web3_clientVersion | Client software version identifier |
| web3_sha3 | Keccak-256 hash of hex-encoded data |
| net_version | Network ID as a decimal string |
| net_listening | Whether the node is listening for P2P connections |
| net_peerCount | Number of connected peers |
| eth_chainId | Chain ID per EIP-155 |
| eth_blockNumber | Current chain tip block number |
| eth_syncing | Sync status, or false if fully synced |
Gas & Fees
| Method | Description |
|---|---|
| eth_gasPrice | Legacy gas price estimate in wei |
| eth_maxPriorityFeePerGas | Suggested EIP-1559 priority fee in wei |
| eth_feeHistory | Historical base fees and priority-fee percentiles |
Account & State
| Method | Description |
|---|---|
| eth_getBalance | OKB balance of an address at a given block |
| eth_accounts | Accounts owned by the client |
| eth_getStorageAt | Value at a specific contract storage slot |
| eth_getTransactionCount | Address nonce (transaction count) |
| eth_getCode | Deployed bytecode at an address |
Blocks
| Method | Description |
|---|---|
| eth_getBlockByHash | Block data by block hash |
| eth_getBlockByNumber | Block data by block number or tag |
| eth_getBlockTransactionCountByHash | Transaction count in a block, by hash |
| eth_getBlockTransactionCountByNumber | Transaction count in a block, by number |
Transactions
| Method | Description |
|---|---|
| eth_getTransactionByHash | Transaction data by transaction hash |
| eth_getTransactionByBlockHashAndIndex | Transaction by block hash and index |
| eth_getTransactionByBlockNumberAndIndex | Transaction by block number and index |
| eth_getTransactionReceipt | Transaction receipt with status, gas, and logs |
Execution & Simulation
| Method | Description |
|---|---|
| eth_call | Execute a message call without a transaction |
| eth_estimateGas | Estimate gas required to execute a transaction |
Filters & Logs
| Method | Description |
|---|---|
| eth_newFilter | Create a log filter with address and topic criteria |
| eth_newBlockFilter | Create a filter for new block hashes |
| eth_newPendingTransactionFilter | Create a filter for pending transaction hashes |
| eth_uninstallFilter | Remove a previously created filter |
| eth_getFilterChanges | Poll new entries for a filter since the last poll |
| eth_getFilterLogs | Get all logs matching a log filter |
| eth_getLogs | Query logs matching criteria in one call |
Transaction Submission
| Method | Description |
|---|---|
| eth_sendRawTransaction | Submit a signed transaction to the network |
WebSocket Subscriptions
| Method | Description |
|---|---|
| eth_subscribe | Subscribe to newHeads, logs, newPendingTransactions, or syncing |
| eth_unsubscribe | Cancel an active subscription |
Debug & Trace
| Method | Description |
|---|---|
| debug_traceBlockByHash | Trace all transactions in a block by hash |
| debug_traceBlockByNumber | Trace all transactions in a block by number |
| debug_traceCall | Trace a simulated message call |
| debug_traceTransaction | Trace execution of a mined transaction |
Support
For technical support and questions:
- Support: support@getblock.io