Hi Team,
I am using the sample daml code with a script here:
setup : Script AssetId
setup = script do
-- user_setup_begin
alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
aliceId <- validateUserId "alice"
bobId <- validateUserId "bob"
createUser (User aliceId (Some alice)) [CanActAs alice]
createUser (User bobId (Some bob)) [CanActAs bob]
-- user_setup_end
aliceTV <- submit alice do
createCmd Asset with
issuer = alice
owner = alice
name = "TV"
bobTV <- submit alice do
exerciseCmd aliceTV Give with newOwner = bob
submit bob do
exerciseCmd bobTV Give with newOwner = alice
This script runs well in Sandbox without authentication.
Once we enable authentication with this
daml sandbox -c auth.conf
daml ledger upload-dar --access-toke-file adminjwt .daml/dist/seconddaml-0.0.1.dar>
When we run the script (adminjwt works fine in uploading the DAR)
daml script --dar .daml/dist/seconddaml-0.0.1.dar --script-name Main:setup --ledger-host localhost --ledger-port 6865 --acce
ss-token-file adminjwt
We get authentication problems
Exception in thread "main" com.daml.lf.engine.script.ScriptF$FailedCmd: Command submit failed: PERMISSION_DENIED: An error occurred. Please contact the operator and inquire about the request <no-correlation-id>
My observation is that the first part of script “user setup” works well with the adminjwt (with userid set participant_admin), but this token cannot be used when representing alice and bob, despite the fact that alice and bob as users are defined already in the ledger.
What is the best way in this case? Ideally we can use participant_admin to create users alice and bob, then we can use alice and bob to execute the remaining of the script.
Thanks in advance.
KC