URL
eRPC supports two endpoints, one for single-chain requests and one for multi-chain requests.
Single-chain requests
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"
}'
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.
Healthcheck
eRPC has a built-in /healthcheck
endpoint that can be used to check the health of the service within Kubernetes, Railway, etc.
curl http://localhost:4000/healthcheck -v
# < HTTP/1.1 200 OK
# OK
Currently this endpoint checks active projects and their upstreams (i.e. those which received at least 1 request) for total error rate, and it will return a non-200 response if all endpoints have a +99% error rate.