Okay, before you even think about coding, hit up dashboard.helius.dev, sign up-it's free to start-and snag your mainnet RPC URL right from the RPCs section. Looks like https://mainnet.helius rpc.com/?api=YOURAPIKEY. Why? 'Cause public ones throttle you hard, but this one's staked by default on paid plans, lands txs way better during congestion. I usually test it instantly with a version check. Boom, you're in.
Now, plug it into Solana web3.js like this:
import { Connection } from '@solana/web3.js';
const rpcUrl = 'https://mainnet.helius rpc.com/?api=yourkeyhere';
const connection = new Connection(rpcUrl);
Test? Run await connection.getVersion(). If it spits back Solana core version and current slot, you're golden. In my experience, this skips hours of "why isn't my wallet connecting" headaches.
Public Solana endpoints? They're fine for toy projects. But hit 'em with real traffic-say, tracking a hot memecoin-and they rate limit you to 5 TPS or less, drop requests, or just ghost. Helius? Globally distributed nodes, 95% faster responses, and staked connections mean your sendTransaction actually lands, even in pump.fun madness. Costs? Free tier for basics, then like 1 credit per tx send on staked (down from 10!).
The thing is, they got archival methods too-like getTransactionsForAddress-that paginate forever without choking. Public RPCs? Forget querying a whale's full history; you'll timeout.
https://mainnet.helius rpc.com/?api=-full power, but don't expose in frontend.https://abc-456-fast mainnet.helius rpc.com-IP limited to 5 TPS, safe for client side apps. No leak worries.https://devnet.helius rpc.com/?api=.Pick secure for your React dApp. I always do. Frontend bros won't burn your credits accidentally.
npm i @solana/web3.js.const testConnection = async () => { try { const version = await connection.getVersion(); const slot = await connection.getSlot(); console.log('Version:', version['solana core']); console.log('Slot:', slot); } catch (error) { console.error('Failed:', error); }
};
testConnection();
Run it. See numbers? Good. Error? Check your or internet. Common issue: Forgot ?api=. Happened to me twice last week.
What's next? Balance checks. Super basic, but you'll use it daily.
const balance = await connection.getBalance(new PublicKey('YourWalletAddressHere'));
console.log('Balance (lamports):', balance);
console.log('SOL:', balance / 1e9);
Lamports are Solana's atoms-1 SOL = 1e9 lamports. Why care? Gas is tiny, like ~0.000005 SOL per signature.
Hate polling every second for account changes? Websockets. Helius mainnet: wss://mainnet.helius rpc.com/?api=. Subscribe to accounts, signatures, slots, logs. Ping every 30-60s or it dies.
Here's a quick account sub:
const wsUrl = 'wss://mainnet.helius rpc.com/?api=';
const ws = new WebSocket(wsUrl); ws.onopen = () => { ws.send(JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'accountSubscribe', params: ['AddressHere', { encoding: 'base64' }] }));
}; ws.onmessage = (event) => { console.log('Update:', event.data);
};
In my experience, this catches tx confirms in <1s. Pro tip: Wrap in try catch; bad subs kill the socket. For business plans, grab transactionSubscribe-beta, but game changer for bots.
Standard getSignaturesForAddress? Limits to 1000 recent, no filters. Helius getTransactionsForAddress? Full history, filters, pagination. One call for signatures or full tx details.
| Param | What It Does |
|---|---|
transactionDetails | "signatures" (fast) or "full" (everything) |
sortOrder | "asc" (old->new) or "desc" |
filters.blockTime | {gte: timestamp, lt: timestamp} |
limit | Up to 1000 per page |
paginationToken | From prev response for next page |
Example curl for a wallet's succeeded txs last 24h:
curl https://mainnet.helius rpc.com/?api= -X POST -H "Content Type: application/json" -d '{ "jsonrpc": "2.0", "id": 1, "method": "getTransactionsForAddress", "params": ["WalletAddress", { "transactionDetails": "full", "filters": {"status": "succeeded"}, "limit": 100 }]
}'
Paginate like:
paginationToken from response.paginationToken: "that_token" to params.I built a whale tracker with this. Queried 10k+ txs in minutes. Filters save your ass-skip failed spam.
Biggest pain: Txs dropping in congestion. Helius staked endpoints fix it-no code change, just use their URL. Sender service? Parallel to Jito + Helius, 7 global pops, no credits. For traders/MEV.
Basic send:
const tx = // your transaction
const signature = await connection.sendTransaction(tx, [signer]);
await connection.confirmTransaction(signature);
During pumps? Add maxRetries: 5 to sendRawTransaction. Or simulate first: connection.simulateTransaction(tx). Spots fee issues early. Gas? ~0.000005 SOL, but priority fees spike it-check getRecentPrioritizationFees.
Issue: "Transaction simulation failed"? Wrong program ID or bad accounts. Log the sim error; it's gold.
Don't trust blindly. getHealth pings "ok" if synced within HEALTHCHECKSLOT_DISTANCE slots.
curl .. -d '{"jsonrpc":"2.0","id":1,"method":"getHealth"}'
Response: {"result": "ok"} or error. Poll every 30s for prod.
Wanna spy on the network? getClusterNodes-no params. Spits pubkeys, gossip/T PU/RPC ports, versions. Great for finding backups or topology maps.
{ "jsonrpc": "2.0", "id": 1, "method": "getClusterNodes"
}
Response array: Hundreds of nodes. Filter for rpc non null for alternates. But Helius is faster, so..
{"jsonrpc":"2.0","method":"ping"} every 60s.Too much boilerplate? Helius JS SDK: npm i helius sdk. Enhanced getProgramAccountsV2 with pagination, changedSinceSlot. Rust too.
import { Helius } from 'helius sdk';
const helius = new Helius('YOUR_KEY');
const txs = await helius.rpc.getTransactionsForAddress('address', {limit:100});
Auto paginates big queries. I usually swap to SDK after prototyping raw RPC.
Helius bundles DAS (Digital Asset Standard). getAsset for NFT details, searchAssets by owner/collection.
const url = https://rpc.helius.xyz/?api=;
fetch(url, {method:'POST', body: JSON.stringify({ "jsonrpc": "2.0", "id":1, "method":"getAsset", "params": ["assetMintHere"]
})});
Compressed NFTs? Filters handle it. Build a portfolio viewer in 20 lines.
Why does this matter? Solana NFTs move fast-real time subs + DAS = killer app.
Multiple keys? Dashboard lets you restrict IPs/domains. View usage via Datadog. Free tier? 1M credits/month-plenty for most.
Scale? Business plan unlocks Geyser websockets (faster than RPC WS). Beta transactionSubscribe-ping every min.
Costs add up on heavy archival? Cache results, use changedSinceSlot. Dropped my bills 70%.
Sound familiar? That "RPC too slow" rage. Helius fixed it for my bot. Now it prints during dumps. Your turn-code something dumb today, scale tomorrow.