Should everything be on the ledger?

You are right, DAML currently lacks a good mechanism for public data or data that should be shared with a large number of parties. There’s a long discussion on a potential mechanism to enable this (for some topologies): Query and Create Exercise as multiple parties

The fundamental problem with public data is this:

  • DAML Ledgers are assumed to be fully decentralized with data shared at transaction time on a need-to-know basis.
  • Nodes need not know about the existence of other nodes.
  • Nodes can join and leave the network dynamically.

How do you distribute public data? You certainly can’t do it transactionally. There’s also no central place where nodes can “pick up” that public data.

While we are working on solutions for this problem, there are some possible workarounds:

  1. Publish public data “out of band”. E.g. create a special party public, make that an observer on all public data, and proxy the JSON API such that you always pass in a token for public in read-only. That way anyone can query the ledger as public, albeit on a different endpoint.
  2. “Broadcast” the data over the ledger using subscriptions. This is abusing divulgence to make contracts available to other parties. With some simple automation, this would allow you to distribute the Product contract to a set of parties, but scalability will become an issue with very large sets of parties or fast-changing products. ex-models/broadcast at master · digital-asset/ex-models · GitHub
2 Likes