Sandbox Initialization error

Hi all, I am unable to initialise my script and start the navigator for some reason. My test script works fine and I can see the in memory ledger, but for some reason when I run daml start, it compiles successfully but fails to start the Sandbox.
Below is my code:
template RemittanceServiceRequest
client : Party
networkAdmin : Party – to make sure that the trasaction is legit
telephoneCompany : Party – mobile money company
provider : Party – this is the ForExNetwork
recipient : Text — recipients name
telphone : Text – electronic wallet
paymentMethod : Text – mobile phone account (electronic wallet)
baseCurrency : Text --currency that is tradable on the network
localCurrency : Text — to currency that is not tradable on the network
baseCurrencyAmount : Numeric 2 --Decimal
country : Text
issued : Time

signatory networkAdmin, client, provider
–observer telephoneCompany

  controller  provider, client can
    nonconsuming SendRemittanceServiceReq : ContractId RemittanceServiceRequest 
         sendToTelephoneCompany <- create RemittanceServiceRequest
         return (sendToTelephoneCompany)

  controller telephoneCompany can
   AcceptRemittanceServiceReq : (ContractId RemittanceServiceRequest, ContractId RemittanceFee, ContractId Payable, ContractId MobileMoneyPayment)
            rate = 1.0
            amountToPayOut = rate * baseCurrencyAmount 
         fromclientToTelCom <- create RemittanceServiceRequest
         demandRemittanceFeePay <- create RemittanceFee
               amount = baseCurrencyAmount * 0.1  ---exchange fee of 1% the amount sent
               currency = baseCurrency
               from = client
               to = telephoneCompany
               reference = "Remittance fee"
               transactionId = "transaction MobileMoney"
               received = issued
         paymentfromClient <- create Payable
               quoteAmountToReceive = amountToPayOut
               quote = baseCurrency
               rate = rate
               from = client
               to = telephoneCompany
               baseCurrencyAmount = baseCurrencyAmount
               baseCurrency= baseCurrency
               reference = "Mobile Money transaction"

         payrecipient <- create MobileMoneyPayment
              from = telephoneCompany
              to = recipient
              amount = amountToPayOut --exchangeAmount 
              currency = localCurrency
              sender = client
              paymentMethod = paymentMethod -- this is to the recipient's mobile phone
         return (fromclientToTelCom , demandRemittanceFeePay, paymentfromClient, payrecipient )

  controller  telephoneCompany can
    DenyRemittanceService : ()
       do return ()

###Test #####
forExchange_Test = script do
setTime (time ( 2022 Jan 12)0 0 0)
mtn ← allocatePartyWithHint “MTN” (PartyIdHint “mtn”)
orangeTel ← allocatePartyWithHint “OrangeTel” (PartyIdHint"orangeTel")
forexBroker ← allocatePartyWithHint “ForexBroker” (PartyIdHint"forexBroker")
patience ← allocatePartyWithHint “Patience” (PartyIdHint"patience")
becky ← allocatePartyWithHint “Becky” (PartyIdHint"becky")
networkAdmin ← allocatePartyWithHint “NetworkAdmin” (PartyIdHint “networkAdmin”)
curTime ← getTime

createProvider ← submitMulti [forexBroker, networkAdmin ][] do – these two parties are the two signatories to the contract
createCmd Provider
networkAdmin = networkAdmin
provider =forexBroker

createTelcomRegistration ← submitMulti [networkAdmin, mtn] [] do
createCmd TelComRegistration
telcomName = “Mobile Telcom Network”
telCombank = “Zenith Bank”
cashOutagent = “MTN Mobile Money”
telephone = “22-33-44”
telComEmail = “
telephoneCompany = mtn
networkAdmin = networkAdmin

createClientRegistration ← submit networkAdmin do
createCmd ClientRegistration
networkAdmin = networkAdmin
client = patience

