This example shows how a party broadcaster
can send data to subscribers. DAML's divulgence mechanism ensures that the broadcast data lands in subscribers' PCSs and can be used to submit transactions. This is an alternative to the use of observer
. It lacks the guarantees of observer
, but subscribers don't find out about each other, and the transaction size of adding a new subscriber doesn't grow with the number of subscribers.
- The
broadcaster
creates aBroadcast
andBroadcastData
which they want to broadcast. - Subscribers create
SubscriptionRequest
contracts to ask to be added to theBroadcast
. Thebroadcaster
accepts these via choiceAcceptSubscription
. - The
broadcaster
updates theBroadcast
via theBroadcastUpdate
choice onBroadcast
.
To compile the project:
daml build
The model is tested in scenario test_broadcast
. Note how as subscribers are added, the BroadcastUpdate
transactions get larger, but the transaction to add a new subscriber is constant size.
To run all scenarios:
daml test --color
To load the project into the sandbox and start navigator:
daml start