JSON-RPC

The GX EVM exposes a standard Ethereum JSON-RPC 2.0 interface on port 3001. This page documents the supported methods and GX-specific behavior.

Endpoint

EnvironmentURL
Mainnethttps://rpc.gx.exchange
Testnethttps://rpc.gx-exchange-testnet.xyz
Localhttp://localhost:3001

Request Format

Standard JSON-RPC 2.0:

{
  "jsonrpc": "2.0",
  "method": "eth_blockNumber",
  "params": [],
  "id": 1
}

Supported Methods

Chain Information

MethodDescription
eth_chainIdReturns 0xA455 (42069 decimal)
eth_blockNumberCurrent block height
net_versionNetwork ID ("42069")
const provider = new ethers.JsonRpcProvider("https://rpc.gx.exchange");
 
const chainId = await provider.getNetwork();
console.log("Chain ID:", chainId.chainId); // 42069n
 
const blockNumber = await provider.getBlockNumber();
console.log("Block:", blockNumber);

Account State

MethodDescription
eth_getBalanceNative GX balance (wei)
eth_getTransactionCountAccount nonce
eth_getCodeContract bytecode at address
eth_getStorageAtRaw storage slot value
const balance = await provider.getBalance("0xYourAddress...");
console.log("GX balance:", ethers.formatEther(balance));
 
const nonce = await provider.getTransactionCount("0xYourAddress...");
console.log("Nonce:", nonce);

Transaction Submission

MethodDescription
eth_sendRawTransactionSubmit a signed transaction
eth_estimateGasEstimate gas for a transaction
eth_callExecute a read-only call (no state change)
// Estimate gas
const gasEstimate = await provider.estimateGas({
  to: "0xContractAddress...",
  data: "0x...",
});
 
// Submit transaction
const tx = await wallet.sendTransaction({
  to: "0xContractAddress...",
  data: "0x...",
  gasLimit: gasEstimate,
});
const receipt = await tx.wait();

Block Data

MethodDescription
eth_getBlockByNumberBlock by number (with or without full transactions)
eth_getBlockByHashBlock by hash
// Get latest block
const block = await provider.getBlock("latest");
 
// Get specific block with full transactions
const fullBlock = await provider.getBlock(1000, true);

Transaction Data

MethodDescription
eth_getTransactionByHashTransaction details by hash
eth_getTransactionReceiptTransaction receipt (status, logs, gas used)
const receipt = await provider.getTransactionReceipt("0xTxHash...");
console.log("Status:", receipt.status); // 1 = success
console.log("Gas used:", receipt.gasUsed);

Event Logs

MethodDescription
eth_getLogsQuery event logs by filter
const logs = await provider.getLogs({
  fromBlock: 1000,
  toBlock: "latest",
  address: "0xContractAddress...",
  topics: [ethers.id("Transfer(address,address,uint256)")],
});

Gas Price

MethodDescription
eth_gasPriceCurrent gas price suggestion
eth_feeHistoryHistorical fee data for EIP-1559 estimation
const feeData = await provider.getFeeData();
console.log("Gas price:", feeData.gasPrice);
console.log("Max fee:", feeData.maxFeePerGas);
console.log("Max priority fee:", feeData.maxPriorityFeePerGas);

Unsupported Methods

The following methods are not available on GX EVM:

MethodReason
eth_miningGX Chain uses PoS consensus, not PoW
eth_hashrateNot applicable to PoS
eth_getWorkNot applicable to PoS
eth_submitWorkNot applicable to PoS
debug_*Debug namespace not exposed on public endpoints
trace_*Trace namespace not exposed on public endpoints

Batch Requests

The RPC endpoint supports JSON-RPC batch requests:

[
  { "jsonrpc": "2.0", "method": "eth_blockNumber", "params": [], "id": 1 },
  { "jsonrpc": "2.0", "method": "eth_chainId", "params": [], "id": 2 },
  { "jsonrpc": "2.0", "method": "eth_gasPrice", "params": [], "id": 3 }
]

The response is an array of results in the same order.

Rate Limits

TierLimit
Public (per IP)100 requests/second
eth_getLogs (per IP)20 requests/second
Batch requestCounts as N requests (one per item in the batch)

WebSocket Subscriptions

The RPC endpoint also supports eth_subscribe over WebSocket for real-time event streaming:

const wsProvider = new ethers.WebSocketProvider("wss://rpc.gx.exchange/ws");
 
// Subscribe to new blocks
wsProvider.on("block", (blockNumber) => {
  console.log("New block:", blockNumber);
});
 
// Subscribe to contract events
const filter = {
  address: "0xContractAddress...",
  topics: [ethers.id("Transfer(address,address,uint256)")],
};
wsProvider.on(filter, (log) => {
  console.log("Transfer event:", log);
});

Error Codes

CodeMessageDescription
-32700Parse errorInvalid JSON
-32600Invalid requestMissing required fields
-32601Method not foundUnsupported RPC method
-32602Invalid paramsWrong parameter types or count
-32603Internal errorServer-side error
-32000Execution revertedContract call reverted (includes revert reason)
-32001Resource not foundBlock or transaction not found