Cardano DB Sync

Cardano 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 IOHK under Apache 2.0 license. Examples, schema, and documentation can be found in the GitHub repository.

Accessing your Cardano DB Sync instance

Inside the DB-Sync extension, you can get all the required values for connecting to your instance.

The DB-Sync instance provided will be in sync with the network where your project has been created ( preview / preprod / mainnet)



  • Status: The current status of the PostgreSQL instance.

  • Private DNS Name: The DNS name where the primary replica of the PostgreSQL is running. This DNS name can only be accessed from inside the cluster.

  • Private Port: The port where the primary replica of the PostgreSQL is running. This port can only be accessed from inside the cluster.

  • Connection string: The connection string that can be used to connect with a Postgres Client

When accessing from inside a Cardano Workspace, the URL for accessing your instance is already available in the environment variable DBSYNC_POSTGRESQL_URL.

  • User: The DB User for establishing a connection.

  • Password: The DB Password.

Access from outside the Cluster

You can generate a public URL specific to your project for accessing your DB-Sync instance from outside your cluster. This functionality is available through the PostgREST API. For learning more about how to use PostgREST API check their documentation (opens in a new tab)

DB-Sync schema

Demeter (opens in a new tab) provides an easy-to-use schema explorer for your DB-Sync instance. Inside a DB-Sync extension, select the DB-Sync Schema card at the end of the page. Then select any of the tables from the left to get the detail of their fields and types. You can use the QUERY SAMPLE button to get a preview of the content available in the selected table, together with the SQL syntax for fetching the information.



Running queries

It is also possible to run more complex queries against your DB-Sync instance from the user interface provided by Demeter (opens in a new tab). By selecting the Query card, you get an online SQL editor where you can write your Query and submit it to get the results in real-time.


Queries executed from the web user interface are limited to 100 records.