Auditing Daml privacy on Canton: divulgence, explicit disclosure and where data leaks

Sub-transaction privacy often gets read as “who can see this contract?”. On Canton, a party can learn about a contract in three different ways, and each one needs its own check:

  • Stakeholder visibility: signatories and observers are told about the contract and every later event on it.
  • Divulgence: a party that isn’t a stakeholder sees the contract because it witnessed a transaction that fetched it. That gives it a view, not a right to use the contract later.
  • Explicit disclosure: someone passes the contract off-ledger as a DisclosedContract, and the receiving party can use it while it’s active.

Below is where each one tends to leak, using a loan example: a bank lends to Bob, and a KYC provider verifies Bob’s identity.

1. Splitting data across templates doesn’t stop a fetch from exposing it

The loan terms sit in LoanProposal (bank + Bob) and the identity data in KycRecord (Bob + KYC provider), so they look separated. But if the bank-controlled Accept choice runs fetch kycCid, everyone who witnesses Accept also sees the KycRecord payload. That includes the bank, which isn’t a stakeholder of KycRecord.

Fix: the bank only needs a yes/no answer. Pass a boolean, or an attestation that carries only the boolean, instead of fetching the full record. Witnesses still learn who signed the attestation.

2. Observer lists are hard to undo

Contracts are immutable, so removing an observer means archiving the contract and creating it again. Every reject or withdraw path has to do this, or the party stays on the deal. Every create is also copied to every observer. If you only need one optional extra party, Optional Party is easier to reason about than an observer list that keeps growing.

3. Privacy doesn’t end at the Ledger API

  • Explicit disclosure has no expiry: the same blob can be attached on every submit while the contract is active. Whoever runs the off-ledger channel (HTTPS, SFTP, email) decides who gets the data.
  • Archiving a contract stops it being used, but copies already handed out stay where they are.
  • Divulged copies stay in the participant store until pruning reaches them, and how far pruning goes is the operator’s choice.
  • Payloads are encrypted on the wire, but informees, message size and required confirmers are still visible, and together they reveal the shape of a transaction.

Checklist before a review

  • Make observers only the parties who must stay up to date, not the ones who need a single look.
  • Prefer Optional Party over observer lists.
  • Don’t fetch sensitive contracts in widely witnessed choices. Use a boolean or a boolean-only attestation instead.
  • Make sure no party depends on divulgence to act. Disclose explicitly, and name the channel that controls access.
  • Write down what’s fully confidential (payloads), what’s partly visible (informees, shape, confirmers) and what stays after pruning.

Canton enforces whatever visibility your design sets up. It doesn’t check that this matches your business rules, so that part falls to design and review.

:backhand_index_pointing_right: Full article with the code walkthrough: https://hacken.io/discover/auditing-daml-privacy-on-canton-network/

How do others handle KYC or compliance parties in their workflows: as an observer, through an attestation, or with explicit disclosure?

For this loan example, I’d use a minimal KYC attestation with the provider as a signatory, validating the issuer, subject, required claim and validity when used. Digital Asset’s credential model provides an example with validity periods and revocation.

Attestations and disclosure are complementary: explicit disclosure lets non-stakeholders use the attestation without becoming observers, while Daml authorization still applies.

Under the Canton 3.5 privacy model, contract observers are informed of creation and consuming exercises, including archival. Observer status alone does not guarantee visibility of non-consuming exercises or fetches. I’d choose observers when lifecycle notifications are needed and disclosure when access is needed for submission.

Thanks, this is a useful addition. Have you seen teams combine the credential model with explicit disclosure in production, or is it still mostly observers?

I don’t have a verified production KYC deployment I can cite. DA’s DevNet credential documentation describes issuer-held credentials being disclosed through registry endpoints when needed. Its mint-request example includes Credential contracts in disclosedContracts, demonstrating credentials combined with explicit disclosure.

On revocation, the registry utility’s validation rules check credentials at both request and execution. Revocation or expiry between those phases causes execution to fail and keeping a cached disclosure doesn’t bypass those checks.

These examples follow the documented pattern, but don’t show how widely its used in production or whether observers are more common

Thanks, that’s clear, and the request/execution check was the part I was going to ask about.

So for anyone checking their own setup: with the registry utility, credentials are validated at both request and execution. If you write your own credential or attestation template, you have to add that check yourself. Validate against ledger time in the choice that uses the credential, not only when the request is created. An expired credential is still an active contract, so a disclosed copy keeps working until a choice rejects it.

Agree the docs don’t settle the production question. If anyone running KYC on mainnet can share which pattern they went with, that would help show what’s actually used in production.