-
For a contract with N stakeholders, where all N parties are allocated on the same participant node (Canton), will there be N instances of the contract on the participant node storage, or a single instance only?
-
Does the answer above change based on whether the stakeholders are signatories, controllers or observers?
There is some duplication but it needs to be addressed within the context of transactions (rather then individual contracts), since Canton might need to create multiple views of it depending on what party is supposed to see what part of each transaction. You can read more on the topic here on the documentation.
Thanks @stefanobaghino-da
In that case, let’s say I have 2 parties A & B both allocated on the same participant node, and both stakeholders to a contract. Let’s also say I have a user U which can read/act as both these parties.
-
My understanding is you cannot read contracts via the transaction stream as a user - you always need to pass in the requesting parties. Is this correct or is there a way to read the transaction stream as a user?
-
In the above transaction stream, would I get 1 or 2 copies of the same contract (1 each for A & B)?
Your understanding is correct. To be more specific, the concept of a user is that of an entity which has certain access privileges to participant, not an entity within the Daml ledger model. A user can act as or read as a party, but this mapping stops at the authorization level. You can present a token saying that you are U and asking to perform some interaction with the Ledger API, but in your interaction you need to specify the party on behalf of you you want to perform such action.
When you ask for data for multiple parties, you get back a single event even if it’s visible to more than one party. You can use the witness_parties
field in each event to understand to which parties that specific event was visible to. You can read more about it in the Ledger API Reference — Daml SDK 2.7.6 documentation.
Perfect, thank you so much for the detailed explanation @stefanobaghino-da