Maximum length of the parts of a Daml Party Id?

What are the maximum lengths of the two parts of the Daml Party Id?

The Daml Party Id is often displayed as an identifier, two colons, and the namespace fingerprint.

For example, in the following…

Alice::12200262d8c9909e8f72e2a7effd18e1d12d6f1d348ac243042ab5ccc93abaa02a30

Alice is the identifier (aka, prefix or party id hint) and 12200252d8c9... is the namespace fingerprint. They are delimited by ::. All together they form a unique identifier.

The code comments say:

/** a unique identifier within a namespace Based on the Ledger API PartyIds/LedgerStrings being
  * limited to 255 characters, we allocate
  *   - 64 + 4 characters to the namespace/fingerprint (essentially SHA256 with extra bytes),
  *   - 2 characters as delimiters, and
  *   - the last 185 characters for the Identifier.
  */
final case class UniqueIdentifier private (identifier: String185, namespace: Namespace)

According to the above:

  • the Alice part can be 185 characters.
  • the 12300242d8c9... part will be 68 characters.
Sample Daml Script

The following was tested with both 2.10.0 and 3.3.0-snapshot.20250319.0.

  let s185 = "A1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234"

  let s186 = "A12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"

  bigName <- allocatePartyWithHint s185 (PartyIdHint s185) --succeeds

  biggerName <- allocatePartyWithHint s186 (PartyIdHint s186) -- fails

daml start
ERROR c.d.c.n.g.ApiRequestLogger:participant=sandbox
Request c.d.l.a.v.a.PartyManagementService/AllocatePartyby /127.0.0.1:58889:
failed with INTERNAL/The given string has a maximum length of 185
but a string of length 186
('A12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345.')
was given
1 Like