Protect Your Solana API Keys: Security Best Practices
Secure your Helius Solana API keys from malicious actors. Access control rules, RPC proxy, and security best practices to prevent unauthorized usage and charges.
API Key Security Alert: Exposed API keys can lead to unauthorized usage, quota exhaustion, and unexpected charges. Always protect your keys in production applications.
Why Key Protection Matters
When you expose API keys on the client side, malicious actors can discover and abuse them, potentially:
Exhaust Your Quota
Malicious usage can quickly consume your API limits and cause service interruptions
Increase Your Bills
Unauthorized requests can trigger auto-scaling charges or push you over plan limits
Compromise Security
Exposed keys can provide access to sensitive data and operations
Damage Performance
High unauthorized usage can impact your application’s performance
Protection Methods
Helius provides multiple layers of protection to secure your API keys:
Deploy your own proxy for maximum security and control.
Helius RPC Proxy
A simple, open-source RPC proxy that you can deploy with 1-click to Cloudflare.
Benefits of Using a Proxy
Complete Key Protection
Your API key stays server-side, never exposed to clients
Custom Rate Limiting
Implement your own rate limiting and usage controls
Request Filtering
Filter and validate requests before they reach Helius
Usage Analytics
Monitor and analyze your API usage patterns
Deploy your own proxy for maximum security and control.
Helius RPC Proxy
A simple, open-source RPC proxy that you can deploy with 1-click to Cloudflare.
Benefits of Using a Proxy
Complete Key Protection
Your API key stays server-side, never exposed to clients
Custom Rate Limiting
Implement your own rate limiting and usage controls
Request Filtering
Filter and validate requests before they reach Helius
Usage Analytics
Monitor and analyze your API usage patterns
Configure precise access controls in your Helius dashboard to restrict API usage.
Configure RPC Access Control Rules in the Endpoints section of your dashboard.
Available Rule Types
Allowed Domains
Allowed Domains
Restrict access to specific domains - perfect for web applications.
Use cases:
- Production websites (
yourdapp.com
) - Development environments (
localhost:3000
) - Staging environments (
staging.yourdapp.com
)
Example configuration:
Allowed IPs
Allowed IPs
Restrict access to specific IP addresses - ideal for server applications.
Use cases:
- Backend servers with static IPs
- CI/CD pipelines
- Specific development machines
Example configuration:
Allowed CIDRs
Allowed CIDRs
Restrict access to IP ranges using CIDR notation - great for enterprise networks.
Use cases:
- Corporate networks
- Cloud provider IP ranges
- Private networks
Example configuration:
Use our secure URL for frontend applications without exposing your API key.
Rate Limited: Secure URLs are limited to 5 transactions per second (TPS) per IP address, making them perfect for frontend applications.
How to Use Secure URLs
Get Your Secure URL
Find your secure URL in the Helius dashboard under the Endpoints section
Replace Your Regular RPC URL
Use the secure URL instead of your regular RPC URL with API key
No API Key Required
The secure URL doesn’t require an API key parameter
Perfect for: Frontend applications, mobile apps, and any client-side code where you can’t hide the API key.
Best Practices
Environment Variables
Never hardcode API keys in your source code. Use environment variables instead.
Separate Keys for Different Environments
Use different API keys for development, staging, and production environments.
Regular Key Rotation
Rotate your API keys regularly and immediately if you suspect they’ve been compromised.
Generate New Key
Create a new API key in your Helius dashboard
Update Applications
Update all applications to use the new key
Test Thoroughly
Ensure all services are working with the new key
Revoke Old Key
Delete the old key from your dashboard
Monitor Usage
Regularly check your API usage in the Helius dashboard for unusual patterns.
Red flags to watch for:
- Sudden spikes in usage
- Requests from unexpected locations
- High error rates
- Usage during off-hours
Security Checklist
✅ Development Security
✅ Development Security
- Use environment variables for API keys
- Never commit API keys to version control
- Use different keys for different environments
- Set up access control rules for development domains
- Use secure URLs for frontend development
✅ Production Security
✅ Production Security
- Implement proper access control rules
- Use RPC proxy for maximum security
- Monitor API usage regularly
- Set up alerts for unusual usage patterns
- Rotate keys regularly
- Document your security procedures
✅ Emergency Response
✅ Emergency Response
- Have a key rotation procedure ready
- Know how to quickly revoke compromised keys
- Monitor for security breaches
- Have contact information for Helius support
- Keep backups of your security configurations
Common Mistakes to Avoid
Avoid these common security pitfalls:
- Hardcoding keys in frontend JavaScript - Always use secure URLs or proxies
- Committing keys to Git repositories - Use environment variables and
.gitignore
- Using production keys for development - Separate keys for different environments
- Not setting access control rules - Always configure domain/IP restrictions
- Ignoring unusual usage patterns - Monitor your dashboard regularly