What is a "known" party in the context of the HTTP JSON API "fetch all known parties" endpoint?

Hello,

Had a question about the usage of GET /v1/parties on the JSON API. I notice that on my ledger, the response will only include parties that have created a contract.

I suspect this is because the ledger is using implicit party allocation, so they don’t become a “known” party until taking a concrete action (like creating a contract). Is my hunch correct, or is there something else that might be going on?

Follow up question: Assuming that hunch is correct, is it right to conclude that if we used explicit party allocation, the party becomes known at the point of allocation (and shows up in the response) even if they haven’t done anything on the ledger yet?

Thanks!

1 Like

Hi @Alex_Matson,

/v1/parties and the underlying gRPC endpoint on the party management service return all parties that have been allocated on the ledger. There are now two cases:

  1. Your ledger runs without implicit party allocation. This is the case on most ledgers apart from sandbox. In this case, all parties have to be allocated explicitly. If you reference a party that hasn’t been allocated you will get an error. Note that this only applies to references in places where the party has a “semantic meaning” so signatories, observers and controllers. You can always have a template field of type Party and reference something abitrary there.

  2. Your ledger runs with implicit party allocation. You can still allocate parties explicitly in this mode and they will be returned. However, now if you reference a party that hasn’t been allocated before you won’t get an error, instead the party will be allocated implicitly and the command succeeds. So implicit party allocation is roughly equivalent to calling allocate immediately before submitting a command if the party hasn’t been allocated before.

So to answer your follow up question, parties always appear immediately after they have been allocated. The difference with implicit party allocation is that in addition to allocating parties explicitly you can also not allocate them upfront and instead they will be allocated the first time they are used.

It is also worth pointing out that implicit party allocation is primarily a development time feature. I don’t recommend using that in production, it’s very easy to mistype a party id somewhere.

2 Likes

Thanks, that clarifies it for me!

1 Like