PostgreSQL-based DAML Ledger Implementation
This article explains how to setup postgres database as the DAML ledger using community edition DAML driver for PostgreSQL provided by the Digital Asset Team.
Steps:
1. Setup Postgres instance.
2. Create database user for DAML driver. In this article, `daml` is kept as username and password.
3. Setup an empty database which is accessible to daml database user. In this article, `daml_db` is kept as database name.
4. Download the required version of community edition jar (here daml-on-sql-1.17.1.jar) from the digital-asset github page.
5. Run the daml driver jar with the necessary parameters. To specify the PostgreSQL instance, use the sql-backend-jdbcurl command line option, where <value> is a valid JDBC URL containing the username, password and database name to connect (for Eg: jdbc:postgresql://host:port/database?user=username&password=password)
java -jar daml-on-sql-1.17.1.jar --ledgerid=NFT --sql-backend-jdbcurl="jdbc:postgresql://localhost:5432/daml_db?user=daml&password=daml"
6. Start the HTTP JSON API Server as a basic or standalone jar
java -jar http-json-1.17.1.jar — ledger-host localhost — ledger-port 6865 — http-port 7575
7. Allocate the required daml ledger parties.
This command should be ran inside the daml project.
daml ledger allocate-parties
7. Verify the ledger parties by listing down the ledger parties.
daml ledger list-parties — host localhost — port 6865
Refer Official DAML documentation for more details on how to enable monitoring, security and privacy.