-
Notifications
You must be signed in to change notification settings - Fork 79
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 #363 from subsquid/misc-fixes-by-abernatskiy-feb16
Misc fixes by abernatskiy feb16
- Loading branch information
Showing
9 changed files
with
232 additions
and
184 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
sidebar_position: 70 | ||
title: RPC proxy service | ||
description: Built-in RPC endpoints | ||
--- | ||
|
||
# RPC proxy service | ||
|
||
Subsquid Cloud provides a built-in RPC proxy service. The service is available to all squids deployed to the Cloud, although [playground](/cloud/resources/organizations/#playgrounds) squids only have access to a limited number of calls. | ||
|
||
[Professional organizations](/cloud/resources/organizations/#professional-organizations) do not have that limitation and [can access](#external-access) their RPC proxy endpoints from outside of the Cloud. | ||
|
||
Enable the RPC add-on in the [manifest](/cloud/reference/manifest) like this: | ||
```yaml | ||
deploy: | ||
addons: | ||
rpc: | ||
- eth-goerli:http | ||
``` | ||
See the [reference page](/cloud/reference/rpc-proxy-networks) for a list of available networks and their aliases (`eth-goerli:http` in this example). | ||
|
||
## Processor configuration | ||
|
||
With the add-on successfully enabled, your squid will get a unique proxied endpoint to the requested network. Subsquid Cloud will make its URL available to the deployed squid at the `RPC_${Upper(network)}_${Upper(protocol)}` environment variable. Assert it to avoid compilation errors. We also recommend rate limiting RPC proxy requests on the processor side to the same rate as was used in the manifest: | ||
```ts | ||
import {assertNotNull} from '@subsquid/util-internal' | ||
processor.setRpcEndpoint({ | ||
// dash in "eth-goerli" becomes an underscore | ||
url: assertNotNull(process.env.RPC_ETH_GOERLI_HTTP), | ||
rateLimit: 10 | ||
}) | ||
``` | ||
|
||
## External access | ||
|
||
[Professional organizations](/cloud/resources/organizations/#professional-organizations) can [access their RPC proxies from outside](https://app.subsquid.io/rpc) of the Subsquid Cloud. | ||
|
||
Among other things, this enables a development process that uses the proxy for both local and Cloud runs transparently. Here an example configuration for Ethereum Mainnet: | ||
|
||
<details> | ||
|
||
<summary>Here is an example configuration for Ethereum Mainnet</summary> | ||
|
||
1. Add the following variable to `.env`: | ||
```bash | ||
# get the url from https://app.subsquid.io/rpc/chains/eth | ||
RPC_ETH_HTTP=<your_external_proxy_url> | ||
``` | ||
|
||
2. Enable the RPC proxy in squid.yaml: | ||
```yaml | ||
deploy: | ||
addons: | ||
rpc: | ||
- eth:http | ||
``` | ||
This will add and populate the `RPC_ETH_HTTP` variable for Cloud deployments. | ||
|
||
|
||
3. Configure the processor to use the URL from from `RPC_ETH_HTTP`: | ||
```ts | ||
import {EvmBatchProcessor} from '@subsquid/evm-processor' | ||
import {assertNotNull} from '@subsquid/util-internal' | ||
export const processor = new EvmBatchProcessor() | ||
.setRpcEndpoint(assertNotNull(process.env.RPC_ETH_HTTP)) | ||
// ...the rest of the processor configuration | ||
``` | ||
|
||
</details> | ||
|
||
## Pricing | ||
|
||
RPC proxy requests are priced [at a flat rate](/cloud/pricing/#rpc-requests), with substantial packages included for free for all [organization types](/cloud/resources/organizations). Pricing does not depend on the call method. |
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
Oops, something went wrong.