You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/how-to/commit-script-utxo.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ sidebar_position: 2
6
6
7
7
This guide provides a walkthrough on how to commit a UTxO from a script into a Hydra Head.
8
8
9
-
A **Script UTxO** is a special kind of Unspent Transaction Output (UTxO) that isn't controlled by a simple private key. Instead, it's locked by a script—a small program that runs on the blockchain. To spend the funds in a Script UTxO, you must provide data (a "redeemer" and "datum") that satisfies the conditions defined in that script.
9
+
A **Script UTxO** is a special kind of Unspent Transaction Output (UTxO) that isn't controlled by a simple private key. Instead, it is locked by a script - a small program that runs on the blockchain. To spend the funds in a Script UTxO, you must provide data (a "redeemer" and "datum") that satisfies the conditions defined in that script.
10
10
11
11
Committing a script UTxO to a Hydra Head is a powerful feature that allows for more complex on-chain validation logic to be brought into the Head. This is useful for scenarios where you need to enforce specific rules on how funds can be spent, even within the Head's off-chain environment.
12
12
@@ -24,7 +24,7 @@ You will also need:
24
24
25
25
## Step 1: Create the script
26
26
27
-
For this tutorial, we'll use a simple "always true" validator script. This script will always succeed, regardless of the redeemer or datum.
27
+
For this tutorial, we will use a simple "always true" validator script. This script will always succeed, regardless of the redeemer or datum.
28
28
29
29
Create a file named `always-true.plutus` with the following content:
30
30
@@ -57,7 +57,7 @@ cat script.addr
57
57
58
58
Before we can commit a script UTxO, we need to create one. This is done by sending funds to the script address.
59
59
60
-
First, find a UTxO in your wallet that you can use. You can query your wallet's UTxOs using `cardano-cli`. For this example, we'll use `alice-funds.sk`:
60
+
First, find a UTxO in your wallet that you can use. You can query your wallet's UTxOs using `cardano-cli`. For this example, we will use `alice-funds.sk`:
61
61
62
62
```shell
63
63
cardano-cli query utxo \
@@ -66,7 +66,7 @@ cardano-cli query utxo \
66
66
--socket-path testnets/preprod/node.socket
67
67
```
68
68
69
-
Pick a UTxO from the output and use it to build a transaction that sends funds to the script address. Let's say you picked a UTxO with TxHash `<UTXO_TXIX>` containing `100 ADA`. We'll send `10 ADA` to the script address.
69
+
Pick a UTxO from the output and use it to build a transaction that sends funds to the script address. Let's say you picked a UTxO with TxHash `<UTXO_TXIX>` containing `100 ADA`. We will send `10 ADA` to the script address.
70
70
71
71
First, create a file named `datum.json` that contains the datum. For this example, we will just use the integer `42`.
72
72
@@ -121,11 +121,11 @@ cardano-cli query utxo \
121
121
122
122
## Step 4: Prepare the commit
123
123
124
-
Now we are ready to prepare the commit. We'll create a blueprint transaction that spends the script UTxO. Note that this transaction is not meant to be signed and submitted to the Cardano network. It's just a blueprint that we'll send to the `hydra-node` to get a properly drafted commit transaction.
124
+
Now we are ready to prepare the commit. We will create a blueprint transaction that spends the script UTxO. Note that this transaction is not meant to be signed and submitted to the Cardano network. It is just a blueprint that we will send to the `hydra-node` to get a properly drafted commit transaction.
125
125
126
126
We use `cardano-cli ... build-raw` to construct this blueprint because it gives us full control over the transaction structure without trying to automatically balance it or calculate fees, which is perfect for a blueprint.
127
127
128
-
In this transaction, we'll spend the script UTxO and send the funds to our own wallet address.
128
+
In this transaction, we will spend the script UTxO and send the funds to our own wallet address.
129
129
130
130
```shell
131
131
cardano-cli conway transaction build-raw \
@@ -143,7 +143,7 @@ A real-world script, like one written in [Aiken](https://aiken-lang.org/), would
143
143
144
144
## Step 5: Commit the script UTxO
145
145
146
-
This final step is very similar to the standard commit tutorial. We'll start a `hydra-node`, initialize a Head, and then use the blueprint transaction to get a commit transaction from the `hydra-node`.
146
+
This final step is very similar to the standard commit tutorial. We will start a `hydra-node`, initialize a Head, and then use the blueprint transaction to get a commit transaction from the `hydra-node`.
147
147
148
148
First, start the `hydra-node` and `hydra-tui` as explained in the [Commit using a blueprint](./commit-blueprint.md#step-5) tutorial and initialize a Head.
0 commit comments