Create Contracts by JSON API Fail

I am upgrading to version 2.1.1, from 1.18.1,

This is my daml code, that works in version 1.18.1:

I use the following commands to initiate canton:

bin/canton -c examples/01-simple-topology/simple-topology.conf
participant1.domains.connect_local(mydomain)
participant2.domains.connect_local(mydomain)

val alice = participant1.parties.enable(“Alice”)
mydomain.parties.list(“Alice”)

val bob = participant2.parties.enable(“Bob”)
mydomain.parties.list(“Bob”)

participants.all.dars.upload(“Project/.daml/dist/Project-0.0.1.dar”)
participant1.dars.list()
participant2.dars.list()

Config file:
image

To initiate JSON API:

My Java code, working on daml 1.18.1:


My wireshark LOG:

I can create contracts with JSON API in version 1.18.1, but with CANTON and daml 2.1.1 i cannot, any clue?

Thanks

Notice that you are using hard-coded party identifiers. In Daml 2 we improved party identifiers to make sure the transition from prototype to production in a decentralized environment is smoother. As such, party identifiers are now no longer tied to party ID hints (which was an artifact of the old sandbox, not part of the actual Ledger API). You can read more on the impact of this on the development workflow here.

1 Like

I have read the post, but how can i allocate a party besides daml.yaml?

For most applications, my recommendation is to allocate parties via Daml Script’s allocateParty/allocatePartyWithHint. You can point to a specific Daml script via the init-script field in your daml.yaml in which case it will be picked up automatically when you run daml start. Take a look at the Daml Script documentation for more details.

2 Likes

Hello,

I created my script:

My yaml file:
image

Still, when i run daml start, i cant create contracts by Navigator or JSON API, what is wrong here?

Besides i want to use 2 participants and 1 domain so the daml start command does not aply here,

Thank you

This is my code:
image

Yaml file:
image