Skip to main content
Version: Current

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 squids only have access to a limited number of calls.

Professional organizations do not have that limitation and can access their RPC proxy endpoints from outside of the Cloud.

Enable the RPC add-on in the manifest like this:

deploy:
addons:
rpc:
- eth-goerli:http

See the reference page 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:

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 can access their RPC proxies from outside 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:

Here is an example configuration for Ethereum Mainnet
  1. Add the following variable to .env:

    # 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:

    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:

    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

Pricing

RPC proxy requests are priced at a flat rate, with substantial packages included for free for all organization types. Pricing does not depend on the call method.