Skip to content

Commit

Permalink
Update simple script documentation with Allegra time locking scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Dec 3, 2020
1 parent a3780dc commit 2f4f219
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions doc/reference/multisig.md → doc/reference/simple-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,78 @@ cardano-cli shelley transaction assemble \
--out-file spendMultiSig
```
You can now submit this tx via `cardano-cli shelley transaction submit`!


# Simple Script

In the Allegra era, we introduce the ability to time lock your multi signature scripts. From now on we will refer to these scripts (collectively) as simple scripts and differentiate them based on the era they are present in and which features are available. That is, in the Shelley era we do not have time locking available in our scripts but in the Allegra era we do.

NB: If you specify `"type": "any"` this will allow you to spend from your script address regardless of what time lock you have declared.

Once you have generated your time locked script you need to follow all the same steps above for a multi signature script with a slight modification of [step 1](#Step-1---construct-the-tx-body) which needs to be amended as follows:

Examples of the time locking scripts are:

## After

```json
{
"scripts": [
{
"keyHash": "966e394a544f242081e41d1965137b1bb412ac230d40ed5407821c37",
"type": "sig"
},
{
"slot": 1000,
"type": "after"
}
],
"type": "all"
}
```
For `after` scripts we must provide a lower bound that is less than or equal to the specified slot number in our simple script. In the example above this means <= 1000:

```bash
cardano-cli shelley transaction build-raw \
--ttl 1000 \
--lower-bound 1000\
--fee 0 \
--tx-in (txin of script address)
--tx-out yourspecifiedtxout \
--out-file spendScriptTxBody
```

## Before

```json
{
"scripts": [
{
"keyHash": "966e394a544f242081e41d1965137b1bb412ac230d40ed5407821c37",
"type": "sig"
},
{
"slot": 3000,
"type": "before"
}
],
"type": "all"
}
```

For before scripts we must provide an upper bound that is more than or equal to the specified slot number in our simple script. In the example above this means >= 3000:

```bash
cardano-cli shelley transaction build-raw \
--ttl 1000 \
--upper-bound 3000\
--fee 0 \
--tx-in (txin of script address)
--tx-out yourspecifiedtxout \
--out-file spendScriptTxBody
```





0 comments on commit 2f4f219

Please sign in to comment.