~/Downloads » daml script --dar quickstart/.daml/dist/quickstart-0.0.1.dar --script-name Script:trade --ledger-host localhost --ledger-port 6865 --input-file parties.json --output-file result.json
Exception in thread "main" java.lang.IllegalArgumentException: Could not find DAML script ade2af4a6fbcfe22272a2899c6ff1bbbd9eb1427300d7d7bdc0749a0ef1b015f:Script.daml:trade
In my Downloads folder, I have Script.daml, parties.json, quickstart folder.
My Script.daml looks like this:
module Script where
import Daml.Script
import Iou
import IouTrade
data Parties = Parties with
alice : Party
bob : Party
usBank : Party
eurBank : Party
trade : Parties ->Script (ContractId Iou)
trade parties = do
-- Banks issue IOU transfers.
submit parties.eurBank do
createCmd Iou with
issuer = parties.eurBank
owner = parties.eurBank
currency = "EUR"
amount = 100.0
observers = []
1 Like
Hi @Nishant_Bansal,
Most of the time you see this type of error if you did not run daml build
after making changes to your DAML Script.
However, looking at the error message I think there might be something else going on here:
It looks like you might have specified --script-name Script.daml:trade
instead of --script-name Script:trade
. The argument should be of the form ModuleName:Identifier
not FileName:Identifier
. The command you showed looks correct but if you didn’t just copy paste it, maybe the one you used did have this issue?
1 Like
I have run “daml build” on the quickstart project and trying to run the command from outside the quickstart folder i.e.from Download folder. My quickstart folder doesn’t contain Script.daml.
Script.daml is present in download folder.
I have copy paste the above command. It is Script:trade not Script.daml:trade.
1 Like
You need to place Script.daml
in the daml
directory of the quickstart project. Otherwise, daml build
will not include it in the resulting DAR.
1 Like
So is there any way to not to place the Script.daml in daml folder and build the dar without it.
Then later on we can use that script from somewhere outside.
1 Like
If you don’t want to include the script in the DAR with with your templates, you need to put it in a separate DAR that depends on quickstart-0.0.1.dar
using data-dependencies
. So create a new project with a separate daml.yaml
where source
points to a directory containing (only) Script.daml
and data-dependencies
includes a path to quickstart-0.0.1.dar
.
1 Like
Do i need to upload this new dar on sandbox too?
1 Like
No, you only need to upload DARs containing templates to the ledger. DAML Scripts are run on the client side so the ledger does not need the DAR. The same applies to triggers.
1 Like