← Protocols
Lava Network
RPC / Node·EVM · Cosmos · Solana · Starknet · Multi-chain

Lava Network

01Description

Modular, decentralized RPC routing protocol that directs dApp, exchange, and AI-agent traffic to the fastest, most reliable data providers across 40+ chains, with a JS/TS SDK for in-browser pairing.

02Best for
  • 01decentralized RPC with QoS-based pairing
  • 02in-browser SDK access without a hosted gateway
  • 03Cosmos-SDK and EVM chain coverage
  • 04AI-agent data plane
  • 05modular access layer for new chains
03Install
  • pnpm add @lavanet/lava-sdk
04Environment variables
VariableScopeDescription
LAVA_BADGE_API_KEYServerLava badge / project ID from the gateway portal, used to pair the SDK with a billing account. Server-side only.
LAVA_PROJECT_IDServerLava project identifier paired with the badge. Server-side only.
05Prompt snippet
Use `@lavanet/lava-sdk` to talk to Lava's decentralized RPC layer. Initialize: `const lava = await LavaSDK.create({ badge: { badgeServerAddress: '<server>', projectId: process.env.LAVA_PROJECT_ID }, chainIds: ['ETH1'] })`. Send requests via `lava.sendRelay({ method: 'eth_blockNumber', params: [] })`. Chain IDs are Lava's own enum (e.g. `ETH1`, `LAV1` for Lava chain itself, `STRK` for Starknet, `SOLANA`) — they are NOT EVM chain IDs. The SDK handles provider pairing, signing relays, and QoS scoring; relays are paid in LAVA tokens via your project's subscription. For pure JSON-RPC compatibility (no SDK), use a Lava-hosted gateway URL provided in the portal as a regular HTTPS endpoint.
06Gotchas
  • Lava chain IDs (e.g. `ETH1`, `STRK`, `LAV1`) are not the same as EVM chain IDs — passing `1` for Ethereum mainnet will throw. Check `docs.lavanet.xyz` for the per-chain enum.
  • The badge server pattern means the SDK still needs a centralized signer for project billing — fully trustless usage requires running your own consumer process and signing relays directly.
  • Provider pairing is QoS-based and rotates — archive-mode requests can land on a provider without archive history and 405; pin chain `apiInterface` (e.g. `jsonrpc`, `rest`, `tendermintrpc`) and check provider capabilities.
  • Free-tier subscriptions have monthly relay caps; AI-agent workloads with chatty polling hit them quickly and need batching.
  • Decentralized vs centralized trust: relays are signed by independent providers and verified by the SDK, but a single faulty provider can return stale state during reorgs — use multi-provider conflict detection for critical reads.
  • Regional latency depends on the active provider set; in regions with thin pairing (e.g. APAC for some chains) p99 can spike — benchmark before relying on Lava for hot paths.
  • Cosmos-SDK chain coverage uses `tendermintrpc` and `rest` interfaces, not `jsonrpc` — passing the wrong interface returns malformed responses.
07Alternatives