Skip to content
Permalink
Browse files

fix tutorial images

  • Loading branch information...
shmish111 committed Sep 11, 2019
1 parent b17021c commit 7af2aa5d3387ac710ce944c9959c9c884bea45d6
@@ -7,7 +7,7 @@ and reusable descriptions of Marlowe contracts.

=== A simple escrow contract, revisited.

image:./pix/escrow.png[Escrow]
image:./images/escrow.png[Escrow]

Recall that we developed this Marlowe contract in our
link:./escrow-ex.adoc[earlier tutorial].
@@ -7,7 +7,7 @@ first example of a Marlowe contract.

=== A simple escrow contract

image:./pix/escrow.png[Escrow]
image:./images/escrow.png[Escrow]

Suppose that `+alice+` wants to buy a cat from `+bob+`, but neither of
them trusts the other. Fortunately, they have a mutual friend `+carol+`
@@ -25,7 +25,7 @@ ada.
* Funds will be locked until time 100.
* Only after time 100 funds will be redeemable.
image:./pix/escrow/contract1.png[Lock Savings,title="Lock Savings"]
image:./images/escrow/contract1.png[Lock Savings,title="Lock Savings"]

Marlowe code:

@@ -56,7 +56,7 @@ Rules:
* Alice can redeem funds after time 100 if Bob did not claim the
payment.
image:./pix/escrow/contract2.png[Lock
image:./images/escrow/contract2.png[Lock
Savings,title="Simple Payment with time limit to claim"]

Marlowe code:
@@ -98,7 +98,7 @@ the payment to Bob.
100.
* Funds are reedemable by Alice after time 100.
image:./pix/escrow/contract3.png[Lock Savings,title="Authorize payment"]
image:./images/escrow/contract3.png[Lock Savings,title="Authorize payment"]

Marlowe code:

@@ -137,7 +137,7 @@ Rules:
from time 41 to time 100.
* Funds are reedemable by Alice after time 100.
image:./pix/escrow/contract4.png[Lock Savings,title="Deny payment"]
image:./images/escrow/contract4.png[Lock Savings,title="Deny payment"]

Marlowe code:

@@ -188,7 +188,7 @@ after time 100.
payment from time 61 to time 100.
* Funds are reedemable by Alice after time 100.
image:./pix/escrow/contract5.png[Lock Savings,title="Simple Escrow"]
image:./images/escrow/contract5.png[Lock Savings,title="Simple Escrow"]

Marlowe Code:

@@ -246,11 +246,11 @@ immediatly.
payment from time 61 to time 100.
* Funds are reedemable by Alice after time 100.
image:./pix/escrow/contract6.png[Lock Savings,title="Complete Escrow"]
image:./images/escrow/contract6.png[Lock Savings,title="Complete Escrow"]

Decision Tree

image:./pix/escrow/contract8.png[Lock Savings,title="Decision tree"]
image:./images/escrow/contract8.png[Lock Savings,title="Decision tree"]

Marlowe Code:

@@ -139,7 +139,7 @@ This completes our discussion of the types that make up Marlowe contracts.
As we noted earlier, the semantics of Marlowe consist in building _transactions_, like this:
[#img-transaction]
[caption="Figure 1: "]
image:./pix/transaction.svg[]
image:./images/transaction.svg[]
A transaction is built from a series of steps, some of which consume an input value, and others produce effects, or payments. In describing this we explained that a transaction modified a contract (to its continuation) and the state, but more precisely we have a function
[source,haskell]
----
@@ -44,7 +44,7 @@ Putting this together gives us a _transaction_, as shown in the diagram below, a
.Building a transaction
[#img-transaction]
[caption="Figure 1: "]
image:./pix/transaction.svg[]
image:./images/transaction.svg[]


==== link:./escrow-ex.adoc[Prev] link:./README.adoc[Up] link:./marlowe-step-by-step.adoc[Next]
@@ -81,7 +81,7 @@ transaction outputs, including scripts. It is possible to initialize a
contract with a particular state, containing a number of commitments, as
shown here.

image:./pix/marlowe-001-crop.png[initialisation]
image:./images/marlowe-001-crop.png[initialisation]

*Execution.* Marlowe contract execution consists of a chain of
transactions, where the remaining contract and state are passed through
@@ -93,7 +93,7 @@ by providing a valid input in a redeemer script, and produces a
transaction output with a Marlowe contract as continuation, as can be
seen here.

image:./pix/marlowe-002-crop.png[transaction sequence]
image:./images/marlowe-002-crop.png[transaction sequence]

The Marlowe interpreter first validates the current contract and state.
That is, we check that the contract correctly uses identifiers, and
@@ -169,7 +169,7 @@ the following continuation:
and take all the money, as in here, making Charlie reasonably
disappointed with all those smart contracts.

image:./pix/marlowe-003-crop.png[malicious sequence]
image:./images/marlowe-003-crop.png[malicious sequence]

To avoid this we must ensure that the continuation contract we evaluate
is equal to the one in the data script of its transaction output.
@@ -37,14 +37,14 @@ Marlowe contract, which is made visible below the Haskell pane. Once we
are happy with the result, we can send it to the simulator pane by
clicking *Send to simulator*.

image:./pix/haskell-2.png[The Haskell editor]
image:./images/haskell-2.png[The Haskell editor]

The figure shows a screenshot of the Marlowe Playground in the middle of
developing an “escrow” contract; other contract examples, based on the
link:./actus-marlowe.adoc[ACTUS] standard, can be loaded by clicking on
the named *Demos* below the *HASKELL EDITOR* tab.

image:./pix/gists.png[Loading and saving github gists]
image:./images/gists.png[Loading and saving github gists]

If you have a github account, it's also possible to save contracts that you develop as _github gists_. To do this log into your account using the *Log in* button at the top right of the screen. You will then see buttons to allow you to *Publish* or save contracts as gists, and to *Load* contracts from github.

@@ -82,15 +82,15 @@ changes, and this is reflected in the values show in the *State* section
in the middle of the screen. We revisit this below.
* A number of additional demos are available using the buttons to the top right of the _Marlowe Contract_ pane.

image:./pix/simulation.png[Marlowe Playground simulation]
image:./images/simulation.png[Marlowe Playground simulation]

=== Building inputs and transactions

We can build our first transaction by selecting the purple plus symbol
`+++` to the left of the potential inputs. If we select the first action
– a deposit by `+alice+` – we see

image:./pix/step1.png[Simulation step 1]
image:./images/step1.png[Simulation step 1]

where this potential action has disappeared, but it now appears as the first (and only) element in the input list of the transaction.
If we choose
@@ -105,7 +105,7 @@ owner and value.
* The contract itself has also evolved to a `+When+` construct that waits for a
choice. Two choices are possible here: from Alice or from Bob.

image:./pix/step2.png[Simulation step 2]
image:./images/step2.png[Simulation step 2]

We could then advance to the next block, or indeed a number of steps,
and the current block is shown below the row of four buttons, together with
@@ -115,7 +115,7 @@ Taking another step to reflect that Alice has received the cat from Bob,
Alice and Bob agree and both choose value 0, for “pay”, and make that into a
transaction:

image:./pix/step3.png[Simulation step 3]
image:./images/step3.png[Simulation step 3]

Applying that transaction makes the contract evolve and to make the payment of
the money to Bob, as is reflected in the state of the Playground in the following image. Note here
@@ -126,17 +126,17 @@ the money to Bob, as is reflected in the state of the Playground in the followin

Moreover the current contract is now `Refund`, which has no effect since all the money in the contract has been spent.

image:./pix/step4.png[Simulation step 4]
image:./images/step4.png[Simulation step 4]

At any point it is possible to _undo_ a step by selecting the *Undo*
button. From the current state, doing this repeatedly will return us to the
position where Alice and Bob are prompted for a choice. If Alice and Bob now make _different_ choices, we reach the following situation, where Carol is asked to choose `0` (for pay) or `1` (for refund):

image:./pix/step5.png[Simulation step 5]
image:./images/step5.png[Simulation step 5]

After this choice we see this, where Alice is shown to have received her refund:

image:./pix/step6.png[Simulation step 6]
image:./images/step6.png[Simulation step 6]

At any point in the simulation, as well as being able to *Undo* one step, we can also completely _reset_ the
system to its initial state by pressing the *Reset* button.

0 comments on commit 7af2aa5

Please sign in to comment.
You can’t perform that action at this time.