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 NameLitVM RPC PRO
Chain ID4441
Gas TokenzkLTC
HTTP RPChttps://rpc-litvm.pro
WebSocket RPCwss://rpc-litvm.pro/ws
Block Explorerhttps://explorer.litvm.io

Get Your API Key

API keys are issued via wallet signature — no email or password needed.

  1. Connect Wallet

    Go to the Dashboard and click "Connect Wallet". MetaMask, Rabby, or any EIP-1193 wallet works.

  2. Sign Message

    Sign the authentication message. This proves wallet ownership without spending gas.

  3. Receive API Key

    Your key is generated instantly. Store it — the recommended way to use it is the X-API-Key header. Avoid putting API keys in URLs because they leak into logs and browser history.

  4. 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:

MethodExample
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

TierRate LimitDaily LimitWebSocketPrice
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

JSON-RPC Request
{
  "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:

TierMax Batch Size
Free5
Builder20
Trader50
Bot50
Infrastructure100
Enterprise1000
Batch Example
[
  {"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1},
  {"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":2}
]

Code Examples

cURL

Shell
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)

JavaScript
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

JavaScript
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

JavaScript
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)

Python
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.

Endpoint
GET https://rpc-litvm.pro/api/gas
Response
{
  "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  }
  }
}
FieldDescription
baseFeeGweiNext block base fee in Gwei
tiers.safeLow priority, cheaper — confirmation in ~30s
tiers.standardTypical priority — confirmation in ~15s
tiers.fastHigh priority — confirmation in ~5s
maxFeePerGasReady-to-use hex value for eth_sendTransaction
maxPriorityFeePerGasReady-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.

JavaScript — with MetaMask / EIP-1193 wallet
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;
}
JavaScript — with ethers.js v6
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);
}
JavaScript — with viem
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.

Python — web3.py
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")
Python — requests only (no web3.py)
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.

WebSocket Connection
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

SubscriptionDescriptionMin Tier
newHeadsNew block headersBuilder
newPendingTransactionsPending tx hashesTrader
logsFiltered event logsBuilder

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

Shell
npm install @litvm/sdk viem

Public access (no key)

Free tier — 10 req/s, no registration needed.

TypeScript
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.

TypeScript
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.

TypeScript
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.

TypeScript
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.

ExportTypeDescription
liteforgeTestnetChainChain definition (id 4441)
litvmHttp(opts?)TransportHTTP transport with optional API key and CU callback
litvmWebSocket(opts)TransportWebSocket transport (Builder+ required)
CuInfoType{ 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:

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:

Cursor MCP Config
{
  "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:

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

VariableDefaultDescription
RPC_BASE_URLhttp://localhost:3000URL of the RPC gateway
MCP_API_KEYemptyYour lrpc_... key — enables private endpoint and account tools

Available Tools

Blockchain — work without an API key (public endpoint):

ToolDescription
eth_blockNumberLatest block number
eth_getBalanceAddress balance in wei and LTC
eth_getTransactionByHashTransaction details by hash
eth_getTransactionReceiptReceipt: status, gas used, logs
eth_getBlockByNumberBlock data by number or tag
eth_callRead-only contract call (view/pure)
eth_estimateGasGas estimate for a transaction
eth_getCodeContract bytecode at address
eth_getTransactionCountNonce of an address

Service — no API key needed:

ToolDescription
get_gas_pricesCurrent gas prices: safe / standard / fast
get_service_statusUpstream health: latency, block height, lag
get_metricsRPS, cache hit rate, average latency
get_cu_weightsCU cost table for all methods

Account — require MCP_API_KEY:

ToolDescription
get_accountTier, wallet, key count, limits
get_usageCU used today, daily limit, request count
get_analyticsTop methods, latency breakdown, cache hit rate

Example prompts

Chat with Claude
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.

CodeMessageMeaning
-32700Parse errorInvalid JSON
-32600Invalid requestMissing required fields
-32601Method not foundUnsupported or blocked method
-32001Invalid API keyKey not found or inactive
-32002Tier insufficientMethod requires higher tier
-32003Rate limitedToo many requests, slow down
-32005Daily limit exceededUpgrade tier or wait 24h

Support Assistant

Ask about setup, pricing, keys, WebSocket, CU, or troubleshooting.

Connect a paid key in the dashboard if you want account-specific usage and analytics answers. Open Dashboard