Documentation / Build
SPCX DEVELOPER NETWORK
JSON-RPC reference
Use the public HTTP JSON-RPC endpoint.
Read chain ID
Shell
curl -fsS https://rpc-testnet.spcxchain.network -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'Expected result: 0x2c78485.
Supported methods
eth_chainIdeth_blockNumbereth_getBlockByNumbereth_getBlockByHasheth_getTransactionByHasheth_getTransactionReceipteth_getBalanceeth_getTransactionCounteth_getCodeeth_calleth_gasPriceeth_maxPriorityFeePerGaseth_estimateGaseth_feeHistorynet_versionweb3_clientVersioneth_sendRawTransactionBatch size: 1–8 requests. Admin, personal, debug, trace and arbitrary eth_getLogs methods are not exposed by the public RPC. WebSocket is not advertised. Back off and retry later on rate limits.
Node.js example
JavaScript
const rpc = "https://rpc-testnet.spcxchain.network";
const r = await fetch(rpc, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({jsonrpc:"2.0",id:1,
method:"eth_blockNumber",params:[]})
});
const data = await r.json();
if (!r.ok || data.error) throw new Error("RPC unavailable");
console.log(BigInt(data.result).toString());