Documentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
API Configuration
Participant nodes expose the Admin API, the gRPC Ledger API, and optionally the JSON Ledger API. This page explains how to configure general options that apply to both the Admin API and the gRPC Ledger API. For the configuration options that apply only to specific APIs, please refer to the Administration API, the gRPC Ledger API, and the JSON Ledger API pages.Ports
Ports for the Admin API, gRPC Ledger API and JSON Ledger API have to be provided explicitly:Keep Alive
Canton enables keep-alive by default on all gRPC connections in order to prevent load-balancers or firewalls from terminating long-running RPC calls in the event of some silence on the connection. To tweak the keep-alive configuration of a connection, adjust the following parameters:timetimeoutpermit-keep-alive-timepermit-keep-alive-without-calls
keep-alive-client section, or for the server side of the Admin API and the gRPC Ledger API in the keep-alive-server section. The last two parameters are server only, and you can therefore adjust them only in the keep-alive-server section of the Admin API and the gRPC Ledger API.
The gRPC documentation further describes these parameters and their effect.
permit-keep-alive-time specifies the most aggressive keep-alive time that a client is permitted to use. If a client uses a keep-alive time that is more aggressive than the server’s permit-keep-alive-time, the connection is terminated with a GOAWAY error with “too_many_pings” as the debug data.Setting
permit-keep-alive-without-calls to true allows clients to send ping messages outside of any ongoing gRPC call. Such a ping otherwise results in a GOAWAY error.| API | Admin API | Ledger API |
|---|---|---|
| time | 40s | 10min |
| timeout | 20s | 20s |
| permit-keep-alive-time | 20s | 10s |
| permit-keep-alive-without-calls | false | false |
Native libraries usage by Netty
Canton ships with native libraries (for some processor architectures: x86_64, ARM64, S390_64) so that the Netty network access library can take advantage of theepoll system call on Linux. This generally leads to improved performance and less pressure on the JVM garbage collector.
The system automatically picks the native library if available for the current operating system and architecture, or falls back to the standard NIO library if the native library is not available.
To switch off using the native library, set the following when running Canton:
DEBUG level on your log.
Admin API Configuration
Administration API
The nature and scope of the Admin API on participant nodes and the Admin API on synchronizers has some overlap. As an example, you will find the same key management commands on the synchronizer and the participant node API, whereas the participant has different commands to connect to several synchronizers. The configuration is currently simple (see the TLS example below) and specifically takes an address and a port. The address defaults to127.0.0.1 and a default port is assigned if not explicitly configured.
You should not expose the admin-api publicly in an unsecured way as it serves administrative purposes only.
gRPC Ledger API Configuration
The configuration of the gRPC Ledger API is similar to the Admin API configuration, except that the group starts withledger-api instead of admin-api.
- Define tls parameter group to to configure TLS
- Define auth-services parameter group to to configure JWT authorization
- Define jwt-timestamp-leeway parameter group to to configure JWT leeway
- Define keep-alive-server parameter group to to configure gRPC keepalive
- Define max-inbound-message-size parameter to control the max size of gRPC messages
Ledger API Caches
Themax-contract-state-cache-size and max-contract-key-state-cache-size parameters control the sizes of the Ledger API contract and contract key caches, respectively. Modifying these parameters changes the likelihood that a transaction using a contract or a contract key that was recently accessed (created or read) can still find it in the memory, rather than needing to query it from the database. Larger caches might be of interest when there is a big pool of ambient contracts that are consistently being fetched or used for non-consuming exercises. Larger caches can also benefit use cases where a big pool of contracts rotates through a create -> archive -> create-successor cycle. Consider adjusting these parameters explicitly if the performance of your specific workflow depends on large caches.
Max Transactions in the In-Memory Fan-Out
Themax-transactions-in-memory-fan-out-buffer-size parameter controls the size of the in-memory fan-out buffer. This buffer allows serving the transaction streams from memory as they are finalized, rather than from the database. Make sure this buffer is large enough so applications are less likely to have to stream transactions from the database. In most cases, a 10s buffer works well. For example, if you expect a throughput of 20 tx/s, set this number to 200. The new default setting of 1000 assumes 100 tx/s. Consider adjusting these parameters explicitly if the performance of your workflow foresees transaction rates larger than 100 tx/s.
JSON Ledger API Configuration
The configuration of the JSON Ledger API is similar to the gRPC Ledger API configuration. The corresponding parameter group starts withhttp-ledger-api.
enabled field to false.
JSON Ledger API Endpoint
Configure the JSON API endpoint by adding theserver parameter group.
- Specify the
addressto indicate the IP address to listen on. - Specify the
portto indicate the port. - Specify
port-file, if you want the Participant Node to write a text file with the port on which the JSON Ledger API is listening. This is useful as a tool to synchronize the start-up of dependent services, as the Participant Node only writes the file once the JSON Ledger API is fully initialized. - Specify
path-prefixif you want the JSON Ledger API content to be served on a customized path instead of/.
Websockets
The endpoints that result in large data sets (/v2/commands/completions, /v2/state/active-contracts, /v2/updates, /v2/updates/flats, and /v2/updates/trees) come in two flavors:
- a websocket capable of returning an arbitrarily long result set in a stream
- a HTTP post request returning a limited list of results
- Set the
http-list-max-elements-limitto specify the maximum number of returned rows. - Set the
http-list-wait-timeto specify the number of milliseconds of idle time to wait before sending result This parameter is needed in case of open-ended streams such as completions. JSON Ledger API reads from the gRPC stream, and when there are no new elements for “wait” milliseconds -> the result is sent to the client.
Daml definitions service
You can enable the experimentalDaml Definitions Service by setting the daml-definitions-service-enabled parameter to true.
Configure Caching
Ledger API Caches
Themax-contract-state-cache-size and max-contract-key-state-cache-size parameters control the size of the Ledger API contract and contract key caches, respectively. Modifying these parameters changes the likelihood that a transaction using a contract or a contract key that was recently accessed (created or read) can still find it in the memory, rather than needing to query it from the database. Larger caches might be of interest when there is a big pool of ambient contracts that are consistently fetched or used for non-consuming exercises. Larger caches can also benefit use cases where a big pool of contracts rotates through a create -> archive -> create-successor cycle. Consider adjusting these parameters explicitly if the performance of your specific workflow depends on large caches.