JSON-RPC API
Calix Chain is Ethereum JSON-RPC compatible. Endpoint: https://calixchain.io/rpc
âšī¸
All methods use POST with Content-Type: application/json. WebSocket subscriptions via wss://calixchain.io/rpc/ws.
Basic methods
| Method | Description | Params |
eth_blockNumber | Current block height | â |
eth_getBalance | CLX balance of an address | [address, tag] |
eth_getTransactionCount | Nonce of an address | [address, tag] |
eth_sendRawTransaction | Submit a signed transaction | [hex] |
eth_call | Call a contract function (read-only) | [tx, tag] |
eth_estimateGas | Estimate gas | [tx] |
eth_getBlockByNumber | Block info by number | [number, full] |
eth_getTransactionByHash | Transaction info | [hash] |
eth_getTransactionReceipt | Receipt after confirmation | [hash] |
eth_getLogs | Event logs by filter | [filter] |
eth_chainId | Chain ID (hex) | â |
eth_gasPrice | Current gas price | â |
net_version | Network ID | â |
Examples
eth_blockNumber
curl -X POST https://calixchain.io/rpc \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
# Response
{"jsonrpc":"2.0","id":1,"result":"0x139b43"}
eth_getBalance
curl -X POST https://calixchain.io/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0","method":"eth_getBalance",
"params":["0xYourAddress","latest"],"id":1
}'
eth_call (read contract function)
curl -X POST https://calixchain.io/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0","method":"eth_call",
"params":[{
"to": "0xTokenContractAddress",
"data": "0x70a082310000000000000000000000000xYourAddress"
},"latest"],"id":1
}'
WebSocket Subscriptions
// Connect WebSocket
const ws = new WebSocket("wss://calixchain.io/rpc/ws");
// Subscribe new blocks
ws.send(JSON.stringify({
"jsonrpc":"2.0","method":"eth_subscribe",
"params":["newHeads"],"id":1
}));
ws.onmessage = (e) => {
const msg = JSON.parse(e.data);
if (msg.method === "eth_subscription") {
console.log("New block:", msg.params.result.number);
}
};
| Subscription type | Description |
newHeads | Notifies on each new block |
logs | Event logs by address/topic filter |
newPendingTransactions | Tx hash entering mempool |
Block tag
| Tag | Meaning |
latest | Most recently committed block |
earliest | Genesis block (0) |
pending | Mempool state (alias for latest on Calix) |
0x1A2B | Specific block by hex number |