Update quickstart.rst (#14267)

* Update quickstart.rst

Updated installation instructions

[CHANGELOG_BEGIN]
[CHANGELOG_END]

* Update quickstart.rst

To address Moritz's comment re: line 164

[CHANGELOG_BEGIN]

[CHANGELOG_END]

* Update docs/source/app-dev/bindings-java/quickstart.rst

[CHANGELOG_BEGIN]
[CHANGELOG_END]

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Update quickstart.rst

Another attempted update. As I walk through this, it's not clear to me that we need any step beyond step 3 ("In the browser, log in as alice...") for a beginning user working through the tutorial locally?

[CHANGELOG_BEGIN]
[CHANGELOG_END]

* Update docs/source/app-dev/bindings-java/quickstart.rst

[CHANGELOG_BEGIN]
[CHANGELOG_END]

Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>

* Quickstart.rst Maven edits

Hopefully final edits to this branch

[CHANGELOG_BEGIN]
[CHANGELOG_END]

* Integration w ledger update fix (#14983)

* fix Sphinx build

* update tree output

* remove non-existing ui-backend.conf reference

* update daml build output

* run through the whole thing

Co-authored-by: carrie-laben <91496516+carrie-laben@users.noreply.github.com>
Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-authored-by: Gary Verhaegen <gary.verhaegen@digitalasset.com>
This commit is contained in:
carrielaben-da 2022-09-09 09:33:46 -04:00 committed by GitHub
parent c8d938ed14
commit a21da1be7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 100 additions and 77 deletions

View File

@ -40,7 +40,6 @@ The project contains the following files:
│   ├── Iou.daml
│   ├── IouTrade.daml
│   ├── Main.daml
│   ├── Setup.daml
│   └── Tests
│   ├── Iou.daml
│   └── Trade.daml
@ -51,17 +50,18 @@ The project contains the following files:
└── main
├── java
│   └── com
│   └── digitalasset
│   └── daml
│   └── quickstart
│   └── iou
│   └── IouMain.java
└── resources
└── logback.xml
- ``daml.yaml`` is a Daml project config file used by the SDK to find out how to build the Daml project and how to run it.
- ``daml`` contains the :ref:`Daml code <quickstart-daml>` specifying the contract model for the ledger.
- ``daml/Tests`` contains :ref:`test scripts <quickstart-scripts>` for the Daml model.
- ``frontend-config.js`` and ``ui-backend.conf`` are configuration files for the :ref:`Navigator <quickstart-navigator>` frontend.
- ``frontend-config.js`` is a configuration file for the :ref:`Navigator <quickstart-navigator>` frontend.
- ``pom.xml`` and ``src/main/java`` constitute a :ref:`Java application <quickstart-application>` that provides REST services to interact with the ledger.
You will explore these in more detail through the rest of this guide.
@ -112,42 +112,44 @@ Run the Application Using Prototyping Tools
In this section, you will run the quickstart application and get introduced to the main tools for prototyping Daml:
#. To compile the Daml model, run ``daml build``
This creates a :ref:`DAR file <dar-file-dalf-file>` (DAR is just the format that Daml compiles to) called ``.daml/dist/quickstart-0.0.1.dar``. The output should look like this:
.. code-block:: none
Created .daml/dist/quickstart-0.0.1.dar.
2022-09-08 14:33:41.65 [INFO] [build]
Compiling quickstart to a DAR.
2022-09-08 14:33:42.90 [INFO] [build]
Created .daml/dist/quickstart-0.0.1.dar
.. _quickstart-sandbox:
#. To run the :doc:`sandbox </tools/sandbox>` (a lightweight local version of the ledger), run ``daml sandbox --dar .daml/dist/quickstart-0.0.1.dar``
#. To run the :doc:`sandbox </tools/sandbox>` (a lightweight local version of the ledger), run::
The output should look like this:
daml sandbox --port 6865
.. code-block:: none
#. In a separate terminal run the following:
Starting Canton sandbox.
Listening at port 6865
Uploading .daml/dist/quickstart-0.0.1.dar to localhost:6865
DAR upload succeeded.
Canton sandbox is ready.
- Upload the DAR file::
daml ledger upload-dar --host localhost --port 6865 .daml/dist/quickstart-0.0.1.dar
The sandbox is now running, and you can access its :doc:`ledger API </app-dev/ledger-api>` on port ``6865``.
- Run the init script::
.. _quickstart-script:
#. Open a new terminal window and navigate to your project directory, ``quickstart``.
#. To initialize the ledger with some parties and contracts we use :doc:`Daml Script </daml-script/index>` by running ``daml script --dar .daml/dist/quickstart-0.0.1.dar --script-name Main:initialize --ledger-host localhost --ledger-port 6865 --static-time``
daml script --ledger-host localhost --ledger-port 6865 --dar .daml/dist/quickstart-0.0.1.dar --script-name Main:initialize --output-file output.json
.. _quickstart-navigator:
#. Start the :doc:`Navigator </tools/navigator/index>`, a browser-based ledger front-end, by running ``daml navigator server``
- Start the :doc:`Navigator </tools/navigator/index>`, a browser-based ledger front-end, by running::
The Navigator automatically connects the sandbox. You can access it on port ``4000``.
daml navigator server localhost 6865 --port 7500
The Navigator automatically connects to the sandbox. You can access it on port ``7500``.
.. _quickstart-work:
@ -156,19 +158,17 @@ Try the Application
Now everything is running, you can try out the quickstart application:
#. Go to `http://localhost:4000/ <http://localhost:4000/>`_. This is the Navigator, which you launched :ref:`earlier <quickstart-navigator>`.
#. On the login screen, select **Alice** from the dropdown. This logs you in as Alice.
(The list of available parties is specified in the ``ui-backend.conf`` file.)
#. Go to `http://localhost:7500/ <http://localhost:7500/>`_. This is the :doc:`Navigator </tools/navigator/index>`, which you launched :ref:`earlier <quickstart-navigator>`.
#. On the login screen, select ``alice`` from the dropdown. This logs you in as ``alice``.
This takes you to the contracts view:
.. figure:: quickstart/images/contracts.png
:alt: The Contracts view in the Navigator, showing one existing contract.
This is showing you what contracts are currently active on the sandbox ledger and visible to *Alice*. You can see that there is a single such contract, in our case with Id ``#9:1``, created from a *template* called ``Iou:Iou@ffb...``.
This is showing you what contracts are currently active on the sandbox ledger and visible to ``alice``. You can see that there is a single such contract, in our case with Id ``002eb5...``, created from a *template* called ``Iou:Iou@8f199da...``.
Your contract ID may vary. There's a lot going on in a Daml ledger, so things could have happened in a different order, or other internal ledger events might have occurred. The actual value doesn't matter. We'll refer to this contract as ``#9:1`` in the rest of this document, and you'll need to substitute your own value mentally.
Your contract ID will vary. The actual value doesn't matter. We'll refer to this contract as ``002eb5`` in the rest of this document, and you'll need to substitute your own value mentally.
#. On the left-hand side, you can see what the pages the Navigator contains:
@ -185,51 +185,53 @@ Now everything is running, you can try out the quickstart application:
#. Click **Templates** to open the Templates page.
This displays all available *contract templates*. Instances of contracts (or just *contracts*) are created from these templates. The names of the templates are of the format `module.template@hash`. Including the hash disambiguates templates, even when identical module and template names are used between packages.
This displays all available *contract templates*. Instances of contracts (or just *contracts*) are created from these templates. The names of the templates are of the format `module:template@hash`. Including the hash disambiguates templates, even when identical module and template names are used between packages.
On the far right, you see the number of *contracts* that you can see for each template.
On the far right, you see the number of *contracts* that you can see for each template, if any, or ``-`` for "no contract".
#. Try creating a contract from a template. Issue an Iou to yourself by clicking on the ``Iou:Iou`` row, filling it out as shown below and clicking **Submit**.
#. Try creating a contract from a template. Issue an Iou to yourself by clicking on the ``Iou:Iou@8f199...`` row, filling it out as shown below (use the provided auto-complete feature for the ``Party`` values in ``issuer`` and ``owner``) and clicking **Submit**.
.. figure:: quickstart/images/createIou.png
:alt: Fill out the form by entering Alice as the Issuer and as the Owner, AliceCoin as the Currency, and 1.0 as the Amount.
#. On the left-hand side, click **Issued Ious** to go to that page. You can see the Iou you just issued yourself.
#. Now, try transferring this Iou to someone else. Click on your Iou, select **Iou_Transfer**, enter *Bob* as the new owner and hit **Submit**.
#. Now, try transferring this Iou to someone else. Click on your Iou, select ``Iou_Transfer``, select ``Bob::...`` as the new owner and hit **Submit**.
#. Go to the **Owned Ious** page.
The screen shows the same contract ``#9:1`` that you already saw on the *Contracts* page. It is an Iou for €100, issued by *EUR_Bank*.
The screen shows the same contract ``002eb5`` that you already saw on the *Contracts* page. It is an Iou for €100, issued by ``EUR_Bank::...``.
#. Go to the **Iou Transfers** page. It shows the transfer of your recently issued Iou to Bob, but Bob has not accepted the transfer, so it is not settled.
This is an important part of Daml: nobody can be forced into owning an *Iou*, or indeed agreeing to any other contract. They must explicitly consent.
You could cancel the transfer by using the *IouTransfer_Cancel* choice within it, but for this walk-through, leave it alone for the time being.
You could cancel the transfer by using the ``IouTransfer_Cancel`` choice within it, but for this walk-through, leave it alone for the time being.
#. Try asking *Bob* to exchange your €100 for $110. To do so, you first have to show your Iou to *Bob* so that he can verify the settlement transaction, should he accept the proposal.
Go back to *Owned Ious*, open the Iou for €100 and click on the button *Iou_AddObserver*. Submit *Bob* as the *newObserver*.
Go back to **Owned Ious**, open the Iou for €100 and click on the button ``Iou_AddObserver``. Select ``Bob::...`` as the ``newObserver``.
Contracts in Daml are immutable, meaning they cannot be changed, only created and archived. If you head back to the **Owned Ious** screen, you can see that the Iou now has a new Contract ID. In our case, it's `#13:1`.
#. To propose the trade, go to the **Templates** screen. Click on the *IouTrade:IouTrade* template, fill in the form as shown below and submit the transaction.
Contracts in Daml are immutable, meaning they cannot be changed, only created and archived. If you head back to the **Owned Ious** screen, you can see that the Iou now has a new Contract ID. In our case, it's ``00018fe...``.
#. To propose the trade, go to the **Templates** screen. Click on the ``IouTrade:IouTrade@...`` template, fill in the form as shown below and submit the transaction. Remember to use the dropdown for the values of ``buyer``, ``seller``, ``baseIouCid``, ``baseIssuer``, and ``quoteIssuer``.
.. figure:: quickstart/images/tradeProp.png
:alt: Fill out the form by entering Alice as the buyer, Bob as the seller, #13:1 as the baseIouCid, EUR_Bank as the baseIssuer, EUR as the baseCurrency, 100.00 as the baseAmount, USD_Bank as the quote_Issuer, USD as the quoteCurrency, and 110.0 as the quoteAmount.
:alt: Fill out the form; use the provided dropdown to select Alice as the buyer, Bob as the seller, the new contract we just created as the baseIouCid, and EUR_Bank as the baseIssuer; enter EUR as the baseCurrency, 100.00 as the baseAmount; select USD_Bank from the dropdown as the quote_Issuer; enter USD as the quoteCurrency, and 110.0 as the quoteAmount.
#. Go to the **Trades** page. It shows the just-proposed trade.
#. You are now going to switch user to Bob, so you can accept the trades you have just proposed. Start by clicking on the logout button next to the username, at the top of the screen. On the login page, select **Bob** from the dropdown.
#. First, accept the transfer of the *AliceCoin*. Go to the **Iou Transfers** page, click on the row of the transfer, and click **IouTransfer_Accept**, then **Submit**.
#. You are now going to switch user to Bob, so you can accept the trades you have just proposed. Start by clicking on the logout button next to the username, at the top of the screen. On the login page, select ``bob`` from the dropdown.
#. First, accept the transfer of the *AliceCoin*. Go to the **Iou Transfers** page, click on the row of the transfer, and click ``IouTransfer_Accept``, then **Submit**.
#. Go to the **Owned Ious** page. It now shows the *AliceCoin*.
It also shows an *Iou* for $110 issued by *USD_Bank*. This matches the trade proposal you made earlier as Alice.
It also shows an *Iou* for $110 issued by ``USD_Bank::...``. This matches the trade proposal you made earlier as Alice. Remember the first few characters of its Contract ID (in our case ``0086c84``).
Note its *Contract Id*.
#. Settle the trade. Go to the **Trades** page, and click on the row of the proposal. Accept the trade by clicking **IouTrade_Accept**. In the popup, enter the Contract ID you just noted as the *quoteIouCid*, then click **Submit**.
.. figure:: quickstart/images/bobOwnedIous.png
:alt: List of Owned Ious for Bob at this point. Includes Bob's $110 from USD_Bank.
#. Settle the trade. Go to the **Trades** page, and click on the row of the proposal. Accept the trade by clicking ``IouTrade_Accept``. In the popup, select the Contract ID you just noted from the dropdown as the ``quoteIouCid``, then click **Submit**.
The two legs of the transfer are now settled atomically in a single transaction. The trade either fails or succeeds as a whole.
#. Privacy is an important feature of Daml. You can check that Alice and Bob's privacy relative to the Banks was preserved.
To do this, log out, then log in as **USD_Bank**.
To do this, log out, then log in as ``us``, which maps to ``USD_Bank::...``.
On the **Contracts** page, select **Include archived**. The page now shows all the contracts that *USD_Bank* has ever known about.
On the **Contracts** page, select **Include archived**. The page now shows all the contracts that ``USD_Bank::...`` has ever known about.
There are just five contracts:
@ -244,11 +246,11 @@ Now everything is running, you can try out the quickstart application:
it got created in.
* The new $110 *Iou* owned by Alice. This is the only active contract.
USD_Bank does not know anything about the trade or the EUR-leg. For more information on privacy, refer to the :ref:`da-ledgers`.
Importantly, ``USD_Bank::...`` does not know anything about the trade or the EUR-leg. It has no idea what was exchanged for those $110, or indeed if anything was exchanged at all. For more information on privacy, refer to the :ref:`da-ledgers`.
.. note::
*USD_Bank* does know about an intermediate *IouTransfer* contract that was created and consumed as part of the atomic settlement in the previous step. Since that contract was never active on the ledger, it is not shown in Navigator. You will see how to view a complete transaction graph, including who knows what, in :ref:`quickstart-scripts` below.
``USD_Bank::...`` does know about an intermediate *IouTransfer* contract that was created and consumed as part of the atomic settlement in the previous step. Since that contract was never active on the ledger, it is not shown in Navigator. You will see how to view a complete transaction graph, including who knows what, in :ref:`quickstart-scripts` below.
.. _quickstart-daml:
@ -275,7 +277,7 @@ Take a look at the Daml that specifies the contract model in the quickstart appl
#. Open :doc:`Daml Studio </daml/daml-studio>`, a Daml IDE based on VS Code, by running ``daml studio`` from the root of your project.
#. Using the explorer on the left, open ``daml/Iou.daml``.
The first line specifies the module name:
The first (uncommented, non-empty) line specifies the module name:
.. literalinclude:: quickstart/template-root/daml/Iou.daml
:language: daml
@ -301,9 +303,12 @@ In this case, there are two conditions:
- An ``Iou`` can only be created if it is authorized by both ``issuer`` and ``owner``.
- The ``amount`` needs to be positive.
Earlier, as Alice, you authorized the creation of an ``Iou``. The ``amount`` was ``100.0``, and Alice as both ``issuer`` and ``owner``, so both conditions were satisfied, and you could successfully create the contract.
Earlier, as Alice, you authorized the creation of an ``Iou``. The ``amount`` was ``1.0``, and Alice was both ``issuer`` and ``owner``, so both conditions were satisfied, and you could successfully create the contract.
To see this in action, go back to the Navigator and try to create the same ``Iou`` again, but with Bob as ``owner``. It will not work.
To see this in action, go back to the Navigator and try to create the same ``Iou`` again, but with Bob as ``owner`` (with Alice as issuer). It will not work. Note that the Navigator shows success an failures as a small icon in the top right, as highlighted here (it would be a small "v" for success):
.. figure:: quickstart/images/navError.png
:alt: Navigator showing an error.
Observers are specified using the ``observer`` keyword:
@ -312,6 +317,8 @@ Observers are specified using the ``observer`` keyword:
:start-after: -- BEGIN_IOU_TEMPLATE_OBSERVERS
:end-before: -- END_IOU_TEMPLATE_OBSERVERS
Here, ``observer`` is the keyword and ``observers`` refers to the field of the template.
Next, the *rights* or *choices* are defined, in this case with ``owner`` as the ``controller``:
.. literalinclude:: quickstart/template-root/daml/Iou.daml
@ -336,10 +343,10 @@ Next, the *rights* or *choices* are defined, in this case with ``owner`` as the
Thus, ``owner`` has the right to:
- split the Iou
- merge it with another one differing only on ``amount``
- initiate a transfer
- add and remove observers
- Split the Iou.
- Merge it with another one differing only on ``amount``.
- Initiate a transfer.
- Add and remove observers.
The ``Iou_Transfer`` choice above takes a parameter called ``newOwner`` and creates a new ``IouTransfer`` contract and returns its ``ContractId``. It is important to know that, by default, choices *consume* the contract on which they are exercised. Consuming, or archiving, makes the contract no longer active. So the ``IouTransfer`` replaces the ``Iou``.
@ -380,18 +387,18 @@ The following block, for example, issues an ``Iou`` and transfers it to Alice:
Compare the script with the ``initialize`` script in ``daml/Main.daml``. You will see that the script you used to initialize the sandbox is an initial segment of the ``trade_test`` script. The latter adds transactions to perform the trade you performed through Navigator, and a couple of transactions in which expectations are verified.
After a short time, the text *Script results* should appear above the test. Click on it to open the visualization of the resulting ledger state.
After a short time, the text *Script results* should appear above the test. Click on it (in ``daml/Tests/Trade.daml``) to open the visualization of the resulting ledger state.
.. figure:: quickstart/images/ledger.png
:alt: The Script Results view showing two subtransactions: one with Issuer USD_Bank and Owner Alice, the other with Issuer EUR_Bank and Owner Bob.
Each row shows a contract on the ledger. The first four columns show which parties know of which contracts. The remaining columns show the data on the contracts. You can see past contracts by checking the **Show archived** box at the top. Click the adjacent **Show transaction view** button to switch to a view of the entire transaction tree.
Each row shows a contract on the ledger. The last four columns show which parties know of which contracts. The remaining columns show the data on the contracts. You can see past contracts by checking the **Show archived** box at the top. Click the adjacent **Show transaction view** button to switch to a view of the entire transaction tree.
In the transaction view, transaction ``6`` is of particular interest, as it shows how the Ious are exchanged atomically in one transaction. The lines starting ``disclosed to (since)`` show that the Banks do indeed not know anything they should not:
.. code-block:: none
TX 6 1970-01-01T00:00:00Z (Tests.Trade:70:14)
TX 6 1970-01-01T00:00:00Z (Tests.Trade:71:14)
#6:0
│ disclosed to (since): 'Alice' (6), 'Bob' (6)
└─> 'Bob' exercises IouTrade_Accept on #5:0 (IouTrade:IouTrade)
@ -430,7 +437,6 @@ In the transaction view, transaction ``6`` is of particular interest, as it show
#6:5
│ disclosed to (since): 'Alice' (6), 'Bob' (6), 'USD_Bank' (6)
└─> 'Alice' exercises IouTransfer_Accept on #6:4 (Iou:IouTransfer)
with
children:
#6:6
│ disclosed to (since): 'Alice' (6), 'Bob' (6), 'USD_Bank' (6)
@ -466,7 +472,6 @@ In the transaction view, transaction ``6`` is of particular interest, as it show
#6:9
│ disclosed to (since): 'Alice' (6), 'Bob' (6), 'EUR_Bank' (6)
└─> 'Bob' exercises IouTransfer_Accept on #6:8 (Iou:IouTransfer)
with
children:
#6:10
│ disclosed to (since): 'Alice' (6), 'Bob' (6), 'EUR_Bank' (6)
@ -509,18 +514,31 @@ To compile the Java integration for the quickstart application, we first need to
daml codegen java
Once the code has been generated, we can now compile it using ``mvn compile``.
Once the code has been generated (into ``target/generated-sources`` per the instructions in ``daml.yaml``), we can compile it using::
Now start the Java integration with ``mvn exec:java@run-quickstart``. Note that
this step requires that the sandbox started :ref:`earlier <quickstart-sandbox>` is running.
mvn compile
The application provides REST services on port ``8080`` to perform basic operations on behalf on ``Alice``.
Now, start the Java integration with::
.. note::
mvn exec:java@run-quickstart -Dparty=$(cat output.json | sed 's/\[\"//' | sed 's/".*//')
To start the same application on another port, use the command-line parameter ``-Drestport=PORT``. To start it for another party, use ``-Dparty=PARTY``.
Note that this step requires that the sandbox started :ref:`earlier <quickstart-sandbox>` is still running. If it is not, you'll have to run the ``daml sandbox`` and ``daml script`` commands again to get an ``output.json`` in sync with the new state of the sandbox (party names can change with each sandbox restart).
For example, to start the application for Bob on ``8081``, run ``mvn exec:java@run-quickstart -Drestport=8081 -Dparty=Bob``
The application provides REST services on port ``8080`` to perform basic operations on behalf on ``Alice``. For example, check that::
curl http://localhost:8080/iou
returns, for a newly-created sandbox (where you have just run the init script to get the ``output.json`` file), something like::
{"0":{"issuer":"EUR_Bank::NAMESPACE","owner":"Alice::NAMESPACE","currency":"EUR","amount":100.0000000000,"observers":[]}}
If you still have the same sandbox running against which you have run the Navigator steps above, the output might look more like::
{"0":{"issuer":"Alice::NAMESPACE","owner":"Bob::NAMESPACE","currency":"AliceCoin","amount":1.0000000000,"observers":[]},"1":{"issuer":"USD_Bank::NAMESPACE","owner":"Alice::NAMESPACE","currency":"USD","amount":110.0000000000,"observers":[]}}
To start the same application on another port, use the command-line parameter ``-Drestport=PORT``. To start it for another party, use ``-Dparty=PARTY``. For example, to start the application for Bob on ``8081``, run::
mvn exec:java@run-quickstart -Drestport=8081 -Dparty=Bob$(cat output.json | sed 's/\[\"//' | sed 's/".*//')
The following REST services are included:
@ -534,26 +552,31 @@ The following REST services are included:
``curl -X GET http://localhost:8080/iou/0``
- ``PUT`` on ``http://localhost:8080/iou`` creates a new Iou on the ledger.
To create another *AliceCoin*, run:
To create another *AliceCoin*, run::
curl -X PUT -d '{"issuer":"Alice::NAMESPACE","owner":"Alice::NAMESPACE","currency":"AliceCoin","amount":1.0,"observers":[]}' http://localhost:8080/iou
Note that you have to replace ``NAMESPACE`` with the real namespace assigned by the sandbox; you can find it in ``output.json``::
ns=$(cat output.json | sed 's/\[\"Alice:://' | sed 's/".*//'); curl -X PUT -d "$(printf '{"issuer":"Alice::%s","owner":"Alice::%s","currency":"AliceCoin","amount":1.0,"observers":[]}' $ns $ns)" http://localhost:8080/iou
``curl -X PUT -d '{"issuer":"Alice","owner":"Alice","currency":"AliceCoin","amount":1.0,"observers":[]}' http://localhost:8080/iou``
- ``POST`` on ``http://localhost:8080/iou/ID/transfer`` transfers the Iou with Id ``ID``.
Check the Id of your new *AliceCoin* by listing all active Ious. If you have followed this guide, it will be ``0`` so you can run:
Check the index of your new *AliceCoin* by listing all active Ious. If you have just run the init script, it will be ``0``; if you have run the Navigator section, it will likely be ``2``. Once you have the index, you can run::
``curl -X POST -d '{ "newOwner":"Bob" }' http://localhost:8080/iou/0/transfer``
ns=$(cat output.json | sed 's/\[\"Alice:://' | sed 's/".*//'); curl -X POST -d "{\"newOwner\":\"Bob::${ns}\"}" http://localhost:8080/iou/0/transfer
to transfer it to Bob. If it's not ``0``, just replace the ``0`` in ``iou/0`` in the above command.
The automation is based on the :doc:`Java bindings </app-dev/bindings-java/index>` and the output of the :doc:`Java code generator </app-dev/bindings-java/codegen>`, which are included as a Maven dependency and Maven plugin respectively:
The automation is based on the :doc:`Java bindings </app-dev/bindings-java/index>` and the output of the :doc:`Java code generator </app-dev/bindings-java/codegen>`, which are included as a Maven dependency and Maven plugin respectively in the ``pom.xml`` file created by the template:
.. literalinclude:: quickstart/template-root/pom.xml
:language: xml
:lines: 22-32
It consists of the application in file ``IouMain.java``. It uses the class ``Iou`` from ``Iou.java``, which is generated from the Daml model with the Java code generator. The ``Iou`` class provides better serialization and de-serialization to JSON via `gson <https://github.com/google/gson>`_.
It consists of the application in file ``IouMain.java``. It uses the class ``Iou`` from ``Iou.java``, which is generated from the Daml model with the Java code generator. The ``Iou`` class provides better serialization and de-serialization to JSON via `gson <https://github.com/google/gson>`_. Looking at ``src/main/java/com/daml/quickstart/iou/IouMain.java``:
#. A connection to the ledger is established using a ``LedgerClient`` object.
#. A connection to the ledger is established using a ``DamlLedgerClient`` object.
.. literalinclude:: quickstart/template-root/src/main/java/com/daml/quickstart/iou/IouMain.java
:language: java
@ -602,7 +625,7 @@ It consists of the application in file ``IouMain.java``. It uses the class ``Iou
.. literalinclude:: quickstart/template-root/src/main/java/com/daml/quickstart/iou/IouMain.java
:caption: CreateCommand
:language: java
:lines: 113-114
:lines: 112-113
:dedent: 10
The rest of the application sets up the REST services using `Spark Java <http://sparkjava.com/>`_, and does dynamic package Id detection using the Package Service. The latter is useful during development when package Ids change frequently.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 766 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 777 KiB