Getting Started¶
Installation¶
Install erpc.py from PyPI:
This installs the Python library and the erpc-py CLI tool. The eRPC binary itself is installed separately.
Installing the eRPC Binary¶
erpc.py manages the eRPC Go binary. Install it via CLI or Python:
The binary is placed at /usr/local/bin/erpc by default.
SHA256 Verification
Pass a checksum for verified installs:
Your First Config¶
The simplest way to start is with a chain ID → upstream URL mapping:
from erpc import ERPCConfig
config = ERPCConfig(
upstreams={
1: ["https://eth.llamarpc.com"], # Ethereum mainnet
137: ["https://polygon-rpc.com"], # Polygon
},
)
# Preview the generated YAML
print(config.to_yaml())
# Or write it to a file
config.write("erpc.yaml")
Starting eRPC¶
Context Manager (Recommended)¶
from erpc import ERPCProcess
with ERPCProcess(upstreams={1: ["https://eth.llamarpc.com"]}) as erpc:
print(erpc.endpoint_url(1))
# → http://127.0.0.1:4000/py-erpc/evm/1
print(f"Healthy: {erpc.is_healthy}")
# eRPC is automatically stopped when the block exits
With a Config Object¶
from erpc import ERPCConfig, ERPCProcess, CacheConfig
config = ERPCConfig(
project_id="my-app",
upstreams={1: ["https://eth.llamarpc.com"]},
cache=CacheConfig(max_items=50_000),
log_level="info",
)
with ERPCProcess(config=config) as erpc:
print(erpc.endpoint_url(1))
Via CLI¶
# Generate a config
erpc-py config generate \
--chains 1,137 \
--upstreams https://eth.llamarpc.com,https://polygon-rpc.com \
--output erpc.yaml
# Start eRPC
erpc-py start --config erpc.yaml
# Check health
erpc-py health
# Stop
erpc-py stop
Using Docker¶
No local binary needed — run eRPC in a Docker container:
from erpc import ERPCConfig, DockerERPCProcess
config = ERPCConfig(upstreams={1: ["https://eth.llamarpc.com"]})
with DockerERPCProcess(config=config, name="my-erpc") as erpc:
print(erpc.endpoint_url(1))
print(erpc.logs(tail=20))
Next Steps¶
- Configuration Guide — Networks, caching, auth, failsafe, and more
- Process Management — Lifecycle patterns and async support
- Monitoring — Health checks and Prometheus metrics