RPC API Reference
Liberty Chain exposes a standard Ethereum JSON-RPC API. If you have worked with any EVM chain before, the same methods, request format, and client libraries all work here. This page covers the endpoint details, supported methods, and usage examples.
Endpoint
| HTTPS | https://testnet-rpc.lcx.com |
| WebSocket | wss://testnet-rpc.lcx.com |
| Chain ID | 76847801 |
No API Key Required
Supported Methods
Liberty Chain supports the standard Ethereum JSON-RPC methods, plus OP Stack-specific methods for rollup status. The table below lists the most commonly used methods.
Standard Ethereum Methods
| Method | Description |
|---|---|
| eth_blockNumber | Returns the latest block number |
| eth_getBalance | Returns the balance of an address in wei |
| eth_getTransactionCount | Returns the nonce for an address |
| eth_sendRawTransaction | Submits a signed transaction to the network |
| eth_call | Executes a read-only call against a contract |
| eth_estimateGas | Estimates the gas needed for a transaction |
| eth_getTransactionReceipt | Returns the receipt for a mined transaction |
| eth_getBlockByNumber | Returns block data by block number |
| eth_getBlockByHash | Returns block data by block hash |
| eth_getLogs | Returns logs matching a filter |
| eth_getCode | Returns the bytecode at an address |
| eth_gasPrice | Returns the current gas price in wei |
| eth_chainId | Returns the chain ID (76847801) |
| net_version | Returns the network ID |
OP Stack-Specific Methods
| Method | Description |
|---|---|
| optimism_syncStatus | Returns the current sync status of the node, including the latest L1 and L2 block references and their safety levels. |
| optimism_outputAtBlock | Returns the output root at a given L2 block number, used by the proposer and verifier for fault proofs. |
Usage Examples
Get the Latest Block Number
curl -X POST https://testnet-rpc.lcx.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'{
"jsonrpc": "2.0",
"id": 1,
"result": "0x1a4b2"
}Get Account Balance
curl -X POST https://testnet-rpc.lcx.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0xYOUR_ADDRESS_HERE", "latest"],
"id": 1
}'Estimate Gas
curl -X POST https://testnet-rpc.lcx.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{
"from": "0xSENDER_ADDRESS",
"to": "0xRECIPIENT_ADDRESS",
"value": "0xde0b6b3a7640000"
}],
"id": 1
}'Send a Raw Transaction
curl -X POST https://testnet-rpc.lcx.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["0xSIGNED_TRANSACTION_DATA"],
"id": 1
}'Using ethers.js
import { ethers } from "ethers";
const provider = new ethers.JsonRpcProvider(
"https://testnet-rpc.lcx.com"
);
// Get latest block number
const blockNumber = await provider.getBlockNumber();
console.log("Latest block:", blockNumber);
// Get balance
const balance = await provider.getBalance("0xYOUR_ADDRESS");
console.log("Balance:", ethers.formatEther(balance), "ETH");
// Get gas price
const feeData = await provider.getFeeData();
console.log("Gas price:", ethers.formatUnits(feeData.gasPrice, "gwei"), "gwei");WebSocket Subscriptions
For real-time data such as new blocks, pending transactions, or event logs, use the WebSocket endpoint. WebSocket connections support the eth_subscribe method for push-based notifications.
import { ethers } from "ethers";
const wsProvider = new ethers.WebSocketProvider(
"wss://testnet-rpc.lcx.com"
);
// Subscribe to new blocks
wsProvider.on("block", (blockNumber) => {
console.log("New block:", blockNumber);
});
// Subscribe to contract events
const contract = new ethers.Contract(contractAddress, abi, wsProvider);
contract.on("Transfer", (from, to, value) => {
console.log(`Transfer: ${from} -> ${to}: ${value}`);
});Rate Limits
The public RPC endpoint enforces rate limits to ensure fair access for all users. Current limits are:
| Limit | Value |
|---|---|
| Requests per second (per IP) | 25 |
| Batch request size | 20 calls per batch |
| WebSocket connections (per IP) | 5 |
| eth_getLogs block range | 10,000 blocks |
Rate Limit Exceeded
For production applications that require higher throughput, contact the Liberty Chain team to discuss dedicated RPC access.