BloxwapSmart Solana

Smart Solana

@bloxwap/smart-solana is an adaptive Solana JSON-RPC transport. It routes by measured provider latency and errors, stays on healthy sampled endpoints, and fails over when providers throttle or time out. Repeated reads can be answered from a local cache.

Install

bun add @bloxwap/smart-solana @solana/kit

npm, pnpm, and Yarn work too. Node.js 22.12 or later is required. The transport has zero runtime dependencies; install the Solana client you use.

Create a client

import { createSolanaRpcFromTransport } from "@solana/kit";
import { smartSolana } from "@bloxwap/smart-solana";

const transport = smartSolana();
const rpc = createSolanaRpcFromTransport(transport);

const slot = await rpc.getSlot().send();

With no arguments, smartSolana() uses nine keyless mainnet providers. Call transport.close() during application shutdown.

Defaults

FeatureDefault behavior
RoutingUses per-method latency, errors, and slot lag to select a healthy sampled endpoint.
FailoverRetries transport and provider errors, with endpoint cooldowns and circuit breakers.
HedgingCopies slow idempotent reads to another provider after 300 ms.
CoalescingShares identical in-flight reads.
BatchingCombines concurrent calls where provider support and latency measurements allow.
CacheServes recent reads and refreshes stale entries in the background.
ValidationChecks each endpoint's genesis hash before its first user request.

These defaults trade additional upstream requests for lower latency and better availability. Disable individual features when request cost or freshness matters more.

Next steps

Edit this page on GitHub