Canton supports a variety of command line arguments. Please run bin/canton –help to see all of them. Here, we explain the most relevant ones.
Selecting a Configuration¶
Canton requires a configuration file to run. There is no default topology configuration built in and
therefore, the user needs to at least define what kind of node (domain or participant) and how many
he wants to run in the given process. Sample configuration files can be found in our release package,
When starting Canton, configuration files can be provided using
bin/canton --config conf_filename -c conf_filename2
which will start Canton by merging the content of conf_filename2 into conf_filename. Both options -c and –config are equivalent. How to write a configuration file is explained in the section on static configuration
Canton can run in three different modes, depending on the desired environment and task.
The default and recommended method to run Canton is in the interactive mode. This is the mode Canton will start in by default. The process will start a command line interface (REPL) which allows to conveniently operate, modify and inspect the Canton application.
In this mode, all errors will be reported as CommandExcecutionException to the console, but Canton will remain running.
The interactive console can be started together with a script, using the –boostrap-script=… option. The script uses the same syntax as the console.
This is the recommended way to run Canton (for now).
For server use on Linux / OSX, we recommend to run the application using the screen command:
screen -S canton -d -m ./bin/canton -c ...
will start the Canton process in a screen session named canton which does not terminate on user-logout and therefore allows to inspect the Canton process whenever necessary.
A previously started process can be joined using
screen -r canton
and an active screen session can be detached using CTRL-A + D (in sequence). Be careful and avoid typing CTRL-D, as it will terminate the session. The screen session will continue to run even if you log out of the machine.
Headless Script Mode¶
For testing and scripting purposes, Canton can also start in headless script mode:
bin/canton run <script-path> --config ...
In this case, commands are specified in a script rather than executed interactively. Any errors with the script or during command execution should cause the Canton process to exit with a non-zero exit code.
This mode is sometimes useful for testing, but we are not convinced yet that we’ll keep it in a stable version.
If the console is undesired, Canton can be started in daemon mode
bin/canton daemon --config ...
All configured entities will be automatically started and will resume operation. Any failures encountered during start up will immediately shutdown the Canton process with a non-zero exit code. This mode is interesting if a third party administration tool is used with Canton.
Java Virtual Machine Arguments¶
The bin/canton application is a convenient wrapper to start a Java virtual machine running the Canton process. The wrapper supports providing additional JVM options using the JAVA_OPTS environment variable:
JAVA_OPTS=" -Xmx2G" ./bin/canton --config ...
Canton uses Logback as the logging library. All Canton logs will derive from the root logger com.digitalasset.canton. By default, Canton will write a log to the file log/canton.log using the INFO log-level.
Using the flag -v (or –verbose) will increase the log-level. Using -d (or –debug) will increase logging even further.
The log-file can be truncated on startup using –truncate-log.
A custom logback configuration can be provided using JAVA_OPTS
JAVA_OPTS="-Dlogback.configurationFile=path-to-file.xml" ./bin/canton --config ...