createRemittance ← submitMulti[forexBroker, networkAdmin , becky, mtn][] do
createCmd RemittanceServiceRequest with
client = becky
networkAdmin = networkAdmin – to make sure that the trasaction is legit
telephoneCompany = mtn-- mobile money company
provider = forexBroker – this is the ForExNetwork
recipient = “John Hunt” — recipients name
telphone = “23-44-99” – electronic wallet
paymentMethod = “mobile wallet” – mobile phone account (electronic wallet)
baseCurrency = “CNY” --currency that is tradable on the network
localCurrency = “XAF” — to currency that is not tradable on the network
baseCurrencyAmount = 400.0–Decimal
country= “Cameroon”
issued = curTime

sendtRemittanceServiceReq ← submitMulti[forexBroker, networkAdmin, becky, mtn][] do
exerciseCmd createRemittance SendRemittanceServiceReq

acceptRemittanceServiceReq ← submitMulti[forexBroker, networkAdmin,becky, mtn][] do
exerciseCmd createRemittance AcceptRemittanceServiceReq


Error log below when I run “daml start”

18:58:30.619 [program-resource-pool-3] INFO com.daml.platform.sandboxnext.Runner - Initialized sandbox version 1.16.0 with ledger-id = fee9f2ad-1c81-4c00-84b8-0d9888e609a4, port = 6865, dar file = List(.daml\dist\ForExNetwork-0.0.1.dar), time mode = static time, ledger = in-memory, auth-service = AuthServiceWildcard$, contract ids seeding = strong
Running the initialization script.
Exception in thread “main” java.lang.IllegalArgumentException: unknown definition 8bdf5d8eb8590464664adcd735816f3db33ec6cc5c3d1a4954f53ad09a00bc2b:Main:forExNetwork_Test while looking for value 8bdf5d8eb8590464664adcd735816f3db33ec6cc5c3d1a4954f53ad09a00bc2b:Main:forExNetwork_Test
at scala.util.Either.fold(Either.scala:190)
at com.daml.lf.engine.script.Runner$.run(Runner.scala:309)
at com.daml.lf.engine.script.RunnerMain$.$anonfun$main$12(RunnerMain.scala:108)
at scala.concurrent.impl.Promise$
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
at java.base/java.util.concurrent.ForkJoinTask.doExec(
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(
at java.base/java.util.concurrent.ForkJoinPool.scan(
at java.base/java.util.concurrent.ForkJoinPool.runWorker(
daml-helper: Received ExitFailure 1 when running
Raw command: java “-Dlogback.configurationFile=C:\Users\patie\AppData\Roaming\daml\sdk\1.16.0\daml-sdk/script-logback.xml” -jar “C:\Users\patie\AppData\Roaming\daml\sdk\1.16.0\daml-sdk/daml-sdk.jar” script --dar “.daml\dist\ForExNetwork-0.0.1.dar” --script-name Main:forExNetwork_Test --static-time --ledger-host localhost --ledger-port 6865

daml-helper: Received ExitFailure 1 when running
Shell command: "“C:\Users\patie\AppData\Roaming\daml\bin\daml.cmd” “script” “–dar” “.daml\dist\ForExNetwork-0.0.1.dar” “–script-name” “Main:forExNetwork_Test” “–static-time”
“–ledger-host” “localhost” “–ledger-port” “6865"”

I will really appreciate your help and suggestions as I am fairly new to Daml.


Hi @Patience_Mbuh_Ngong and welcome to the forum!

Looking at your code your script is called forExchange_Test.

However, as you can see from the error it is looking for a definition called forExNetwork_Test which does not exist in the code you’ve shown. daml start picks this up from your init-script in your daml.yaml so try changing that to Main:forExNework_Test.

Small tip: You can enclose your code in triple backticks ```yourcodehere``` to make it easier to read.


Thank you so much for your help and the small tip :grin:
I am now able to launch the Sandbox and navigator. cheers