Party Management
Parties are the entities that interact with the Daml ledger, representing users or organizations. They can be onboarded to a Participant Node, which allows them to submit transactions and access the ledger. The following section explains how to onboard a (local) party. Refer to the following howtos for onboarding of other kind of parties:- For decentralized parties, refer to the Decentralized Party Overview documentation.
- For external parties, refer to the Onboard External Party tutorial.
- For a party that is already hosted on a participant, refer to the Party Replication documentation.
Onboard a new party via the ledger API
If you have access to the ledger API, you can onboard a new party using theparties command. This command is simply a wrapper around the underlying Ledger API endpoints. For more information, see the Ledger API documentation.
- Define a name for the Party. You can choose the name freely, but it must conform to the following format:
\[a-zA-Z0-9:-\_ \], must not exceed 185 characters, must not use two consecutive colons, and must be unique in the namespace.
bob.
- Specify an optional Synchronizer ID to which the party should be allocated. The participant must be connected to this Synchronizer. You may omit this parameter if the participant is connected to only one Synchronizer, otherwise the party needs to be enabled on each synchronizer explicitly.
- Define optional annotations. These are key-value pairs associated with this party and stored locally on this Ledger API server. Annotations are useful for maintaining metadata about allocated parties.
- Define an optional identity provider id.
- Enable the Party on this participant on ""my-synchronizer""
- If you want to onboard the party on a second Synchronizer, you can do so by running the
allocatecommand again with a different Synchronizer ID.
Update a party
- You can update the annotations of a party. To do so, use the
updatecommand.
- You can also update the identity provider of a party. To do so, use the
update_idpcommand.
Find a party
To find a party, you can use thelist command.
- You can filter parties by identity provider. Otherwise, all parties hosted on the participant will be returned.
Onboard a new party via the admin API
If you need finer control when allocating a party, use the Admin API. To onboard a new party to a Participant Node, follow these steps:- Define a name for the Party (same rules as explained above). For example, we want to host the Party
alice.
- Define an optional namespace. By default, Alice will use the namespace of the participant from whom you submit the command.
- Specify an optional Synchronizer alias to which the party should be allocated. The participant must be connected to this Synchronizer. You may omit this parameter if the participant is connected to only one Synchronizer, otherwise the party needs to be enabled on each synchronizer explicitly.
- Enable the Party on this participant
- Verify that the party has been onboarded.
- If you want to onboard the party on a second Synchronizer, you can do so by running the
enablecommand again with a different Synchronizer alias.
Find a party
To find a party, you can use thelist command.
Disable a party
If you are certain about what you are doing, you can disable a party on a specific Synchronizer using the following command:Multi-hosted parties
A multi-hosted party is a party which is hosted on more than one participant. This poses the question how you can replicate a party from one participant to another? The simplest and safest way to multi-host a party is only available to you while the party has not been involved in any Daml transaction. Otherwise, you have to perform an offline party replication procedure.Party replication
Party replication is the process of duplicating an existing party onto an additional participant within a single synchronizer. In this process, the participant that already hosts the party is called the source participant, while the new participant is called the target participant. The operational procedure differs substantially in complexity and risk depending on whether the party you replicate has already been involved in any Daml transaction. Therefore, onboard your party on a participant, and before you use the party replicate it to other participants following the simple party replication steps. Otherwise, you must apply an offline party replication procedure.Party replication is different from party migration. A party migration includes an additional final step, that is removing (or offboarding) the party from its original participant.Party offboarding, and thus party migration, is currently not supported.
Party replication authorization
How authorization works
Both the party and the new hosting participant must grant their consent by issuing each a party-to-participant mapping topology transaction. This ensures mutual agreement for the party replication.External parties
For external parties, changes to the party’s topology must be explicitly authorized with a signature of the external party’s namespace key. Whenever in the how-to authorization from the party is required, the distinction will be made between local and external parties. The procedure for external parties will refer to an abstract function authorizing updates to the party’s party-to-participant mapping:source participant is used in this how-to for actions other than authorizing topology changes, one of the existing confirming participants of the external party must be used.
Parties with multiple owners
When a party is owned by a group of members in a decentralized namespace, a minimum number (a defined threshold) of those owners must approve the new hosting arrangement. This threshold is met once enough individual owners each issue their own party-to-participant mapping topology transaction.Activation
Completing the mutual authorization process activates the party on the target participant.Simple party replication
The simplest and safest way to replicate a party is to do so before it becomes a stakeholder in any contract. The simple party replication consists of these steps, follow them in the order they are listed:- Create the party, either in the namespace of a participant or in a dedicated namespace.
- Vet packages.
- Authorize one or more additional participants to host the party.
- Use the party.
1. Create party
Create a party Alice:In this example, the local party Alice is owned by the
source participant, which is a simplification. It means that Alice is registered in the participant’s namespace, but it is not a requirement.Alternatively, you can create the party in its own dedicated namespace, or create an external party.2. Vet packages
Vet packages on the target participant(s) before proceeding.If you are unfamiliar with this process, read this general explanation of package vetting.
3. Multi-host party
Party Alice needs to agree to be hosted on the target participant. Because the source participant owns party Alice, you need to issue the party-to-participant mapping topology transaction on thesource participant.
Authorize hosting update on the source participant
Local PartyAuthorize hosting update on the target participant
To complete the process, also the target participant needs to agree to newly host Alice. Therefore, you need to issue the same party-to-participant mapping topology transaction on thetarget participant:
The participant permission here must be the same as in the previous step. For external parties in particular this must be either
Confirmation or Observation.source and target participants.
To replicate Alice to more participants, repeat the procedure by first vetting the packages on a newTarget participant. Then, perform the replication again using the original source and newTarget participants.
3.a Replicate party with simultaneous confirmation threshold change (Variant to 3)
For external parties, the threshold is defined during the onboarding process already, so this section is not relevant to them.
source participant to the newTarget participant while simultaneously setting the confirmation threshold to three. This operation also sets the participant permission to confirmation for all three participants that will be hosting Alice.
Offline party replication
Offline party replication is a multi-step, manual process. Before replication can start, both the target participant and the party itself must explicitly consent to the new hosting arrangement. Afterwards, the replication consists of exporting the party’s Active Contract Set (ACS) from a source participant, and importing it to the target participant.- Connect a single Canton console to both the source and target participants to export and import the party’s ACS file using a single physical machine or environment. Otherwise, you need to securely transfer the ACS export file to the place where you import it to the target participant.
- Offline party replication requires you to disconnect the target participant from all synchronizers before importing the party’s ACS. Hence the name offline party replication.
- While you onboard the party on the target participant you may detect ACS commitment mismatches. This is expected and resolves itself in time; ignore such errors during the party replication procedure.
Offline party replication steps
These are the steps, which you must perform in the exact order they are listed:- Target: Package Vetting – Ensure the target participant vets all required packages.
- Source: Data Retention - Ensure the source participant retains data long enough for the export.
- Target: Authorization - Target participant authorizes new hosting with the onboarding flag set.
- Target: Isolation - Disconnect from all synchronizers and disable auto-reconnect upon restart.
- Source: Party Authorization - Party authorizes the replication with the onboarding flag set.
- Source: ACS Export - The participant currently hosting the party exports the ACS.
- Target: Backup - Back up the target participant before starting the ACS import.
- Target: ACS Import - The target participant imports the ACS.
- Target: Reconnect - The target participant reconnects to the synchronizers.
- Target: Onboarding Flag Clearance - The target participant issues the onboarding flag clearance.
Scenario description
The following steps show how to replicate partyalice from the source participant to a new target participant on the synchronizer mysynchronizer. The source can be any participant already hosting the party.
1. Vet packages
Ensure the target participant vets all packages associated with contracts where the party is a stakeholder. The partyalice uses the package CantonExamples which is vetted on the source participant but not yet on the target participant.
target participant.
2. Data Retention
Ensure that the retention period on the source participant is long enough to cover the entire duration between the following two events:- The party-to-participant mapping topology transaction becoming effective.
- The completion of the ACS export from the source participant.
None if no schedule is set.
source node.
3. Authorize new hosting on the target participant
First, have thetarget participant agree to host party Alice with the desired participant permission (observation in this example).
4. Disconnect target participant from all synchronizers
5. Disable auto-reconnect on target participant
Ensure the target participant does not automatically reconnect to the synchronizer upon restart.6. Authorize new hosting for the party
To later find the ledger offset of the topology transaction which authorizes the new hosting arrangement, take the current ledger end offset on thesource participant as a starting point:
7. Export ACS
Export Alice’s ACS from thesource participant.
The following command finds internally the ledger offset where party Alice is activated on the target participant, starting the search from beginOffsetExclusive.
It then exports Alice’s ACS from the source participant at that exact offset, and stores it in the export file named party_replication.alice.acs.gz.
8. Optional: Re-enable automatic pruning
If you previously disabled automatic pruning on thesource participant by following the data retention step, you may now re-enable it.
Run the following command using the original configuration parameters you recorded before disabling the schedule:
9. Back up target participant
10. Import ACS
Import Alice’s ACS in thetarget participant:
11. Reconnect target participant to synchronizer
To later find the ledger offset of the topology transaction where the new hosting arrangement on thetarget participant has been authorized, take the current ledger end offset:
target participant to the synchronizer.
12. Optional: Re-enable auto-reconnect on target participant
If you previously disabled auto-reconnect following the earlier step, you may now re-enable it. This is only necessary if the target participant was originally configured to reconnect automatically upon restart.13. Clear the participant’s onboarding flag
After thetarget participant has completed the ACS import and reconnected to the synchronizer, you must clear the onboarding flag. This signals that the participant is fully ready to host the party.
There is a dedicated command to accomplish the onboarding flag clearance. It will issue the topology transaction to clear the flag for you, but only when it is safe to do so.
The following command uses the targetLedgerEnd captured in the previous step as the starting point to internally locate the effective party-to-participant mapping transaction that has activated alice on the target participant.
(true, None): The onboarding flag is cleared. Proceed to the next step.(false, Some(CantonTimestamp)): The onboarding flag is still set. Removal is safe only after the indicated timestamp.
minimalSafeClearingTs). Only then will calling this command actually result in a topology transaction to clear the onboarding flag, which becomes effective thereafter.
Because this command is idempotent, you can call it repeatedly. Thus, you may also poll this command until it confirms that the onboarding flag has been cleared. The following snippet demonstrates how this command can be polled.
The
timeout is based on the default decision timeout of 1 minute.Summary
You have successfully multi-hosted Alice onsource and target participants.
Decentralized party overview
A decentralized party combines three different features:- Decentralization of topology management of the party: A
decentralized namespaceto ensure that any topology transaction for that party requires signatures from a threshold of keys. - Decentralization of transaction confirmations for the party: A
party to participant mappingcontaining multiple confirming participants and a threshold to ensure that transactions requiring confirmations from that party also require confirmation from a threshold of participant nodes. - Decentralization of transaction submissions for the party: Optionally, a
party to key mappingto support submitting transactions that require direct authorization of the external party, for example creating a contract that the party is a signatory on by signing the prepared transaction with a threshold of keys. If no party-to-key mapping is defined, then the initial contracts need to be created when theparty to participantthreshold is 1 (if this was ever the case), and a node has submission rights, not just confirmation rights.
Setup a decentralized party
While the decentralized namespace, the party to participant mapping, and the party to key mapping can be configured fully independently, a common scenario is that a set of entities jointly control all three i.e. all three have the same number of members and the same threshold. The instructions here describe that setup with the three members beingalice, bob, and charlie, who use participant1, participant2, and participant3 respectively.
First generate the keys used for the decentralized namespace:
list command:
PartyToParticipant mapping. For this, you need to chose a prefix for the party. The full party ID is then prefix::namespace. This example uses decentralized-party as the prefix. You also need to specify the list of participants that should host that party, the permissions (this should be Confirmation for all nodes participating in consensus for that party, but you may have additional read-only nodes with Observation permissions), and a threshold. The threshold determines how many confirmations are required for the decentralized party. This example uses the same threshold of two used for the decentralized namespace. As for the decentralized namespace, each node independently publishes the transaction; once all of them publish their transactions it becomes valid and shows up in list:
PartyToKey topology transaction. Use a threshold of two signatures again:
Changing the set of members
To add and remove members, the steps are the same: There is a threshold of the existing members and any new members must submit the three topology transactions. It is also possible to only add them to some, but not all, of the three mappings, but usually it makes sense to keep the three in sync. Note that adding a member toPartyToParticipant requires not just a topology transaction but a full party migration including an ACS export and import. The details of this are outside of the scope of this topic.
Next steps
For details on how to submit an externally signed Daml transaction enabled by thePartyToKey mapping, refer to the external submission docs.
In this tutorial, both the namespace and protocol keys are held by the participant itself. It is also possible to hold them outside of the participant. The actual flow stays the same, but each submission of a topology transaction must be signed externally. Refer to the external topology signing docs for details on how to do this.
Decentralized namespace computation
In the above example, we usedDecentralizedNamespaceDefinition.computeNamespace(Set(aliceNamespace, bobNamespace, charlieNamespace)) to compute the decentralized namespace from the namespaces of the initial owners. Note that only the initial owners matter here, the decentralized namespace does not change as owners get added or removed.
However, in some cases you might not run this from a Canton console (for example because you are working directly against the topology gRPC APIs) or need to compute the namespace yourself for other reasons. For those cases, we document how to compute it in Python here:
lexicographic ordering on namespaces: