Dynamic party allocation in Daml 2.0

G-d willing

Hello,
Following this discussion, can you please provide a simple example of how can I dynamically allocate a party from within a Daml script?

1 Like

The allocation is described as part of the docs. In terms of doing so dynamically, you can use the --input-file to provide the party ID hint, which is also described in the same page.

1 Like

G-d willing

Hi @stefanobaghino-da,
I thought that the dynamic allocation was different from what that doc is about.
I am aware of the allocateParty method.
However, as said, I thought it was supposed to be handled differently in Daml 2.0.
Thanks

I assume what was meant in the other discussion as “dynamic party allocation” was provisioning of parties on a live system, as opposed to the approach of using a Daml Script for initialization which is normally used for test and demo setups. The only way in which you can add some “dynamicity” to party allocation is by providing an input file to Daml Script.

Not really. Party allocation works like it used to. The only difference is that Canton allocates party names that can be globally unique, so if you provide a party ID hint, that will not be the exact party ID you’ll get back. As long as you don’t hard-code party IDs, nothing really changed.