Scenario vs Script

Mod note: As of SDK 1.5.0 Scenarios have been superseded by the more powerful Daml Script. We now recommend using that for all purposes. For more information, and to learn how to use Script please check out @Andreas’ post on our blog.

Hi all,

I somehow came across two different versions documentations with one suggesting using scenario while the other suggests script for testing.

I have tested and it seems that both scenario and script work in DAML 1.8.

So I’m wondering, is there any difference between Scenario and Script? I understand there are some difference in the commands, anything more than that? And which one is more recommended?

Thanks!

/Guisong

1 Like

That is the doc that confuses me.

I somehow open this url: DAML SDK documentation — DAML SDK 0.13.54 documentation

And it indeed shows DAML Version 1.8, while apparently it’s not DAML 1.8.

Is this “0.13.54” also a version of DAML?

1 Like

0.13.54 is an older version of the DAML SDK which is about a year old by now. Unfortunately there is an issue on the docs website where it displays the version incorrectly for versions before 1.0.0 which is why your screenshot incorrectly displays it as 1.8.0.

Now to your original question on scenarios vs DAML Script. You can think of DAML Script as Scenarios 2.0. Scenarios only run in DAML Studio. DAML Script also works in Studio but it does more than that:

  1. You can run it against a real ledger via the daml script command. This is not possible with scenarios.
  2. You can use it in daml repl which is also not supported for scenarios.

You might enjoy @Andreas blogpost on the differences between scenarios and DAML Script which also explains why those two features couldn’t just be added to scenarios and instead required a slight redesign which ended up being DAML Script.

While SDK 1.8.0 supports both scenarios and DAML Script, I would strongly recommend to use DAML Script for all new projects and migrate old projects over time.

4 Likes

I was looking for something like this, thank you. However in the last example, in what was going to show connecting against a ledger, the GIF does not seem correct.

Screenshot :point_down:t2:

The Daml Script & REPL are powerful tools indeed.

1 Like

Yeah that was a bit confusing, updated the article a tad. Thanks for the feedback!

1 Like