- Overview
- Tutorials
- Getting started
- Get started with Canton and the JSON Ledger API
- Get Started with Canton, the JSON Ledger API, and TypeScript
- Get started with Canton Network App Dev Quickstart
- Get started with smart contract development
- Basic contracts
- Test templates using Daml scripts
- Build the Daml Archive (.dar) file
- Data types
- Transform contracts using choices
- Add constraints to a contract
- Parties and authority
- Compose choices
- Handle exceptions
- Work with dependencies
- Functional programming 101
- The Daml standard library
- Test Daml contracts
- Next steps
- Application development
- Getting started
- Development how-tos
- Component how-tos
- Explanations
- References
- Application development
- Smart contract development
- Daml language cheat sheet
- Daml language reference
- Daml standard library
- DA.Action.State.Class
- DA.Action.State
- DA.Action
- DA.Assert
- DA.Bifunctor
- DA.Crypto.Text
- DA.Date
- DA.Either
- DA.Exception
- DA.Fail
- DA.Foldable
- DA.Functor
- DA.Internal.Interface.AnyView.Types
- DA.Internal.Interface.AnyView
- DA.List.BuiltinOrder
- DA.List.Total
- DA.List
- DA.Logic
- DA.Map
- DA.Math
- DA.Monoid
- DA.NonEmpty.Types
- DA.NonEmpty
- DA.Numeric
- DA.Optional
- DA.Record
- DA.Semigroup
- DA.Set
- DA.Stack
- DA.Text
- DA.TextMap
- DA.Time
- DA.Traversable
- DA.Tuple
- DA.Validation
- GHC.Show.Text
- GHC.Tuple.Check
- Prelude
- Smart contract upgrading reference
- Glossary of concepts
Configure¶
PQS ascertains its configuration from the following sources, in order of priority:
HOCON configuration files (
--config
argument)command-line arguments
Java system properties (
-D
arguments tojava
command)environment variables
Note
Consult the command ./scribe.jar pipeline --help-verbose
for further information on individual configuration
items, and the conventions used to specify them in the above forms.
PQS sets its configuration at startup. It does not perform dynamic configuration updates, so making a configuration change (such as adding a new party, new template, or new interface to filters) requires a restart.
Warning
PQS will not go back in time and recover history, but only move forward by consuming new transactions it has not previously seen. It is important that scope only be expanded when it is known to have no prior history, at the point in time that PQS was stopped. Otherwise, a re-seed operation will be required to reinitialize from an empty datastore.
The following command connects to a non-auth ledger and replicates the latest state of the ledger (excluding prior-history) from the perspective of the supplied Daml party. It uses the ledger source and supplied database:
$ ./scribe.jar pipeline ledger postgres-document \
--pipeline-filter-parties "Alice::* | Bob::*" \
--pipeline-ledger-start Latest \
--source-ledger-host canton-host \
--source-ledger-port 6865 \
--target-postgres-host postgres-host \
--target-postgres-port 5432 \
--target-postgres-database postgres
Consult Configuration options how to configure each command.
Transactions data source¶
To understand how PQS stores data, you need to understand the ledger data model https://docs.daml.com/concepts/ledger-model/ledger-structure.html. In simple terms, the Daml ledger is composed of a sequence of transactions, which contain events. Events can be:
Create: creation of contracts / interface views
Exercise: of a choice of contracts / interface views
Archive: end of the lifetime of contracts / interface views
Warning
When defining the scope of ledger data being stored, it is important to understand the implications of the data source and the filters applied. The data source and filters determine the data that is available to the SQL functions (see SQL API), and this cannot be changed. Since a change in scope will result in a change to the breadth of data being stored, a re-seed is required to widen or narrow the scope of the data. The only exception to this is where you widen the scope into an area (e.g. new templates, new parties) that you know has no historical data, in which case a re-seed is not required. Or, operators may also the reset function to roll-back the datastore to a prior state where this was true.
PQS can run in two modes as specified by the --pipeline-datasource
configuration. The following table shows the
differences between the two modes, in terms of data availability via the respective SQL functions:
Data / Mode |
TransactionStream |
TransactionTreeStream |
---|---|---|
|
✓ |
✓ |
|
✗ |
✓ |
|
✓ |
✓ |
|
✓ |
✗ |
|
✗ |
✓ |
|
✓ |
✗ |
Transient (create-archive in a transaction) |
✗ |
✓ |
Stakeholders |
✓ |
✓ |
Note |
||
Default |
✓ |
✗ |
Data size |
Smaller |
Larger |
Contract filtering¶
--pipeline-filter-contracts
specifies a filter expression to determine which the Daml templates, interface views
and choices to include. A filter expression is a simple wildcard inclusion (*
) with basic boolean logic (&
!
|
(
)
), where whitespace is ignored. For example:
*
: everything (default)pkg:*
: everything in this packagepkg@=1
: everything in this package that has major version1.x.x
pkg@>=1.2.3
: everything in this package starting with version1.2.3
inclusivelyfoo@1.2.3|bar@3.2.1
: everything in pinpointed packagesfoo
at version1.2.3
and packagebar
at version3.2.1
pkg:a.b.c.Bar
: just this one fully qualified name for templateBar
a.b.c.*
: all members of thea.b.c
namespace* & !pkg:a.b.c.Bar
: everything except this one fully qualified name(a.b.c.Foo | a.b.c.Bar)
: these two fully qualified names(a.b.c.* & !(a.b.c.Foo | a.b.c.Bar) | g.e.f.Baz)
: everything ina.b.c
except forFoo
andBar
, and also includeg.e.f.Baz
a.b.c.Foo & a.b.c.Bar
: error (the identifier can’t be both)
Note
There are further conditions placed upon the filtering of templates and interfaces to avoid potential ambiguity. It is required to include any filter for:
All interface views of included templates
All templates of included interface views
Party filtering¶
Similarly, the --pipeline-filter-parties
option specifies a filter expression to determine which
parties to supply data for. For example:
*
: everything (default)Alice::* | Bob::*
: any party with anAlice
orBob
hintAlice::122055fc4b190e3ff438587b699495a4b6388e911e2305f7e013af160f49a76080ab
: just this one party* & !Alice::*
: all parties except those with anAlice
hintAlice* | Bob* | (Charlie* & !(Charlie3::*))
:Alice
andBob
parties, as well asCharlie
exceptCharlie3
When the ledger requires authentication, this filter applies within the scope of parties for which PQS’ Ledger API
user has access. Naturally, the --pipeline-filter-parties
cannot be used to access data for parties for which the
user is not authorized.
Explicit contract disclosure¶
--pipeline-filter-metadata
specifies an inclusion filter expression to determine the Daml templates and interface
views to capture metadata for. Same syntax as section above applies. Captured data will be available in the
metadata
column (bytea
PostgreSQL type) in the query functions output. This column stores the contents of
created_event_blob
(see How do stakeholders disclose contracts to submitters?) from the respective event.