I failed to create a contract using sdk1.18.0 and canton2.0.1,
{
“errors”: [
“INVALID_ARGUMENT: INVALID_PARTY_IDENTIFIER(8,c22af5ed): The given party is not a valid Canton party identifier: Unable to parse party: Invalid unique identifier Alice with missing namespace.”
],
“status”: 400
}
@skylorna,
I feel that you’ll benefit from taking a look at the following blog post, which explains the difference between parties in Daml 1.18 vs. Daml 2.x. Parties and users in Daml 2.0
I have tried to submit the contract, but I need to manually change the file parties.json, can it be dynamically obtained.
To answer your question, you can obtain the list of parties with full party IDs from the ledger. You actually included an example of doing this in an earlier post on this thread. But, if I understand correctly, what you’re asking is whether you can obtain the mapping between party aliases and party IDs. Such mapping does not exist on the ledger because party aliases do not exist on the ledger. When you allocate a party on the ledger, you don’t set up an alias for the party. You may setup a party ID hint and a display name, but these serve a different purpose. See the blog post I referenced above for details. In Daml 2.x we recommend against using party display names altogether. Judging by the payload in the HTTP response that you got when you retrieved all known parties, which you included in a previous post on this thread, you didn’t use display names previously either. Party ID hints cannot be used as party identifiers in Daml 2.x.
Long story short, there’s no built-in concept of party aliases on the ledger. But you could set up and maintain party aliases (for the purpose of using them in the UI) in your UI project. The latest version of daml-ui-template-master provides an example of how this could be achieved by storing the mapping between parties and aliases in Parties.json file.
Storing the map between party IDs and aliases in a JSON file in the UI project is just one approach to providing human readable party identifier. Another option is to create an alias contract for each party on the ledger, which is what create-daml-app does. And another is to use User Management. See “Authorization and user management” section in the blog post I referenced above.
I hope this answers your question.
parties.json is dynamically generated everytime you start the ledger using daml start. The init script will output the allocated parties into that file, which is then used by the UI. You just need to make sure you always start the ledger using daml start before starting your UI server.
I start the ledger with Canton. I used
DAML JSON API --ledger host localhost --ledger port 10011 --http port 7575 --allow secure tokens before starting my UI server.
so parties.json has not changed
You need to run the init script in order for parties.json to be (re)generated. You can do that either via starting everything through daml start, or by running the init script explicitly through daml script .... Make sure to do this before starting up your UI server, so that the newly generated parties.json gets picked up by it.