Java application to retrieve party ids from different participant nodes

Hi there

May I know what’s the best suggestion to give if the requirement is like java application needs to retrieve party ids from different participant nodes and puts them to the observer list of a contract?

REST API endpoint - /v1/parties? But the official doc (Parties and Users On a Daml Ledger — Daml SDK 2.5.1 documentation) says “don’t parse them, don’t make assumptions about their format”, so how do I know which party id from the response is the one that I want?

gRPC user management service? But it would only list the users of the 1 participant node that the java app is connected to. Make Java application connect to multiple participant nodes?

The question I think you are asking is “what party IDs should I put in my new contract, and this information must come from the ledger”? The only answer that will really work in all situations is “put the parties in contracts”. You could have a single contract that lists all parties and gets updated over time, or you could have a set of contracts, one per party, and also a shared observer that you always use to query the current set of parties.

1 Like

Thanks Stephen. Then how would you create your first contract of all parties?

As Stephen said, the parties will need to come from the ledger somehow, but to discuss how best to do this will require a better understanding of the business motivations for who these observers are and why you are wanting them to observe these contracts? If you can provide some more insight into the business processes you are trying to model, hopefully we can provide more advice.

Hi Andrae,

From the template below, once a contract has been created in PN1, it’ll be visible to p2 and p3 in different PNs.

template DummyTemplate
  with
    a: Text
    p1: Party --created in PN1 (Participant Node 1)
    p2: Party --created in PN2
    p3: Party --created in PN3
  where
    signatory p1
    observer p2, p3