Lux Docs
Reference

JSON-RPC API

Ethereum-compatible JSON-RPC API reference for Lux C-Chain

JSON-RPC API

Lux C-Chain exposes an Ethereum-compatible JSON-RPC API. Any tool that works with Ethereum (ethers.js, web3.js, Foundry, Hardhat) works with Lux out of the box.

Endpoints

NetworkHTTPWebSocket
Mainnethttps://api.lux.network/ext/bc/C/rpcwss://api.lux.network/ext/bc/C/ws
Testnethttps://api.testnet.lux.network/ext/bc/C/rpcwss://api.testnet.lux.network/ext/bc/C/ws
Localhttp://localhost:9650/ext/bc/C/rpcws://localhost:9650/ext/bc/C/ws

Chain IDs

NetworkChain ID
Mainnet96369
Testnet96368

Request Format

All requests use HTTP POST with Content-Type: application/json.

curl -s -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"METHOD","params":PARAMS}' \
  https://api.lux.network/ext/bc/C/rpc

Core Methods

eth_blockNumber

Returns the current block number.

curl -s -X POST --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_blockNumber",
  "params": []
}' -H 'content-type:application/json' https://api.lux.network/ext/bc/C/rpc

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x1A4F2B"
}

eth_getBalance

Returns the LUX balance of an address in Wei.

ParameterTypeDescription
addressstringThe address to query
blockstringBlock number (hex) or "latest", "earliest", "pending"
curl -s -X POST --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getBalance",
  "params": ["0xYourAddress", "latest"]
}' -H 'content-type:application/json' https://api.lux.network/ext/bc/C/rpc

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0xDE0B6B3A7640000"
}

The result is in Wei (18 decimals on C-Chain). 0xDE0B6B3A7640000 = 1 LUX.

eth_sendRawTransaction

Submits a signed transaction to the network.

ParameterTypeDescription
datastringSigned transaction data (hex)
curl -s -X POST --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_sendRawTransaction",
  "params": ["0xf86c...signed_tx_hex"]
}' -H 'content-type:application/json' https://api.lux.network/ext/bc/C/rpc

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x transaction_hash"
}

eth_call

Executes a read-only contract call without creating a transaction.

ParameterTypeDescription
objectobjectTransaction call object
blockstringBlock number or tag
curl -s -X POST --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_call",
  "params": [{
    "to": "0xContractAddress",
    "data": "0x70a08231000000000000000000000000YourAddress"
  }, "latest"]
}' -H 'content-type:application/json' https://api.lux.network/ext/bc/C/rpc

The data field is the ABI-encoded function selector and parameters. The example above calls balanceOf(address).

eth_getLogs

Returns logs matching a filter.

ParameterTypeDescription
fromBlockstringStart block (hex or tag)
toBlockstringEnd block (hex or tag)
addressstring or arrayContract address(es) to filter
topicsarrayEvent topic filters
curl -s -X POST --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getLogs",
  "params": [{
    "fromBlock": "0x1A0000",
    "toBlock": "latest",
    "address": "0xContractAddress",
    "topics": [
      "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
    ]
  }]
}' -H 'content-type:application/json' https://api.lux.network/ext/bc/C/rpc

The topic 0xddf252ad... is the Transfer(address,address,uint256) event signature.

eth_getTransactionReceipt

Returns the receipt of a transaction by hash.

curl -s -X POST --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getTransactionReceipt",
  "params": ["0xTransactionHash"]
}' -H 'content-type:application/json' https://api.lux.network/ext/bc/C/rpc

eth_estimateGas

Estimates the gas required for a transaction.

curl -s -X POST --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_estimateGas",
  "params": [{
    "from": "0xSenderAddress",
    "to": "0xRecipientAddress",
    "value": "0xDE0B6B3A7640000"
  }]
}' -H 'content-type:application/json' https://api.lux.network/ext/bc/C/rpc

eth_gasPrice

Returns the current gas price in Wei.

curl -s -X POST --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_gasPrice",
  "params": []
}' -H 'content-type:application/json' https://api.lux.network/ext/bc/C/rpc

WebSocket Subscriptions

Subscribe to real-time events over WebSocket.

New Blocks

const ws = new WebSocket("wss://api.lux.network/ext/bc/C/ws");

ws.onopen = () => {
  ws.send(JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "eth_subscribe",
    params: ["newHeads"],
  }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  if (data.params) {
    console.log("New block:", data.params.result.number);
  }
};

Log Subscriptions

ws.send(JSON.stringify({
  jsonrpc: "2.0",
  id: 2,
  method: "eth_subscribe",
  params: [
    "logs",
    {
      address: "0xContractAddress",
      topics: ["0xEventSignature"],
    },
  ],
}));

Pending Transactions

ws.send(JSON.stringify({
  jsonrpc: "2.0",
  id: 3,
  method: "eth_subscribe",
  params: ["newPendingTransactions"],
}));

Rate Limits

The public RPC endpoints enforce rate limits to ensure fair access.

EndpointRate Limit
Public mainnet40 requests/second per IP
Public testnet40 requests/second per IP
Local nodeNo limit

For production applications requiring higher throughput, run your own full node or use a dedicated RPC provider.

Supported Methods

The following standard Ethereum JSON-RPC methods are supported:

MethodDescription
eth_blockNumberCurrent block number
eth_getBalanceAddress balance
eth_getTransactionCountNonce for address
eth_sendRawTransactionSubmit signed transaction
eth_callRead-only contract call
eth_estimateGasEstimate gas cost
eth_gasPriceCurrent gas price
eth_getBlockByNumberBlock by number
eth_getBlockByHashBlock by hash
eth_getTransactionByHashTransaction details
eth_getTransactionReceiptTransaction receipt
eth_getLogsEvent logs
eth_getCodeContract bytecode
eth_getStorageAtContract storage
eth_chainIdChain ID
net_versionNetwork version
web3_clientVersionClient version

Further Reading

On this page