Skip to content

Configuring ENSApi

ENSApi’s behavior can be configured through environment variables. Copy .env.local.example to .env.local and configure all required values.

.env.local.example
# The port ENSApi listens on.
# Optional. If this is not set, the default value is 4334.
# PORT=4334
# RPC configuration
# Required. When ENSIndexer starts up it verifies RPCs are defined for each of the chains
# that are to be indexed based on the configured NAMESPACE and PLUGINS, along with the ENS Root Chain.
#
# NOTE: You must configure your own private RPC endpoints.
# ENSIndexer makes millions of RPC requests during operation.
# Public RPC endpoints are rate limited and will not provide acceptable performance.
# You must use only private (paid) RPC endpoints or your own self-hosted RPC service
# that is prepared to support millions of requests (ex: 500+ requests / second)
#
# Each configured RPC endpoint must be prepared to receive and quickly
# process millions of RPC requests. Private RPC service options include:
# - drpc.org (paid plan) - https://drpc.org/
# - Alchemy (paid plan) - https://www.alchemy.com/
# - QuickNode (paid plan) - https://www.quicknode.com/
# - Infura (paid plan) - https://infura.io/
#
# The following environment variables are supported:
# - ALCHEMY_API_KEY — if set, an Alchemy RPC URL will be provided for each of the chains it supports
# - DRPC_API_KEY — if set, an DRPC RPC URL will be provided for each of the chains it supports
# - RPC_URL_${chainId} — specific, per-chain RPC settings (see below).
#
# If RPC_URL_${chainId} is specified, that value will take precedence over the automatic RPC URLs
# from Alchemy or DRPC. If both Alchemy and DRPC API Keys are specified, ENSIndexer will provide
# both to Ponder, which will balance requests between them (see below).
#
# For chain-specific RPC configuration, use the RPC_URL_{chainId} environment variable.
# Its value is a comma-separated list of one or more HTTP RPC URLs and at most one WebSocket RPC URL.
#
# Example (single HTTP RPC URL):
# RPC_URL_1=https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
#
# Example (multiple HTTP RPC URL, single WebSocket RPC URL):
# RPC_URL_1=https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY,https://lb.drpc.org/ethereum/YOUR_API_KEY,wss://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
#
# The RPC_URL_${chainId} value has the following invariants:
# - Must always include at least one HTTP/HTTPS RPC endpoint. RPC endpoints can
# fail or experience downtime. To optimize resiliency of ENSIndexer,
# defining more than one HTTP/HTTPS endpoint (from more than one RPC provider)
# per indexed chain is strongly encouraged.
# - Can include at most one WS/WSS (websocket) RPC endpoint. A WS/WSS (websocket)
# RPC endpoint per indexed chain is optional. If defined it may optimize
# the time to discover new blocks. Independent of a websocket RPC endpoint
# being defined, Ponder automatically polls the HTTP/HTTPS RPC endpoint for
# a chain to discover new blocks at an interval.
#
# To optimize performance, Ponder automatically adapts to the rate limits (429 errors) of each
# provided HTTP/HTTPS RPC. More details at: https://ponder.sh/docs/config/chains#rpc-endpoints
#
# The Resolution API, as necessary, issues RPC requests to the _primary_ HTTP RPC URL for a given
# chain.
# === ENS Namespace: Mainnet ===
# Ethereum Mainnet
# - required if the configured namespace is mainnet
# - required by plugins: subgraph, protocol-acceleration, referrals, tokenscope
RPC_URL_1=
# === ENS Namespace: Sepolia ===
# Ethereum Sepolia (public testnet)
# - required if the configured namespace is sepolia
# - required by plugins: subgraph, protocol-acceleration, referrals, tokenscope
RPC_URL_11155111=
# === ENS Namespace: Holesky ===
# Ethereum Holesky (public testnet)
# - required if the configured namespace is holesky
# - required by plugins: subgraph, protocol-acceleration, referrals, tokenscope
RPC_URL_17000=
# === ENS Namespace: ens-test-env ===
# ens-test-env (local testnet)
# - required if the configured namespace is ens-test-env
RPC_URL_1337=
# Database configuration
# Required. This is a namespace for the tables that the indexer will create to store indexed data.
# It should be a string that is unique to the running indexer instance.
#
# Keeping the database schema unique to the indexer instance is important to
# 1) speed up indexing after a restart
# 2) prevent data corruption from multiple indexer app instances writing state
# concurrently to the same db schema
#
# No two indexer instances can use the same database schema at the same time.
#
# Read more about database schema rules here:
# https://ponder.sh/docs/api-reference/database#database-schema-rules
#
# Avoid using the `public` schema as we force that in the `dev` command. Using `public`
# cause conflicts as you interchange between dev and start commands so use literally
# anything else.
DATABASE_SCHEMA=production
# Required. This is the connection string for the database that the indexer will use to store data.
# It should be in the format of `postgresql://<username>:<password>@<host>:<port>/<database>`
DATABASE_URL=postgresql://dbuser:abcd1234@localhost:5432/my_database
# The "primary" ENSIndexer service URL.
# Required. This must be an instance of ENSIndexer using either `ponder start` or `ponder dev`,
# (not `ponder serve`). This URL is used to read ENSIndexer's Config and Indexing Status APIs.
ENSINDEXER_URL=http://localhost:42069