Configuring a Penumbra node to write events to postgres
In order to store ABCI events in Postgres, an operator must configure CometBFT to use an external database:
- Create a Postgres database, username, and credentials, and document the
DATABASE_URLused to authenticate as that user. - Apply the CometBFT schema (opens in a new tab) to the database:
psql -d <DATABASE_URL> -f <path/to/schema.sql>. - Edit the CometBFT config file, by default located at
~/.penumbra/network_data/node0/cometbft/config/config.toml, specifically its[tx_index], and set:indexer = "psql"psql-conn = "<DATABASE_URL>"
- Run
pdandcometbftas normal.
The format for DATABASE_URL is specified in the Postgres docs (opens in a new tab).
After the node is running, check the logs for errors. Query the database with SELECT height FROM blocks ORDER BY height DESC LIMIT 10;
(you can connect to the database to run queries like this one using psql -d <DATABASE_URL>)
and confirm you're seeing the latest blocks being added to the database.
Typically an operator sets up PostgreSQL event ingestion as a precursor to the more dev-friendly
pindexer; read on to learn how to configure pindexer.