This page walks through getting the Hiero JSON-RPC Relay running. For an overview of what the relay is and when you’d want to self-host, see the JSON-RPC Relay overview.Documentation Index
Fetch the complete documentation index at: https://hedera-0c6e0218-chore-hide-placeholder-pages.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Docker 20.10+ and Docker Compose
- A Hedera account on the network you’re targeting (mainnet, testnet, or previewnet) with HBAR to pay for the relay’s internal transactions
- The account’s ECDSA or ED25519 private key in a format the relay supports (
DER,HEX_ECDSA, orHEX_ED25519set viaOPERATOR_KEY_FORMAT)
| Network | Mirror node base URL |
|---|---|
| Mainnet | https://mainnet.mirrornode.hedera.com |
| Testnet | https://testnet.mirrornode.hedera.com |
| Previewnet | https://previewnet.mirrornode.hedera.com |
Run with Docker Compose
Clone the repo and copy the HTTP example env file:.env.http.example for the JSON-RPC HTTP server (what you usually want) and .env.ws.example for the WebSocket server. Pick the one that matches the workload, or run both.
Edit .env and set the minimum required values:
7546 for HTTP and 8546 for WebSocket. Verify HTTP with a chain-ID call:
0x128 is 296 in hex, which is Hedera testnet. If you see that, the relay is up and pointed at the right network.
Connect MetaMask or Hardhat
Point your tooling at the relay’s URL and the matching chain ID. For a self-hosted relay against testnet:| Field | Value |
|---|---|
| RPC URL | http://<your-host>:7546 |
| Chain ID | 296 |
| Currency symbol | HBAR |
| Block explorer | https://hashscan.io/testnet |
Next
Configuration
Tune chain ID, mirror node URL, rate limits, caching, and logging.