Documentation
Everything you need to integrate LitVM RPC into your project.
Getting Started
LitVM RPC Hub provides JSON-RPC access to the LitVM RPC PRO network. You can start using the public endpoint immediately — no registration required.
Quick access: The public endpoint https://rpc-litvm.pro works without an API key at 5 req/s. For higher limits, connect your wallet to get a key.
Network Details
| Network Name | LitVM RPC PRO |
| Chain ID | 4441 |
| Gas Token | zkLTC |
| HTTP RPC | https://rpc-litvm.pro |
| WebSocket RPC | wss://rpc-litvm.pro/ws |
| Block Explorer | https://explorer.litvm.io |
Get Your API Key
API keys are issued via wallet signature — no email or password needed.
-
Connect Wallet
Go to the Dashboard and click "Connect Wallet". MetaMask, Rabby, or any EIP-1193 wallet works.
-
Sign Message
Sign the authentication message. This proves wallet ownership without spending gas.
-
Receive API Key
Your key is generated instantly. Store it — the recommended way to use it is the
X-API-Keyheader. Avoid putting API keys in URLs because they leak into logs and browser history. -
Make Your First Request
Use the key to call any supported RPC method with higher rate limits.
Authentication
Pass your API key using the request header or embed it in the URL path:
| Method | Example |
|---|---|
| Header | X-API-Key: your-key-here |
| URL path | https://rpc-litvm.pro/key/your-key-here |
Without a key, requests are served at the Free tier (10 req/s, 10K req/day). With an invalid or expired key, the gateway returns a -32001 error.
Tiers
| Tier | Rate Limit | Daily Limit | WebSocket | Price |
|---|---|---|---|---|
| Free default | 10 req/s | 10,000 | — | $0 |
| Builder | 50 req/s | 100,000 | 5 conn | 0.05 zkLTC/mo |
| Trader | 150 req/s | 500,000 | 20 conn | 0.1 zkLTC/mo |
| Bot no cache | 200 req/s | 1,000,000 | 20 conn | 0.2 zkLTC/mo |
| Infrastructure | 500 req/s | 2,000,000 | 100 conn | 0.5 zkLTC/mo |
| Enterprise | 1000 req/s | 5,000,000 | 200 conn | 1 zkLTC/mo |
Note: txpool_* methods require Trader+. debug_* methods require Infrastructure+.
Making Requests
LitVM RPC accepts standard JSON-RPC 2.0 requests over HTTP POST.
Request Format
{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}
Batch Requests
Send an array of requests in a single HTTP call. Batch size limits depend on your tier:
| Tier | Max Batch Size |
|---|---|
| Free | 5 |
| Builder | 20 |
| Trader | 50 |
| Bot | 50 |
| Infrastructure | 100 |
| Enterprise | 1000 |
[
{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1},
{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":2}
]
Code Examples
cURL
curl -X POST https://rpc-litvm.pro \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_KEY" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
ethers.js (v6)
import { JsonRpcProvider } from "ethers";
const provider = new JsonRpcProvider("https://rpc-litvm.pro", {
chainId: 4441,
name: "litvm-liteforge",
});
const block = await provider.getBlockNumber();
console.log("Latest block:", block);
const balance = await provider.getBalance("0xYourAddress");
console.log("Balance:", balance.toString());
viem
import { createPublicClient, http, defineChain } from "viem";
const litvm = defineChain({
id: 4441,
name: "LitVM RPC PRO",
nativeCurrency: { name: "zkLTC", symbol: "zkLTC", decimals: 18 },
rpcUrls: {
default: { http: ["https://rpc-litvm.pro"] },
},
blockExplorers: {
default: { name: "Explorer", url: "https://explorer.litvm.io" },
},
});
const client = createPublicClient({
chain: litvm,
transport: http(),
});
const blockNumber = await client.getBlockNumber();
const gasPrice = await client.getGasPrice();
web3.js
import Web3 from "web3";
const web3 = new Web3("https://rpc-litvm.pro");
const block = await web3.eth.getBlockNumber();
const gasPrice = await web3.eth.getGasPrice();
console.log("Block:", block, "Gas:", gasPrice);
Python (web3.py)
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("https://rpc-litvm.pro"))
print("Connected:", w3.is_connected())
print("Block:", w3.eth.block_number)
print("Gas price:", w3.eth.gas_price)
Gas Oracle
The Gas Oracle endpoint returns live EIP-1559 fee recommendations derived from the last 10 blocks. No API key needed — responses are cached for 10 seconds and served with Cache-Control: public, max-age=10.
GET https://rpc-litvm.pro/api/gas
{
"timestamp": 1781355126141,
"block": "0x11e3c58",
"baseFee": "0x989680",
"baseFeeGwei": 0.01,
"tiers": {
"safe": { "maxFeePerGas": "0xb71b00", "maxPriorityFeePerGas": "0xf4240", "maxFeePerGasGwei": 0.012, "maxPriorityFeePerGasGwei": 0.001, "estimatedSeconds": 30 },
"standard": { "maxFeePerGas": "0x14fb180","maxPriorityFeePerGas": "0x989680", "maxFeePerGasGwei": 0.022, "maxPriorityFeePerGasGwei": 0.01, "estimatedSeconds": 15 },
"fast": { "maxFeePerGas": "0x3dfd240","maxPriorityFeePerGas": "0x2faf080","maxFeePerGasGwei": 0.065, "maxPriorityFeePerGasGwei": 0.05, "estimatedSeconds": 5 }
}
}
| Field | Description |
|---|---|
baseFeeGwei | Next block base fee in Gwei |
tiers.safe | Low priority, cheaper — confirmation in ~30s |
tiers.standard | Typical priority — confirmation in ~15s |
tiers.fast | High priority — confirmation in ~5s |
maxFeePerGas | Ready-to-use hex value for eth_sendTransaction |
maxPriorityFeePerGas | Ready-to-use hex tip for eth_sendTransaction |
dApp — Auto gas before transaction
Fetch the oracle before sending a transaction and pass the hex values directly into the request. No manual Gwei math needed.
async function sendWithAutoGas(to, data) {
// 1. Get current fee recommendations
const gas = await fetch("https://rpc-litvm.pro/api/gas").then(r => r.json());
// 2. Pick tier: "safe" | "standard" | "fast"
const tier = gas.tiers.standard;
// 3. Send — maxFeePerGas and maxPriorityFeePerGas are ready-to-use hex strings
const txHash = await window.ethereum.request({
method: "eth_sendTransaction",
params: [{
from: await ethereum.request({ method: "eth_requestAccounts" }).then(a => a[0]),
to,
data,
maxFeePerGas: tier.maxFeePerGas,
maxPriorityFeePerGas: tier.maxPriorityFeePerGas,
}],
});
console.log("Sent:", txHash);
return txHash;
}
import { JsonRpcProvider, Wallet, parseUnits } from "ethers";
const provider = new JsonRpcProvider("https://rpc-litvm.pro");
const signer = new Wallet("0xYOUR_PRIVATE_KEY", provider);
async function sendWithAutoGas(to, value) {
const gas = await fetch("https://rpc-litvm.pro/api/gas").then(r => r.json());
const tier = gas.tiers.standard;
const tx = await signer.sendTransaction({
to,
value,
maxFeePerGas: tier.maxFeePerGas,
maxPriorityFeePerGas: tier.maxPriorityFeePerGas,
});
console.log("Tx hash:", tx.hash);
await tx.wait();
console.log("Confirmed in block:", tx.blockNumber);
}
import { createWalletClient, http, defineChain, parseEther } from "viem";
import { privateKeyToAccount } from "viem/accounts";
const litvm = defineChain({
id: 4441,
name: "LitVM RPC PRO",
nativeCurrency: { name: "zkLTC", symbol: "zkLTC", decimals: 18 },
rpcUrls: { default: { http: ["https://rpc-litvm.pro"] } },
});
const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY");
const client = createWalletClient({ account, chain: litvm, transport: http() });
async function sendWithAutoGas(to, value) {
const gas = await fetch("https://rpc-litvm.pro/api/gas").then(r => r.json());
const tier = gas.tiers.standard;
const hash = await client.sendTransaction({
to,
value,
maxFeePerGas: BigInt(tier.maxFeePerGas),
maxPriorityFeePerGas: BigInt(tier.maxPriorityFeePerGas),
});
console.log("Tx hash:", hash);
}
Bot / Script — Dynamic gas under load
Bots that send many transactions benefit from dynamically adjusting gas based on network conditions. Poll the oracle periodically and switch tiers based on urgency.
import requests
from web3 import Web3
RPC = "https://rpc-litvm.pro"
w3 = Web3(Web3.HTTPProvider(RPC))
def get_gas(tier="standard"):
"""Fetch live fee recommendation. tier: 'safe' | 'standard' | 'fast'"""
data = requests.get(f"{RPC}/api/gas").json()
t = data["tiers"][tier]
return {
"maxFeePerGas": int(t["maxFeePerGas"], 16),
"maxPriorityFeePerGas": int(t["maxPriorityFeePerGas"], 16),
}
def send_tx(private_key, to, value_wei, urgency="standard"):
account = w3.eth.account.from_key(private_key)
gas = get_gas(urgency)
tx = {
"from": account.address,
"to": to,
"value": value_wei,
"nonce": w3.eth.get_transaction_count(account.address),
"gas": 21000,
"maxFeePerGas": gas["maxFeePerGas"],
"maxPriorityFeePerGas": gas["maxPriorityFeePerGas"],
"chainId": 4441,
"type": 2,
}
signed = account.sign_transaction(tx)
tx_hash = w3.eth.send_raw_transaction(signed.raw_transaction)
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
print(f"Confirmed in block {receipt['blockNumber']}, status={receipt['status']}")
return receipt
# Usage:
# Normal bot cycle — standard speed
send_tx(PRIVATE_KEY, RECIPIENT, w3.to_wei(0.01, "ether"), urgency="standard")
# Time-sensitive arb — fast
send_tx(PRIVATE_KEY, RECIPIENT, w3.to_wei(0.01, "ether"), urgency="fast")
import requests
def get_gas_oracle(tier="standard"):
res = requests.get("https://rpc-litvm.pro/api/gas").json()
t = res["tiers"][tier]
return {
"maxFeePerGasHex": t["maxFeePerGas"],
"maxPriorityFeePerGasHex": t["maxPriorityFeePerGas"],
"gwei": t["maxFeePerGasGwei"],
"estimatedSeconds": t["estimatedSeconds"],
}
# Example: pick fast tier when latency matters
g = get_gas_oracle("fast")
print(f"Fast: {g['gwei']} Gwei — confirms in ~{g['estimatedSeconds']}s")
# → Fast: 0.065 Gwei — confirms in ~5s
Tip: The oracle response is cached for 10 seconds server-side. Fetching it every transaction is safe — you won't be rate limited by this endpoint even on the Free tier.
WebSocket
WebSocket subscriptions are available on Builder tier and above. Connect to wss://rpc-litvm.pro/ws with your API key as a query param.
const ws = new WebSocket("wss://rpc-litvm.pro/ws?key=YOUR_KEY");
ws.onopen = () => {
// Subscribe to new block headers
ws.send(JSON.stringify({
jsonrpc: "2.0",
method: "eth_subscribe",
params: ["newHeads"],
id: 1
}));
};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log("New block:", data.params?.result?.number);
};
Available Subscriptions
| Subscription | Description | Min Tier |
|---|---|---|
newHeads | New block headers | Builder |
newPendingTransactions | Pending tx hashes | Trader |
logs | Filtered event logs | Builder |
TypeScript / JavaScript SDK
The official @litvm/sdk package wraps the gateway into a typed viem transport. Drop it into any EVM project — no manual fetch, no header wrangling.
npm: npm install @litvm/sdk viem · Works with viem ≥ 2.0, wagmi, RainbowKit, ethers v6 adapter.
Installation
npm install @litvm/sdk viem
Public access (no key)
Free tier — 10 req/s, no registration needed.
import { createPublicClient } from "viem";
import { liteforgeTestnet, litvmHttp } from "@litvm/sdk";
const client = createPublicClient({
chain: liteforgeTestnet,
transport: litvmHttp(),
});
const blockNumber = await client.getBlockNumber();
const balance = await client.getBalance({ address: "0xYourAddress" });
Authenticated (with API key)
Unlocks /private-rpc, higher rate limits, and full method access.
import { createPublicClient } from "viem";
import { liteforgeTestnet, litvmHttp } from "@litvm/sdk";
const client = createPublicClient({
chain: liteforgeTestnet,
transport: litvmHttp({ apiKey: "lrpc_your_key_here" }),
});
const block = await client.getBlock({ blockTag: "latest" });
Compute Unit tracking
Every response carries X-CU-* headers. Pass onCu to track usage in real time.
import { createPublicClient } from "viem";
import { liteforgeTestnet, litvmHttp } from "@litvm/sdk";
import type { CuInfo } from "@litvm/sdk";
const client = createPublicClient({
chain: liteforgeTestnet,
transport: litvmHttp({
apiKey: "lrpc_your_key_here",
onCu: (cu: CuInfo) => {
console.log(`CU used: ${cu.used} / ${cu.limit} (this call: ${cu.cost})`);
},
}),
});
WebSocket subscriptions
Requires Builder tier or above.
import { createPublicClient } from "viem";
import { liteforgeTestnet, litvmWebSocket } from "@litvm/sdk";
const client = createPublicClient({
chain: liteforgeTestnet,
transport: litvmWebSocket({ apiKey: "lrpc_your_key_here" }),
});
// Real-time block subscription
const unwatch = client.watchBlocks({
onBlock: (block) => console.log("New block:", block.number),
});
Chain object
Use liteforgeTestnet anywhere a viem chain is expected — wagmi config, wallet connectors, ethers adapter.
| Export | Type | Description |
|---|---|---|
liteforgeTestnet | Chain | Chain definition (id 4441) |
litvmHttp(opts?) | Transport | HTTP transport with optional API key and CU callback |
litvmWebSocket(opts) | Transport | WebSocket transport (Builder+ required) |
CuInfo | Type | { cost, limit, used, remaining } |
MCP Server
MCP (Model Context Protocol) is an open protocol by Anthropic that lets AI assistants — Claude Desktop, Cursor, Windsurf, and any other MCP client — call tools and query data through a standardized interface. The LitVM MCP Server gives your AI direct access to the LiteForge node: ask for balances, blocks, gas prices, and account analytics right from chat.
Available on: Builder, Trader, Bot, Infrastructure, and Enterprise tiers. Blockchain tools also work on Free tier (no API key needed).
Installation
The MCP Server ships with the gateway — install Bun, then point your MCP client at the src/mcp.ts file from the project directory.
Prerequisite: Install Bun — curl -fsSL https://bun.sh/install | bash
Claude Desktop
Edit the Claude Desktop config file — create it if it doesn't exist:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"litvm-rpc": {
"command": "bun",
"args": ["run", "/absolute/path/to/src/mcp.ts"],
"env": {
"MCP_API_KEY": "lrpc_your_key_here",
"RPC_BASE_URL": "https://rpc-litvm.pro"
}
}
}
}
Replace /absolute/path/to/src/mcp.ts with the real path on your machine. Restart Claude Desktop — tools appear automatically.
Cursor
Open Settings → Features → MCP Servers → Add new MCP server and paste:
{
"name": "litvm-rpc",
"command": "bun",
"args": ["run", "/absolute/path/to/src/mcp.ts"],
"env": {
"MCP_API_KEY": "lrpc_your_key_here",
"RPC_BASE_URL": "https://rpc-litvm.pro"
}
}
Windsurf
Edit ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"litvm-rpc": {
"command": "bun",
"args": ["run", "/absolute/path/to/src/mcp.ts"],
"env": {
"MCP_API_KEY": "lrpc_your_key_here",
"RPC_BASE_URL": "https://rpc-litvm.pro"
}
}
}
}
Environment Variables
| Variable | Default | Description |
|---|---|---|
RPC_BASE_URL | http://localhost:3000 | URL of the RPC gateway |
MCP_API_KEY | empty | Your lrpc_... key — enables private endpoint and account tools |
Available Tools
Blockchain — work without an API key (public endpoint):
| Tool | Description |
|---|---|
eth_blockNumber | Latest block number |
eth_getBalance | Address balance in wei and LTC |
eth_getTransactionByHash | Transaction details by hash |
eth_getTransactionReceipt | Receipt: status, gas used, logs |
eth_getBlockByNumber | Block data by number or tag |
eth_call | Read-only contract call (view/pure) |
eth_estimateGas | Gas estimate for a transaction |
eth_getCode | Contract bytecode at address |
eth_getTransactionCount | Nonce of an address |
Service — no API key needed:
| Tool | Description |
|---|---|
get_gas_prices | Current gas prices: safe / standard / fast |
get_service_status | Upstream health: latency, block height, lag |
get_metrics | RPS, cache hit rate, average latency |
get_cu_weights | CU cost table for all methods |
Account — require MCP_API_KEY:
| Tool | Description |
|---|---|
get_account | Tier, wallet, key count, limits |
get_usage | CU used today, daily limit, request count |
get_analytics | Top methods, latency breakdown, cache hit rate |
Example prompts
What's the latest block on LiteForge?
What's the balance of 0xAbC...?
Show details for transaction 0x123...
What's the current gas price?
How many CU have I used today?
Is the RPC node healthy?
Error Codes
LitVM RPC follows JSON-RPC 2.0 error format with additional gateway-specific codes.
| Code | Message | Meaning |
|---|---|---|
-32700 | Parse error | Invalid JSON |
-32600 | Invalid request | Missing required fields |
-32601 | Method not found | Unsupported or blocked method |
-32001 | Invalid API key | Key not found or inactive |
-32002 | Tier insufficient | Method requires higher tier |
-32003 | Rate limited | Too many requests, slow down |
-32005 | Daily limit exceeded | Upgrade tier or wait 24h |