Sandbox-options:--wall-clock-time
Hi everyone, I am here again, asking for some help. I am trying to run my first contract in navigator but I get the following error:
Waiting for canton sandbox to start. Error: Unknown option --wall-clock-time Canton v2.4.0
I don’t understand what I am doing wrong, as I am following a tutorial and I can see that I have the same line of codes, but mine doesn’t work. This is my code in daml.yaml
`#init-script: Main:setup
parties:
- Jerry
- Elaine
- Kramer
dependencies: - daml-prim
- daml-stdlib
- daml-script
exposed-modules: - Main
sandbox-options: - –wall-clock-time’
Anyone can help? Sorry to bother you constantly, for me it’s a big learning curve
But I try a lot on my own before asking
![]()
To get around this error, I believe you can safely delete the last two lines from your daml.yaml file.
sandbox-options:
- --wall-clock-time
I’m thinking it is this bug.
Hi Wallace, thank you for coming back to me again!
![]()
I deleted both lines. Now it opens, but when I play a role (let’s say Jerry), and I want to register the first contract, it seems to work, but the contract is not created. A small “access denied” black symbol is at the top right, close to the date.
Other suggestions?
![]()
I don’t remember where the Jerry, Elaine, and Kramer tutorial is. Can point us to the directions you are following?
Also Please, if there are more resources or videos like this, please let me know
![]()
Could you copy-and-paste your code into this thread so that I can try it out myself. Maybe I’ll be able to see what is going on, instead of having to guess. ![]()
Regarding other resources, I suspect you are looking in the right place… Become a Daml Developer.
Great! Sure, thanks a lot.
This is the Main.daml
`module Main where
–import Daml.Script
type ItemCustodyId = ContractId ItemCustody
–track chain of property
template ItemCustody
with
owner : Party
custodian : Party
neighbour: Party
itemName: Text
meterCount: Int --shutter clicks
where
signatory owner
observer custodian
observer neighbour
– depreacated sinax controller … can
–controller owner can
–ReleaseItemTo : ContractID ItemCustody
–with
–friend : Party
–do
choice ReleaseItemTo
: ItemCustodyId
with
friend : Party
currentMeterCount : Int
controller owner
do
create this with
custodian = friend
meterCount = currentMeterCount
choice ReturnItemTo
: ItemCustodyId
with
rightfulOwner : Party
currentMeterCount :Int
controller custodian
do
create this with
owner = rightfulOwner
meterCount = currentMeterCount
–test
{-
setup : Script ItemCustodyId
setup = script do
jerry ← allocateParty “Jerry”
elaine ← allocateParty “Elaine”
kramer ← allocateParty “Kramer”
brandNewCamera <- submit jerry do
createCmd ItemCustody with
owner = jerry
custodian = jerry
neighbour = kramer
itemName = "Really Expensive Camera"
meterCount = 347
elaineHasCamera <- submit jerry do
exerciseCmd brandNewCamera ReleaseItemTo with friend = elaine, currentMeterCount = 360
submit elaine do
exerciseCmd elaineHasCamera ReturnItemTo with rightfulOwner = jerry, currentMeterCount = 10004
-}
'
and this is the daml.yaml
’ sdk-version: 2.4.0
name: MyBorrowApp
source: daml
version: 1.0.0
#init-script: Main:setup
parties:
- Jerry
- Elaine
- Kramer
dependencies: - daml-prim
- daml-stdlib
- daml-script
exposed-modules: - Main
#sandbox-options:
- --wall-clock-time
#navigator-options:
- --feature-user-management=false
’
Sorry I don’t know why the daml.yaml get copied in this strange way
To paste long sections of code into this site, use three tick marks on the line before and the line after your code.
This is without the three tick marks.
This is with the three tick marks.
name: MyBorrowApp
source: daml
version: 1.0.0
#init-script: Main:setup
parties:
- Jerry
- Elaine
- Kramer
dependencies:
- daml-prim
- daml-stdlib
- daml-script
exposed-modules:
- Main
#sandbox-options:
# - --wall-clock-time
#navigator-options:
# - --feature-user-management=false```
--import Daml.Script
type ItemCustodyId = ContractId ItemCustody
--track chain of property
template ItemCustody
with
owner : Party
custodian : Party
neighbour: Party
itemName: Text
meterCount: Int --shutter clicks
where
signatory owner
observer custodian
observer neighbour
-- depreacated sinax controller ... can
--controller owner can
--ReleaseItemTo : ContractID ItemCustody
--with
--friend : Party
--do
choice ReleaseItemTo
: ItemCustodyId
with
friend : Party
currentMeterCount : Int
controller owner
do
create this with
custodian = friend
meterCount = currentMeterCount
choice ReturnItemTo
: ItemCustodyId
with
rightfulOwner : Party
currentMeterCount :Int
controller custodian
do
create this with
owner = rightfulOwner
meterCount = currentMeterCount
--test
{-
setup : Script ItemCustodyId
setup = script do
jerry <- allocateParty "Jerry"
elaine <- allocateParty "Elaine"
kramer <- allocateParty "Kramer"
brandNewCamera <- submit jerry do
createCmd ItemCustody with
owner = jerry
custodian = jerry
neighbour = kramer
itemName = "Really Expensive Camera"
meterCount = 347
elaineHasCamera <- submit jerry do
exerciseCmd brandNewCamera ReleaseItemTo with friend = elaine, currentMeterCount = 360
submit elaine do
exerciseCmd elaineHasCamera ReturnItemTo with rightfulOwner = jerry, currentMeterCount = 10004
-}```Thanks! Sorry I put only one ` previously
Some of the things related to users/parties and how the Navigator loads those have changed since that video was recorded.
Here is working code:
daml.yaml
sdk-version: 2.4.0
name: MyBorrowApp
source: daml
version: 1.0.0
init-script: Main:setup
dependencies:
- daml-prim
- daml-stdlib
- daml-script
exposed-modules:
- Main
navigator-options:
- --feature-user-management=false
Main.daml
module Main where
import Daml.Script
type ItemCustodyId = ContractId ItemCustody
--track chain of property
template ItemCustody
with
owner : Party
custodian : Party
neighbour: Party
itemName: Text
meterCount: Int --shutter clicks
where
signatory owner
observer custodian
observer neighbour
choice ReleaseItemTo
: ItemCustodyId
with
friend : Party
currentMeterCount : Int
controller owner
do
create this with
custodian = friend
meterCount = currentMeterCount
choice ReturnItemTo
: ItemCustodyId
with
rightfulOwner : Party
currentMeterCount :Int
controller custodian
do
create this with
owner = rightfulOwner
meterCount = currentMeterCount
setup : Script ItemCustodyId
setup = script do
jerry <- allocateParty "Jerry"
elaine <- allocateParty "Elaine"
kramer <- allocateParty "Kramer"
brandNewCamera <- submit jerry do
createCmd ItemCustody with
owner = jerry
custodian = jerry
neighbour = kramer
itemName = "Really Expensive Camera"
meterCount = 347
elaineHasCamera <- submit jerry do
exerciseCmd brandNewCamera ReleaseItemTo with friend = elaine, currentMeterCount = 360
submit elaine do
exerciseCmd elaineHasCamera ReturnItemTo with rightfulOwner = jerry, currentMeterCount = 10004
The things to notice are:
-
Instead of listing the Parties in the daml.yaml file, use
--feature-user-management=falseas described at Navigator — Daml SDK 2.4.0 documentation. -
Define a
setupscript to allocate the parties. Navigator will then use those parties to populate the Navigator login screen.
Hope that helps!
Thank you ever so much, Wallace! I will study carefully what you just sent and try again. Thank you so so much again.
![]()
Will be these videos get updated? I know for others would not matter but for people very very inexperience like me
it means a lot. ![]()
Hi Wallace, how can it be then when I open I see already the contracts created and archived? From the tutorial, I understand that I should see the template but not the contracts, as I haven’t done anything yet.
I should open the template, insert the date and create the contract. Instead it’s all already there so how can I play with the 3 roles?
Also, when I open the contract, the layout looked very messy, and I think it should not look like that. In signatories, observers and contract details the names are not shown but it appears only the number of the party (partly visible), while the Item name and the meter count are shown respectively with the correct name and number. It doesn’t seem to me that I can create a contract correctly. Here is the link, I hope you can open it.
A bit more help?
![]()
how can it be then when I open I see already the contracts created and archived?
That is because the setup script includes three commands (one createCmd and two exerciseCmds). If you would like to start without those, you can comment them out of the setup script and restart everything. Even if you comment out the commands, you will want to leave in the allocateParty lines.
the layout looked very messy, and I think it should not look like that.
I’m guessing your layout looks something like this, where all the parties include a long unhelpful identifier.
Yes, that reflects that the representation of “parties” in Daml has evolved to include a unique identifier. And Navigator is still just naively displaying the full name (with the newly added unique identifier.) The display is accurate, but not as clean as we might like when learning. It’s not straightforward to know who party party-9b6faed2-6bb6-4cd2-bfc0-58ca6f2b024f::1220a220a71c... is. ![]()
Here is a way to get around this issue. In your setup script, add a “hint” to the party allocation.
setup = script do
-- jerry <- allocateParty "Jerry"
-- elaine <- allocateParty "Elaine"
-- kramer <- allocateParty "Kramer"
jerry <- allocatePartyWithHint "Jerry" (PartyIdHint "Jerry")
elaine <- allocatePartyWithHint "Elaine" (PartyIdHint "Elaine")
kramer <- allocatePartyWithHint "Kramer" (PartyIdHint "Kramer")
After adding the party id hint, we can at least associate the identifier with the party as we know them. ![]()
Remember, after making changes to your setup script, stop the running services and rerun daml start.
Again thank you very very much. This is a lot of new info. I’ll go through everything tomorrow first thing. Thank you for being so helpful and accurate!!!
![]()
setup = script do
Hi Wallace,
I commented the lines but I get an error now saying that “The last statement in a ‘do’ block must be an expression kramer ← allocatePartyWithHint “Kramer” (PartyIdHint “Kramer”)typecheck”. Frome the resources it seems to me that the block “do” needs to have a input to return something, but whatever I tried it didn’t work.
setup = script do
-- jerry <- allocateParty "Jerry"
-- elaine <- allocateParty "Elaine"
-- kramer <- allocateParty "Kramer"
jerry <- allocatePartyWithHint "Jerry" (PartyIdHint "Jerry")
elaine <- allocatePartyWithHint "Elaine" (PartyIdHint "Elaine")
kramer <- allocatePartyWithHint "Kramer" (PartyIdHint "Kramer")
{-
brandNewCamera <- submit jerry do
createCmd ItemCustody with
owner = jerry
custodian = jerry
neighbour = kramer
itemName = "Really Expensive Camera"
meterCount = 347
elaineHasCamera <- submit jerry do
exerciseCmd brandNewCamera ReleaseItemTo with friend = elaine, currentMeterCount = 360
submit elaine do
exerciseCmd elaineHasCamera ReturnItemTo with rightfulOwner = jerry, currentMeterCount = 10004
-}```I then tried to add this line after the last line (kramer allocateParty)
create ItemCustody with PartyIdHint = Jerry, PartyIdHint = Elaine, PartyIdHint = Kramer
But, of course, it doesn’t work.
Do you have a bit of spare patience this morning?
![]()
Hi, @claudia_giannoni. Sorry… I was away from my computer over the weekend for a US holiday.
Did you get past this error?
The last statement in a ‘do’ block must be an expression
kramer ← allocatePartyWithHint “Kramer” (PartyIdHint “Kramer”)
That error is caused by the fact that Daml scripts are expected to return something. One way to do that is with the return keyword. For example, the last line of a script might be return "OK". Another way to satisfy the requirement that the script return something is for the last line to be an expression. For example, the script originally had this last line:
submit elaine do
exerciseCmd elaineHasCamera etc.
However, when you commented out the submit statements the last line of the script was no longer the submit elaine do command. Instead the last line of the script was then the following assignment:
kramer ← allocatePartyWithHint “Kramer” (PartyIdHint “Kramer”)
The above assignment is a statement that does not return a value. And, as the error message says it, “The last statement in a ‘do’ block must be an expression”. An assignment does something it does not return something.
In your case, you want your initialization script to just allocate parties. So, instead of the last line of the script being an expression of a command, you can just return ().
setup = script do
jerry <- allocatePartyWithHint "Jerry" (PartyIdHint "Jerry")
elaine <- allocatePartyWithHint "Elaine" (PartyIdHint "Elaine")
kramer <- allocatePartyWithHint "Kramer" (PartyIdHint "Kramer")
return ()
setup = script do jerry <- allocatePartyWithHint "Jerry" (PartyIdHint "Jerry") elaine <- allocatePartyWithHint "Elaine" (PartyIdHint "Elaine") kramer <- allocatePartyWithHint "Kramer" (PartyIdHint "Kramer") return ()
Hi Wallace!!
Hope you had a great weekend! Thank you a lot for coming back to me.
Sorry I was away too… I went to Italy for a few days ![]()
Thank you ever so much for your reply above. This sorts out everything… IT WORKS!!!
Thank you thank you thank you
![]()

