URL
eRPC supports several URL patterns for making requests, with options for both single-chain and multi-chain endpoints.
Single-chain requests
Standard URL pattern
When making requests only for a single chain, you can use this URL structure:
https://<your-erpc-hostname>/<project-id>/<network-architecture>/<chain-id>
<your-erpc-hostname>
Depends on your deployment setup, for example in local development (using make run
) it will be localhost:4000
.
<project-id>
Target project ID you configured in erpc.yaml, for example "main" or "frontend", "backend", etc.
<network-architecture>
Target network architecture you configured in erpc.yaml, for example evm
.
<chain-id>
Target chain ID that one or more upstreams support, for example 1
or 42161
.
# A cURL example of sending a request to a project named "main" and Ethereum mainnet chain:
curl --location 'http://localhost:4000/main/evm/1' \
--header 'Content-Type: application/json' \
--data '{
"method": "eth_getBlockByNumber",
"params": [
"0x1203319",
false
],
"id": 9199,
"jsonrpc": "2.0"
}'
Domain aliasing
If configured with domain aliasing, you can have predefined project and network values:
server:
# ...
aliasing:
rules:
- matchDomain: "*" # (OPTIONAL) Pattern to match Host header, defaults to `*` (all domains)
serveProject: "main" # (OPTIONAL) Project ID to serve for matched domains
serveArchitecture: "evm" # (OPTIONAL) Network architecture (e.g., "evm")
serveChain: "1" # (OPTIONAL) Chain ID (e.g., "1" for Ethereum mainnet)
Configuration examples
- No aliasing - full URL is required
aliasing: ~
https://api.myservice.com/main/evm/1
- Project only
server:
aliasing:
rules:
- matchDomain: "api.myservice.com"
serveProject: "main"
https://api.myservice.com/evm/1
- Project and architecture
server:
aliasing:
rules:
- matchDomain: "evm.myservice.com"
serveProject: "main"
serveArchitecture: "evm"
https://evm.myservice.com/1
- Full aliasing
server:
aliasing:
rules:
- matchDomain: "eth.myservice.com"
serveProject: "main"
serveArchitecture: "evm"
serveChain: "1"
https://eth.myservice.com
Multiple rules example
You can define multiple rules to handle different domains:
server:
aliasing:
rules:
# Ethereum Mainnet specific endpoint
- matchDomain: "eth.myservice.com"
serveProject: "main"
serveArchitecture: "evm"
serveChain: "1"
# Arbitrum specific endpoint
- matchDomain: "arbitrum.myservice.com"
serveProject: "main"
serveArchitecture: "evm"
serveChain: "42161"
# Generic EVM endpoint (requires chain ID in URL)
- matchDomain: "evm.myservice.com"
serveProject: "main"
serveArchitecture: "evm"
# Project-specific endpoint (requires architecture and chain in URL)
- matchDomain: "api.myservice.com"
serveProject: "main"
Alias domains are matched with Host
header using matcher syntax
Multi-chain requests
When making requests for multiple chains, you can use the project endpoint only and must include "networkId" within the request body:
https://<your-erpc-hostname>/<project-id>
# A cURL example of sending a request to a project named "main" and Ethereum mainnet chain:
curl --location 'http://localhost:4000/main' \
--header 'Content-Type: application/json' \
--data '{
"networkId": "evm:1",
"method": "eth_getBlockByNumber",
"params": [
"0x1203319",
false
],
"id": 9199,
"jsonrpc": "2.0"
}'
Batch requests
You can batch multiple calls across any number of networks, in a single request. Read more about it in Batch requests page.