Ports
DB Sync

DB Sync Port

This page provides instructions on how to interact with the Cardano DB Sync service offered by Demeter.

About DB Sync

DB Sync follows the Cardano chain and takes information from the chain and an internally maintained copy of the ledger state. Data is then extracted from the chain and inserted into a PostgreSQL database. SQL queries can then be written directly against the database schema or as queries embedded in any language with libraries for interacting with an SQL database. DB-Sync is a tool developed by IntersectMBO under Apache 2.0 license. Examples, schema, and documentation can be found in the GitHub repository (opens in a new tab).

Demeter Implementation

Each Demeter cluster provides highly-available, multi-tenant instances of Cardano DB Sync. Queries to these instances are load balanced. Projects can access DB Sync data by connecting directly to the PostgreSQL engine.

Demeter DB Sync access will consume DCUs from your project's wallet proportional to the volume and duration of the queries executed against the PostgreSQL instance. If no queries are executed, Demeter will not charge anything.

Enabling Access

To enable access in your project, you need to add a Cardano DB Sync Port resource:

  1. Login to Demeter.run (opens in a new tab)
  2. Select your project (opens in a new tab)
  3. From your project's dashboard, click "Add Resource"
  4. Find the resource "Cardano DB Sync Port" card and select it
  5. Click "Create Resource"
  6. Select the Cardano network you want to access
  7. Click "Create Resource" once again

Getting Started

Once created, your Cardano DB Sync Port resource will present you with the required information to access the PostgreSQL instance:

  • public hostname: the publicly accesible hostname of the PostgreSQL instance (eg: dbynsc-v3.demeter.run)
  • public port number: the publicly accesible port of the PostgreSQL instance (eg: 5432)
  • database name: the name of the PostgreSQL database (eg: dbsync-mainnet)
  • username: the username for authenticating against PostgreSQL (eg: dmtr_dbsync1jjv9pyqyna)
  • password: the password for authenticating against PostgreSQL

The above value will change for each project depending on your configuration.