Helius provides Solana RPC and enhanced APIs. This tutorial shows how to sign up, get an API key, configure the Helius RPC URL, and make standard JSON-RPC calls. It also explains WebSocket and gRPC options, common troubleshooting steps, and factors to consider when comparing Helius with other Solana RPC providers.
What Is Helius and Why Use It for Solana RPC?
Helius is a Solana infrastructure provider that offers RPC nodes, enhanced APIs, webhooks, and other developer tools. For developers building on Solana, Helius can serve as the RPC endpoint that connects your application to the Solana blockchain.
A standard Solana RPC endpoint lets you read blockchain data and submit transactions. Helius adds features such as enhanced transaction parsing, priority fee estimates, and DAS (Digital Asset Standard) APIs. This tutorial focuses on the core RPC connectivity so you can start making calls quickly.
Before you begin, you will need a Helius account and an API key. The free tier is typically sufficient for development and testing, though rate limits and feature availability may change. Always check the official Helius documentation for the most current details.
- Helius offers Solana RPC endpoints with optional enhanced APIs.
- You need an API key to authenticate requests.
- Free and paid plans are available; check current pricing and limits on the Helius website.
- This tutorial covers the RPC basics, not every Helius feature.
Step 1: Create a Helius Account and Get an API Key
To start using Helius RPC, go to the Helius website and sign up for an account. After verifying your email, log in to the dashboard. The dashboard provides your API key and the RPC endpoints you can use.
Your API key is a long string that authenticates your requests. Treat it like a password. Do not commit it to public repositories or expose it in client-side code. For production applications, use environment variables or a secrets manager.
Helius typically provides both a mainnet and a devnet endpoint. The mainnet endpoint connects to Solana's main network, while devnet is for testing. The exact URL format may include your API key as a query parameter or as part of the path. Always copy the URL directly from the dashboard to avoid mistakes.
- Sign up at the Helius website and verify your email.
- Find your API key in the Helius dashboard.
- Copy the RPC URL for mainnet or devnet as needed.
- Store your API key securely; never expose it publicly.
Step 2: Configure the Helius RPC URL
The Helius RPC URL is the endpoint your application will send JSON-RPC requests to. It usually looks like a standard HTTPS URL with your API key embedded. For example, a mainnet endpoint might be:
If you are using a library like solana-web3.js, you can pass this URL when creating a connection. In other languages, you will send HTTP POST requests to this URL with a JSON body.
Some Helius endpoints also support WebSocket connections for subscriptions. The WebSocket URL is often the same as the HTTP URL but with wss:// instead of https://. Check your dashboard for the exact WebSocket endpoint.
- Use the HTTPS URL for standard JSON-RPC calls.
- Use the WSS URL for WebSocket subscriptions.
- Keep your API key in the URL or in an authorization header, depending on the endpoint format.
- Do not share your full RPC URL publicly; it contains your API key.
https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEYStep 3: Make Your First JSON-RPC Call
Solana RPC uses JSON-RPC 2.0. You can test your Helius endpoint with a simple curl command. The example below requests the current slot from the Solana network.
If everything is configured correctly, you will receive a JSON response with the current slot number. If you get an error, check that your API key is correct and that you are using the right network (mainnet vs devnet).
You can also use the Solana CLI to test your endpoint. Set the RPC URL with the solana config set command, then run solana slot. This is a quick way to verify connectivity without writing code.
- Use curl or a similar tool to send a POST request to your Helius RPC URL.
- The method getSlot returns the current slot.
- Check the response for errors and verify the result.
- Use the Solana CLI for a quick connectivity test.
curl https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1,"method":"getSlot","params":[]}'Step 4: Connect with Solana Web3.js
Most Solana developers use a client library. In JavaScript, solana-web3.js is common. After installing the package, you can create a connection using your Helius RPC URL.
This code snippet creates a connection and fetches the latest blockhash. You can replace the method with any other Solana RPC method, such as getBalance or getAccountInfo.
Remember to keep your API key out of source control. Use environment variables and load them at runtime.
- Install @solana/web3.js with npm or yarn.
- Create a Connection object with your Helius RPC URL.
- Call connection methods to interact with Solana.
- Never hardcode your API key in client-side code.
const { Connection, clusterApiUrl } = require('@solana/web3.js');
const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=YOUR_API_KEY');
connection.getLatestBlockhash().then(console.log);Step 5: Using WebSockets and gRPC with Helius
Helius supports WebSocket subscriptions, which allow you to receive real-time updates for account changes, slots, and other events. To use WebSockets, connect to the WSS endpoint provided in your dashboard.
Helius also offers gRPC for high-performance streaming. gRPC is useful for applications that need low-latency data, such as trading bots or real-time dashboards. The gRPC endpoint and authentication details are available in the Helius dashboard.
WebSocket and gRPC usage may have different rate limits or require specific plan tiers. Check the Helius documentation for current capabilities.
- Use WSS for WebSocket subscriptions.
- Use gRPC for high-throughput streaming data.
- Endpoints and authentication details are in the dashboard.
- Plan limits may apply to WebSocket and gRPC usage.
Common Issues and Troubleshooting
If your requests fail, start by checking the HTTP status code and the JSON error message. A 401 or 403 usually means your API key is missing or invalid. A 429 indicates rate limiting; you may need to slow down or upgrade your plan.
Network errors can occur if you are using the wrong endpoint (mainnet vs devnet) or if your IP is blocked. Ensure your firewall allows outbound HTTPS and WSS traffic.
For WebSocket issues, verify that you are using the correct WSS URL and that your client library supports the subscription methods you need. Some libraries require additional configuration for WebSocket connections.
- Check for 401/403 errors: invalid or missing API key.
- Check for 429 errors: rate limit exceeded.
- Verify you are using the correct network endpoint.
- Ensure your firewall allows outbound connections.
- For WebSockets, confirm the WSS URL and client support.
Helius RPC Review: What to Consider
When evaluating Helius as your Solana RPC provider, consider factors like reliability, latency, feature set, and cost. Helius is known for its enhanced APIs and developer-friendly tools, but it is not the only option.
If you need a provider with a strong focus on multi-chain support and predictable performance, OnFinality is a defensible alternative for some teams. However, for Solana-specific enhanced features, Helius may be a better fit. Always test providers with your own workload.
Pricing and rate limits can change. Check the Helius website for current plans. Free tiers are often available for development, but production applications may require a paid plan.
- Consider reliability, latency, features, and cost.
- Helius offers Solana-specific enhanced APIs.
- OnFinality is a multi-chain provider worth considering for some use cases.
- Test providers with your own workload before committing.
- Verify current pricing and limits on the provider's website.
Next Steps and Best Practices
Once you have basic RPC calls working, explore Helius's enhanced APIs for transaction parsing, NFT data, and webhooks. These can save development time for common Solana use cases.
For production, implement retry logic with exponential backoff, monitor your RPC usage, and consider using multiple providers for redundancy. Keep your API keys secure and rotate them if they are compromised.
Stay updated with Helius's documentation and changelog, as new features and endpoints are added regularly.
- Explore Helius enhanced APIs for Solana-specific data.
- Implement retries and monitoring for production.
- Consider multiple RPC providers for redundancy.
- Secure and rotate API keys as needed.
- Follow Helius documentation for updates.