daml/ledger/sandbox
Jussi Mäki 1f2246c822 Do not divulge contracts to observers in nonconsuming exercises (#325)
* Do not divulge contracts to observers in nonconsuming exercises

Disables support for non-default ledger feature flags, as they
are meaningless since ledger server logic does not respect the flags.
Instead of large refactoring to add support for the old flag settings,
it is best to disallow the deprecated flags, and later on phase out the
flags completely.

Re-enables test_divulgence_of_token in sandbox semantic tests.

Fixes #157.

* purge LedgerFlags entirely...

...since we only support one version of them anyway, and clearing them

* updated release notes
2019-04-11 14:41:35 +02:00
..
src Do not divulge contracts to observers in nonconsuming exercises (#325) 2019-04-11 14:41:35 +02:00
BUILD.bazel Move POM file generation to Bazel rules (#374) 2019-04-11 11:24:52 +02:00
README.md fixes inconsistent help about Sandbox port 2019-04-04 13:03:48 +02:00

Overview

This document is to help internal engineers work with the Sandbox and the new ledger API. Note: If you encounter bugs. Please report issues you find in the #team-ledger-api channel.

DAML Sandbox

To build a snapshot version of the sandbox use sbt packageAll in the ledger root. Find sandbox/target/universal/sandbox-<version>-SNAPSHOT.tgz and unpack it to a fitting place.

Sandbox application can be run from command line with the following command:

java -jar sandbox-<version>-SNAPSHOT.jar [options] <archive>

Command line arguments

  -p, --port <value>       Sandbox service port. Defaults to 6865.
  -a, --address <value>    Sandbox service host. Defaults to binding on all addresses.
  --dalf                   Parse provided archives as DAML-LF Archives instead of DARs.
  --static-time            Use static time, configured with TimeService through gRPC.
  -w, --wall-clock-time    Use wall clock time (UTC). When not provided, static time is used.
  -o, --sim-time-offset <value>
                           Use simulated time with the given duration (ISO-8601 with optional `-` prefix) as offset relative to UTC. For example, supplying `-PT6M` will result in the server time lagging behind UTC by 6 minutes. When not provided, static time is used.
  --no-parity              Disables Ledger Server parity mode. Features which are not supported by the Platform become available.
  --scenario <value>       If set, the sandbox will execute the given scenario on startup and store all the contracts created by it.
  --daml-lf-archive-recursion-limit <value>
                           Set the recursion limit when decoding DAML-LF archives (.dalf files). Default is 1000
  <archive>...             Daml archives to load. Only DAML-LF v1 Archives are currently supported.
  --pem <value>            TLS: The pem file to be used as the private key
  --crt <value>            TLS: The crt file to be used as the cert chain. Required if any other TLS parameters are set.
  --cacrt <value>          TLS: The crt file to be used as the the trusted root CA.
  --help                   Print the usage text

Compatibility

Sandbox uses models compiled in to the DAR format.

The dar files are the archives containing compiled DAML code. We highly recommend generating the dar files using the new DAML packaging, as described in https://engineering.da-int.net/docs/da-all-docs/packages/daml-project/. This will ensure that you're generating the .dar files correctly. The linked page also gives a good overview of what the dar files are, along with other key concepts.

Note that the new Ledger API only supports DAML 1.0 or above codebases compiled to DAML-LF v1. Again, using the DAML packaging as suggested above will ensure that you are generating dar files that the Sandbox can consume.

Ledger API

The new Ledger API uses gRPC. You can find the full documentation of all the services involved rendered at http://ci.da-int.net/job/ledger-api/job/build/job/master/lastSuccessfulBuild/artifact/ledger-api/grpc-definitions/target/docs/index.html (save the file locally to get the styling to work). If you just want to create / exercise contracts, I suggest you start by looking at command_service.proto, which exposes a synchronous API to the DAML ledger.