forked from helius-labs/helius-rpc-proxy
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from helium/feat/session-key-updates
Updating session-key validation
- Loading branch information
Showing
13 changed files
with
68 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,7 @@ | ||
# Helius RPC Proxy | ||
# RPC Proxy for Helius | ||
|
||
[![RPC Proxy](docs/rpc_proxy.png)](https://helius.xyz) | ||
The RPC Proxy is handled by a Cloudflare Worker. | ||
|
||
This repo hosts a one-click-deploy Cloudflare worker that proxies RPC requests to Helius. The proxy will allow you to keep your API key | ||
hidden from public requests made by clients. You will need both a [Helius](https://helius.xyz) account and a [Cloudflare](https://cloudflare.com) account to deploy this. Helius offers 100k credits for free each month, and Cloudflare workers can execute 100k invocations each day for free. Most projects can easily get started within these free tiers. | ||
Within Cloudflare, the `rpc-proxy-staging` worker denotes the worker corresponding to the Solana Devnet environment. Deployments to the staging RPC Proxy occur directly via GitHub Actions when PRs are merged to Main and on successful completion of the test suite. | ||
|
||
Both standard JSON RPC and Websockets are supported! | ||
|
||
[Video Walkthrough](https://www.loom.com/share/a7add579f1c349d2a4bcab96ee04c47e) | ||
|
||
# Setup | ||
### Step 1 | ||
|
||
Press the button below to deploy this to your own Cloudflare account: | ||
|
||
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/helius-labs/helius-rpc-proxy) | ||
|
||
### Step 2 | ||
|
||
Navigate to your newly deployed worker, and click "Settings" and then "Variables": | ||
|
||
![Variables](docs/add_variable.png) | ||
|
||
### Step 3 | ||
Add a new variable with the key name `HELIUS_API_KEY` and your Helius API key as the value: | ||
|
||
![Add Secret](docs/add_secret.png) | ||
|
||
> NOTE: We recommend selecting "Encrypt". This will hide your key from the UI and API responses, and redact them from logs. | ||
![Encrypt](docs/encrypt.png) | ||
|
||
### Step 4 | ||
Refresh the page and confirm that your key is now saved and encrypted: | ||
|
||
![Confirm](docs/confirm.png) | ||
|
||
You can now use your worker URL as an the RPC endpoint in all SDK and client side configurations without your API key leaking! | ||
# Additional Security Steps | ||
This implementation is intentionally left in a less-than-ideal security state to facilitate easy deployment by anyone. If you would like to | ||
lock down your RPC proxy further, consider the following steps after you have successfully deployed the worker: | ||
|
||
|
||
* Update the `Access-Control-Allow-Origin` header by adding a new variable with the key name `CORS_ALLOW_ORIGIN` to contain the host that your requests are coming from (usually your client application). For example, if you wanted to allow requests from `https://example.com`, you would change the header to `https://example.com`. | ||
* [Cloudflare Web Application Firewall (WAF)](https://www.cloudflare.com/lp/ppc/waf-x/) - You can configure the WAF to inspect requests and allow/deny based on your own business logic. | ||
* Modify the IP address allow list in Helius for your API key to only accept connections from the Cloudflare ranges (https://cloudflare.com/ips-v4). | ||
Similarly, the `rpc-proxy` worker denotes the worker corresponding to the Solana Mainnet environment. Deployments to the production RPC Proxy occur manually via the GitHub Actions control plane and can only be performed by those with requisite permissions and only after successful completion of the test suite. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters