
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
@quicknode/x402-solana
Advanced tools
Connect to the Solana blockchain using a Solana wallet (no API keys or accounts needed)
Use Solana Kit with QuickNode's RPC — no account, no API key, no subscription needed. Just a Solana wallet file with some USDC. Payments are made automatically per-request using the x402 protocol.
npm install @quicknode/x402-solana
import { createSolanaX402Clients } from "@quicknode/x402-solana";
import { address } from "@solana/kit";
import { homedir } from "node:os";
const keyPairFile = `${homedir()}/.config/solana/id.json`;
const { rpc, rpcSubscriptions } = await createSolanaX402Clients(
"mainnet",
keyPairFile,
);
const balance = await rpc
.getBalance(address("dDCQNnDmNbFVi8cQhKAgXhyhXeJ625tvwsunRyRc7c8"))
.send();
console.log("Balance:", balance.value);
Solana Kite wraps Solana Kit with a simpler API:
import { createSolanaX402Clients } from "@quicknode/x402-solana";
import { connect, loadWalletFromFile } from "solana-kite";
import { homedir } from "node:os";
const keyPairFile = `${homedir()}/.config/solana/id.json`;
const { rpc, rpcSubscriptions } = await createSolanaX402Clients(
"mainnet",
keyPairFile,
);
const connection = connect(rpc, rpcSubscriptions);
const wallet = await loadWalletFromFile(keyPairFile);
const balance = await connection.getBalance(wallet.address);
console.log("Balance:", balance);
createSolanaX402Clients(network, keyPairFile, options?)Creates Solana RPC and WebSocket subscription clients that pay per-request via x402.
network — "mainnet" | "testnet" | "devnet" — Solana network to connect tokeyPairFile — string — Path to a Solana keypair JSON fileoptions.paymentNetwork — "mainnet" | "testnet" | "devnet" — Network used for USDC payments. Defaults to the same network as network.options.paymentModel — "credit-drawdown" | "pay-per-request" — Payment model to use. Defaults to "credit-drawdown".Returns { rpc, rpcSubscriptions }.
credit-drawdown (default) — authenticate once via SIWX, buy a bundle of credits with USDC, then consume credits across requests. Mainnet bundles require a minimum of $10 USDC in your wallet. Devnet bundles are available from $0.01. See the Quicknode x402 guide for more details.
pay-per-request — pay individually for each request with no minimum bundle size. Bypasses SIWX/JWT session management entirely.
Example: connect to mainnet, pay with devnet USDC
const { rpc, rpcSubscriptions } = await createSolanaX402Clients(
"mainnet",
keyPairFile,
{ paymentNetwork: "devnet" },
);
Example: pay per request instead of using a credit bundle
const { rpc, rpcSubscriptions } = await createSolanaX402Clients(
"mainnet",
keyPairFile,
{ paymentModel: "pay-per-request" },
);
See the Quicknode x402 guide for more information on using X402 with Quicknode.
~/.config/solana/id.json — the default location used by the Solana CLI)credit-drawdown model; from $0.01 on devnet)No QuickNode account or API key required. For testing, devnet USDC can pay for mainnet requests by passing { paymentNetwork: "devnet" }.
npm test
Integration tests (live RPC calls) run automatically when ~/.config/solana/id.json exists with devnet USDC. They are skipped otherwise.
For CI, store your keypair JSON as a SOLANA_KEYPAIR repository secret.
npm run build
Compiles TypeScript to dist/ with declaration files.
FAQs
Connect to the Solana blockchain using a Solana wallet (no API keys or accounts needed)
We found that @quicknode/x402-solana demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 28 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.