Skip to content
Discussions/App Development/"Walk through" daml scriptForum ↗

"Walk through" daml script

App Development5 posts99 views1 likesLast activity Apr 2025
AU
austinOP
Apr 2025

Hi, I was wondering if there was a way to “walk through” each createCmd or exerciseCmd within daml script (without going through the transaction tree)? Almost like a debug mode where you hit script results and it will go step by step through each action in the script

WA
WallaceKelly
Apr 2025

Hi, @austin… the Daml Studio plugin does not provide a step debug feature for Daml Script.

As you rightly point out, the transaction tree view can give you the same insight, though not as a step debugging experience.

Sometimes I find myself temporarily adding debug statements to track down a bug.

AU
austin
Apr 2025

Got it, I thinking for a use case where you had to look at someone else’s script, so you can see the state of the “ledger” after each of the steps without having to comment everything else out, for example

WA
WallaceKelly
Apr 2025

Your follow up comment reminds me of another trick I’ve seen.

You can insert an abort "" in the Daml Script and move it up-and-down the script with option + up and option + down on the keyboard.

It’s similar to commenting out the “remainder” of a script to see the intermediate state. However, it requires fewer keystrokes.

AN
Andrae
Apr 2025

A couple of things:

  1. Each top-level transaction in the transaction view corresponds to a “step” in the script, so it acts as a detailed trace of the entire execution of the script.
  2. If your script is particularly long, creating a Checkpoint contract at suitable points in the script can allow you to quickly orient yourself between the transaction log and the script — if you include a detail : Text field, you can also use it make any interesting state immediately accessible. Keep in mind though that there is no state outside the ledger, so by definition it can’t show any state that isn’t already visible in pervious transactions; however, if the log is long enough to require a checkpoint, it is probably long enough this is a useful convenience.
template Checkpoint
  with
    p : Party
    label : Text
    detail : Text
  where
    signatory p 
← Back to Discussions