Skip to content
Browse files

playground: Add changelog

Add a changelog and a brief overview of the new features.
  • Loading branch information...
j-mueller committed Apr 13, 2019
1 parent 56a4d1c commit 55d6118e6e456adba03730778fa5517a5e0053dc
@@ -0,0 +1,17 @@
# Changelog

## Playground v2.0.0 (April 11th 2019)

### New Features

* [Gist integration](./plutus-tutorial/markdown/
* [Support for multiple traces](./plutus-tutorial/markdown/
* [Multi-currency ledger](./plutus-tutorial/markdown/
* [Validity range for transactions](./plutus-tutorial/markdown/

### Enhancements

* Tabbed layout
* Improved blockchain graph
* Cryptographic primivites
* Improved vesting example
@@ -0,0 +1,40 @@
# Gist Support

In the [Plutus Playground]( you can now save your contracts and simulations to Github [gists]( and read them from there.

## Getting started

To use the gist integration you need to create an account on [Github]( if you don't already have one.

Open the Playground and click on the "Login" button in the top right corner:

![Gist login button](./img/2019-04-11-gist-login.PNG)

This brings up a Github authorisation page. After granting the permission to acess gists you are redirected back to the Playground. The "Login" button has been replaced by "Publish" and "Load" buttons:

![Gist publish and load buttons](./img/2019-04-11-gist-publish-load-buttons.PNG)

## Publishing a contract for the first time

When you click "Publish", two things happen.

1. A new gist is created under your profile on Github. (To view all of your gists go to `<your github username>`)
2. The ID of the gist appears in the textbox and the "Publish" button changes to "Republish". A link "View on Github" appears.

![Gist republish](./img/2019-04-11-gist-loaded.PNG)

The link takes you to the gist on Github. There are two files: `Playground.hs` containing the source code of your contract, and `Simulation.json` with the wallets and actions that you have set up.

## Publishing a new version

Every gist is backed by a git repository. Clicking the "Republish" button creates a new commit for the gist. When you click "View on Github" again you will see that the revision count has increased:

![Gist revision](./img/2019-04-11-gist-revisions.PNG)

To see all prior versions of the contract click the "Revisions" tab on the gist's Github page.

## Sharing your contract

To share a Plutus contract with others, publish it and take note of the textbox next to the "Republish" button. This is the gist's ID. To load a contract from a gist simply enter the ID into the textbox and click the "Load" button. The Playground updates with the contract code and the simulations from the gist.

**Warning** Loading a gist overrides all content in the Playground.
@@ -0,0 +1,28 @@
# Multi-currency ledger

The blockchain simulator that backs the Playground has native support for user-defined currencies. This tutorial covers the Playground UI for entering and viewing amounts in currencies. For a detailed description of multi currency support on the ledger please refer to the [design document](../../docs/multi-currency/

## Known Currencies

Each currency on the ledger is identified by two 32-byte `ByteString`s. To make it easy to work with custom currencies in the Playground we have added a function `mkKnownCurrencies` (similar to `mkFunctions`). The argument to `mkKnownCurrencies` is a list of `KnownCurrency` values (exported from `Plutus.Playground`), which are defined as:

data KnownCurrency = KnownCurrency
{ hash :: ValidatorHash
, friendlyName :: String
, knownTokens :: NonEmpty TokenId

To define a `KnownCurrency` we need the `ValidatorHash` of the monetary policy script that controls the forging of the currency (see the [design document](../../docs/multi-currency/ for details). `friendlyName` can be any `String` of your choice. Whenever a value of a currency is shown, we will see the currency's `friendlyName` instead of its `ValidatorHash`. `knownTokens` is a non-empty list of the currency's token IDs.

myCurrency :: KnownCurrency
myCurrency = KnownCurrency { ... }
$(mkKnownCurrency ['myCurrency])

*TODO: Actua example*
@@ -0,0 +1,7 @@
# Multiple Simulations

The [Plutus Playground]( now supports multiple simulations. Simulations consist of a description of wallets with their initial balances, and a sequence of actions.


The "Simulation" tab shows one button for each simulation. To add a new simulation click the "+" button. To delete a simulation click the "X" button next to the simulation. Clicking on a simulation selects it.
@@ -0,0 +1,16 @@
# Validity range for transactions

All transactions on the simulated blockchain now have a *validity range*. The validity range is an (open, closed) interval of slots. Transactions may only be validated if their validity range contains the current slot number. The validity range feature is what makes Plutus scripts completely deterministic - their resource usage (and hence the amount of gas required to run them) can be computed before the transaction is submitted. As a result, there is no risk of a Plutus smart contract running out of gas accidentally, and no risk of overpaying gas fees either.

The Playground displays validity ranges as a pair of fiels `ivTo` and `ivFrom`:

![Validity range in the Playground](./img/2019-04-11-slot-range.PNG)

Note that the interval is inclusive-excluse. If the current slot number is equal to `ivTo` then the transaction can be validated, but if it is equal to or larger than `ivFrom` then it cannot be validated. Consider the following example:

![Validity range in the Playground](./img/2019-04-11-validity-range.PNG)

A transaction `ivFrom=5` and `ivTo=8` can be validated during any of the slots 5, 6, and 7.

Also please note the order of the fields in the UI: `ivTo` is shown before `ivFrom`. If you set `ivFrom` to a value greater than or equal to `ivTo` then the transaction can never be validated and will forver linger in the pool of pending transactions.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 55d6118

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