No contract is created from localhost:7500
- magzupaoOP 1
Dear, I follow the examples in the tutorials in which I am testing the examples, but when I want to interact via the web it does not create the contract.
My project has this sequence:
- daml create-daml-app myapp
- daml build
- daml start
- invoke from the browser localhost:7500 loads the web
- I choose the contract, I fill in the data but it is not created.
When I look at the ui/ folder I only see the daml.js file.
how to solve this problem?Thanks for your help.
- stefanobaghino-da 1
Do you expect something to be created in the
ui/folder? - magzupao 1
After step 1 run the following command:
daml codegen js .daml/dist/xxxxxx.dar -o ui/daml.js
Load the application on the web, login with the user Bob, I see the templates but the contract is not created.
Thanks
- stefanobaghino-da 1
Can you go a little bit more in detail regarding the error? It’s unclear to me whether you’re expecting some file to be created in the
ui/directory when you create a contract (which is not the case) or if you are diagnosing the failed contract creation in some other way.
- magzupao 1
When executing the java example, I see that the ui/ folder contains many files that have been created (I don’t know if automatically or manually) since this example is created from a template from your repositories.
If I run this java example, I compile, deploy, load the web, log in and when I create the contract there is a check on the top right side that confirms the creation of the contract.In this example, I follow the tutorial, I create the project, the ui/ is created but there is only daml.js.
I compile, deploy, log in to the web and when I create a contract in the upper part of the browser instead of a check box, an icon like an “O” with a line in the center is displayed, indicating that the contract has not been created.What should I do so that the web interface can communicate with the ledger and the contract can be created.
- Gary_Verhaegen 2
Hi @magzupao,
It looks like you may have one of two issues. Either the Navigator you’re using is not part of the same project, or you’ve not filled in the contract with valid values.
If you follow these steps:
$ daml create-daml-app myapp Created a new project in "myapp" based on the template "create-daml-app". $ cd myapp $ daml build Compiling myapp to a DAR. Created .daml/dist/myapp-0.1.0.dar $ daml start Compiling myapp to a DAR. Created .daml/dist/myapp-0.1.0.dar Generating 057eed1fd48c238491b8ea06b9b5bf85a5d4c9275dd3f6183e0e6b01730cc2ba [...]then you do not end up with a running Navigator. Opening a browser on
http://localhost:7500at this point should result in a “cannot connect to the server” error.If you do see a website on
:7500at this stage, this is likely running from another project. Check any other open terminal and kill that process if needed. If you cannot find where that stray Navigator is coming from, rebooting may be your best option.If you do want a Navigator as part of your create-daml-app project (it should not be required), you can, before running
daml start, open up thedaml.yamlfile undermyappand change line 16 from:start-navigator: falseto
start-navigator: trueYou should then be able to use Navigator to create a “following” relationship. Do note that you have to fill in a non-empty list of “following”. This will fail to create, as you described (barred O in the top right):
But this should succeed (if you are talking to a Navigator in the right project):
- magzupao
- I create the project
daml new bikeshopdemo1 --template empty-skeleton cd bikeshopdemo1 daml studio- I create the file BikeShop.daml file in the path ./daml/
BikeShop.daml – file contents:
module BikeShop where import Daml.Script import DA.Date data Currency = USD | EUR | GBP | CHF deriving (Eq, Show) template Cash with issuer: Party owner: Party currency: Currency amount: Decimal where signatory issuer controller owner can Transfer : ContractId Cash with newOwner: Party do create this with owner=newOwner template BikeRepair with bikeShop: Party bikeOwner: Party description: Text price: Decimal paymentDue: Date where signatory bikeShop, bikeOwner controller bikeOwner can Pay : ContractId Cash with cashCid: ContractId Cash do exercise cashCid Transfer with newOwner=bikeShop template BikeRepairProposal with proposer: Party receiver: Party proposal: BikeRepair where signatory proposer controller receiver can Accept : ContractId BikeRepair do create proposal test = do bank <- allocateParty "SwissBank" martin <- allocateParty "Martin" bikeshop <- allocateParty "BikeShop" let cash = Cash with issuer = bank owner = martin currency = CHF amount = 200.0 cashCid <- submit bank do createCmd cash let bikeRepair = BikeRepair with bikeShop = bikeshop bikeOwner = martin description = "fix the bike" price = 200.0 paymentDue = date 2021 Feb 17 proposalCid <- submit bikeshop do createCmd BikeRepairProposal with proposer = bikeshop receiver = martin proposal = bikeRepair repairCid <- submit martin do exerciseCmd proposalCid Accept submit martin do exerciseCmd repairCid Pay with cashCid pure()- I compile the project
daml build- I create the ui/ interface
daml codegen js .daml/dist/bikeshopdemo1-0.0.1.dar -o ui/daml.js- Deploy
daml start vagrant@vagrant:~/daml/bikeshopdemo1$ cd .daml/ dist/ interfaces/ package-database/ vagrant@vagrant:~/daml/bikeshopdemo1$ daml start SDK 1.11.1 has been released! See https://github.com/digital-asset/daml/releases/tag/v1.11.1 for details. SDK 1.11.1 has been released! See https://github.com/digital-asset/daml/releases/tag/v1.11.1 for details. Compiling bikeshopdemo1 to a DAR. Created .daml/dist/bikeshopdemo1-0.0.1.dar Waiting for sandbox to start: INFO: Slf4jLogger started INFO: Listening on localhost:6865 over plain text. ____ ____ / __/__ ____ ___/ / / ___ __ __ _\ \/ _ `/ _ \/ _ / _ \/ _ \\ \ / /___/\_,_/_//_/\_,_/_.__/\___/_\_\ INFO: Initialized sandbox version 1.8.0 with ledger-id = 87e12448-1bc6-4dc9-9035-a1afb831fe26, port = 6865, dar file = List(.daml/dist/bikeshopdemo1-0.0.1.dar), time mode = wall-clock time, ledger = in-memory, auth-service = AuthServiceWildcard$, contract ids seeding = strong Waiting for navigator to start: _ __ _ __ / |/ /__ __ __(_)__ ____ _/ /____ ____ / / _ `/ |/ / / _ `/ _ `/ __/ _ \/ __/ /_/|_/\_,_/|___/_/\_, /\_,_/\__/\___/_/ /___/ Version 1.8.0 Frontend running at http://localhost:7500. ...........Waiting for JSON API to start: 13:51:25.110 [main] INFO com.daml.http.Main$ - Config(ledgerHost=localhost, ledgerPort=6865, address=127.0.0.1, httpPort=7575, portFile=None, packageReloadInterval=5 seconds, packageMaxInboundMessageSize=None, maxInboundMessageSize=4194304, tlsConfig=TlsConfiguration(false,None,None,None,REQUIRE,false), jdbcConfig=None, staticContentConfig=None, allowNonHttps=true, accessTokenFile=None, wsConfig=None) 13:51:25.786 [http-json-ledger-api-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started 13:51:29.027 [http-json-ledger-api-akka.actor.default-dispatcher-6] INFO com.daml.http.HttpService$ - Connected to Ledger: 87e12448-1bc6-4dc9-9035-a1afb831fe26 13:51:29.029 [http-json-ledger-api-akka.actor.default-dispatcher-6] INFO com.daml.http.HttpService$ - contractDao: None 13:51:31.971 [http-json-ledger-api-akka.actor.default-dispatcher-6] INFO com.daml.http.PackageService - new package IDs loaded: 305f88952990a57bdefb3a8556ba65d7951606397564270186108157f73e95e1, c1f1f00558799eec139fb4f4c76f95fb52fa1837a5dd29600baa1c8ed1bdccfd, 733e38d36a2759688a4b2c4cec69d48e7b55ecc8dedc8067b815926c917a182a, 02da7f6b391f26e5a4c6e1e120b84d3a570fb0e0781e50a60b1085cce7c265cc, bfcd37bd6b84768e86e432f5f6c33e25d9e7724a9d42e33875ff74f6348e733f, 518032f41fd0175461b35ae0c9691e08b4aea55e62915f8360af2cc7a1f2ba6c, cc348d369011362a5190fe96dd1f0dfbc697fdfd10e382b9e9666f0da05961b7, 6839a6d3d430c569b2425e9391717b44ca324b88ba621d597778811b2d05031d, 7cbb10d2488454034d290b8c16b7cfa4fc59c749ca379696c54f74bf453f52b3, 99a2705ed38c1c26cbb8fe7acf36bbf626668e167a33335de932599219e0a235, a8ea38e5992fb992237db9973af9ce63fa78ba8fb103cea3a5d739ac313c909c, 76bf0fd12bd945762a01f8fc5bbcdfa4d0ff20f8762af490f8f41d6237c6524f, e22bce619ae24ca3b8e6519281cb5a33b64b3190cc763248b4c3f9ad5087a92c, d58cf9939847921b2aab78eaa7b427dc4c649d25e6bee3c749ace4c3f52f5c97, 6c2c0667393c5f92f1885163068cd31800d2264eb088eb6fc740e11241b2bf06, d14e08374fc7197d6a0de468c968ae8ba3aadbf9315476fd39071831f5923662, 057eed1fd48c238491b8ea06b9b5bf85a5d4c9275dd3f6183e0e6b01730cc2ba, e491352788e56ca4603acc411ffe1a49fefd76ed8b163af86cf5ee5f4c38645b, 40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7, 8a7806365bbd98d88b4c13832ebfa305f6abaeaf32cfa2b7dd25c4fa489b79fb 13:51:32.996 [http-json-ledger-api-akka.actor.default-dispatcher-5] INFO com.daml.http.Main$ - Started server: ServerBinding(/127.0.0.1:7575) ...................... Press 'r' to re-build and upload the package to the sandbox. Press 'Ctrl-C' to quit.-
load in the project by invoking it from the browser http://localhost:7500
-
The application loads in the web browser, I log in, I choose a template, I enter the data but the contract is not created.
-
when I check the ui/ folder there is only one daml.js file
so my questions are;
- do I need to create other files and if so how do I do it, is there an example (a guide)?
- or what is the error because the contract is not created.
RESUMEN
in other examples I have seen that the ui/ folder has more files and also when the contract is created an icon appears for a few seconds at the top right of the browser indicating that the contract is created, a check is displayed and then disappears.In this example the check does not appear but an icon appears that is like a zero with a diagonal inside and the contract is not created.
- Stephen 2
magzupao:daml new bikeshopdemo1 --template empty-skeleton
The empty-skeleton is meant to be ultra-minimalist; the presumption is that you are using this because you know what files you need to create to start getting a complete project.
magzupao:I create the ui/ interface
daml codegen js .daml/dist/bikeshopdemo1-0.0.1.dar -o ui/daml.jsThis doesn’t create a UI; it only generates Typescript types that make it easier to interact with your template and other data types from Typescript. So for example when you query for contracts from your Typescript code, you have types representing what will actually be in those contracts. If you do not write any Typescript code that uses this output, it does nothing.
magzupao:do I need to create other files and if so how do I do it, is there an example (a guide)?
Since
empty-skeletonis meant for someone who already is comfortable with this, the best place to start is to use thecreate-daml-apptemplate and follow the Getting Started guide. The extra contents you see inuifrom this template are [mostly] not boilerplate that belongs in every project; they are examples of how to do practical things when building a UI frontend with@daml/react. The getting started guide then shows how you would add features, what that would look like.Once you are comfortable with what is going on in
create-daml-app, that is the time to useempty-skeletonif you want to build everything your way, yourself. - Gary_Verhaegen 2
Hi @magzupao,
If you do see a list of templates in the templates tab of Navigator, it means it is correctly connected to the sandbox. This leaves just one possible issue, which is that the contract creation failed because you entered invalid data.
If I run
daml new t cd tthen replace
daml/Main.damlwith the code you provided, remove theinit-scriptentry ofdaml.yaml(line 7), and rundaml startI get a seemingly working Navigator on port 7500. I can log in as Alice, and create a Cash contract:
which, after a few seconds, appears in the contracts view:
Note that there is no need to run
daml codegen jsat this point, and nothing is expected to happen to theuifolder. Contracts are stored in the memory of the sandbox application, not as files in the project.If you are still seeing failures, please share a screenshot of the contract form before clicking submit so we can take a look at the data your are submitting.
- magzupao 1
Thank you very much for your comments.
I am closing the queries and will continue testing D




