How should listKnownPartiesOn be used in Canton?

I’d like to list parties allocated on a given participant node from a Daml Script.
My unsuccessful test was:

  1. Launch Canton’s first example: canton-community-0.20.0/examples/01-simple-topology$ ../../bin/canton -c simple-topology.conf --bootstrap simple-ping.canton
  2. Then attach to a node with REPL: daml repl --ledger-host localhost --ledger-port 5011
  3. No matter what I tried as the participant argument, I always got the same answer:
daml> p1 <- listKnownPartiesOn $ ParticipantName "participant1"
daml> p2 <- listKnownPartiesOn $ ParticipantName "participant2"
daml> anything <- listKnownPartiesOn $ ParticipantName "anything"
daml> p1 == p2
True
daml> p1 == anything
True
daml> p1
[PartyDetails {party = 'participant1::12201524d9c10e7ae407f42e90da58f00e0011dd8198715db5f993d66488992f07dd', displayName = Some "participant1", isLocal = True},PartyDetails {party = 'participant2::1220f1b47a78625c906a9019e6d2f07a332198cc5d900a6b53d91eb8b048e270c00b', displayName = Some "participant2", isLocal = False},PartyDetails {party = 'participant3::12206fb605433aff02796559949eb14a069d257342b321ca0d7cc3e30f699b8ae6a9', displayName = Some "participant3", isLocal = False}]

If I had 3 participant nodes e.g., would it be possible to know from a REPL connected to participant1 which parties are hosted on participant2 and which are on participant3?

I think the listKnownPartiesOn function only works as intended when used in conjunction with the --participant-config CLI flag of daml script.

The way you are starting daml repl, you always call the ListKnownParties function on the same Ledger API so you always get the same answer.

@cocreature does daml repl support participant configs? If not, should it support the On variants of the party management functions?

Participant 1 can’t tell you through the Ledger API which participant a non-local party is hosted on. So the way to get the parties hosted on Participant2 is to connect to Participant2’s Ledger API and look at the parties that are local there.

1 Like

At the moment, DAML REPL does not support participant configs. We cannot disable the On variants, DAML REPL literally exposes the same DAML Script API and I don’t want to change that. I’d rather change daml repl to support more complex participant configs.

1 Like