Skip to content

Commit

Permalink
removing duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
oduameh committed Jun 13, 2024
2 parents 469218a + 01562f8 commit 44120f3
Showing 1 changed file with 72 additions and 1 deletion.
73 changes: 72 additions & 1 deletion docs/docs/tutorial/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ The Hydra Head protocol requires a connection to the Cardano layer 1 network to

Download the latest blockchain snapshot using `mithril-client` configured for the `pre-production` network:

<<<<<<< HEAD
=======
Download the latest blockchain snapshot using `mithril-client` configured for the `preprod` network:
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
```shell
mithril-client cardano-db download latest
Expand Down Expand Up @@ -180,6 +184,11 @@ source <(cardano-cli --bash-completion-script cardano-cli)


First, generate Cardano key pairs and addresses for both participants to identify the `hydra-node` and manage funds on layer 1:
<<<<<<< HEAD
=======

First, generate Cardano key pairs and addresses for both participants to identify the `hydra-node` and manage funds on layer one:
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2

import Tabs from '@theme/Tabs';
Expand Down Expand Up @@ -233,6 +242,11 @@ cardano-cli address build \

</TabItem>
Next, fund these addresses. If you have test ada on the `pre-production` network, distribute it to the newly created addresses:
<<<<<<< HEAD
=======

Next, fund these addresses. If you have tADA on `preprod`, distribute it to the newly created addresses:
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
<Tabs queryString="role">
<TabItem value="alice" label="Alice">
Expand Down Expand Up @@ -261,6 +275,10 @@ echo $(cat credentials/bob-funds.addr)"\n"

In case you don't have test ada on `pre-production`, you can use the [testnet faucet](https://docs.cardano.org/cardano-testnets/tools/faucet/) to fund your wallet or the addresses above. Note that due to rate limiting, it's better to request large sums for efficiency and distribute as needed.

<<<<<<< HEAD
=======
In case you have no tADA on `preprod`, you can use the [Testnet Faucet](https://docs.cardano.org/cardano-testnet/tools/faucet/) to fund your wallet or the addresses above. Note that due to rate limiting, it's better to request large sums for efficiency and distribute as needed.
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
:::

You can check the balance of your addresses via:
Expand Down Expand Up @@ -290,6 +308,10 @@ cardano-cli query utxo --address $(cat credentials/bob-funds.addr) --out-file /d
</TabItem>
Next, generate Hydra key pairs for use on layer 2. Use the

<<<<<<< HEAD
=======
Next, generate Hydra key pairs for use on layer two. Use the
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
`hydra-tools` to generate the keys for `alice` and/or `bob` respectively:

<Tabs queryString="role">
Expand All @@ -309,39 +331,65 @@ hydra-node gen-hydra-key --output-file credentials/bob-hydra
</TabItem>
If you are collaborating with another individual, exchange the verification (public) keys: `{alice,bob}-node.vk` and `{alice,bob}-hydra.vk` to ensure secure communication.

<<<<<<< HEAD
Before launching the `hydra-node`, it's crucial to establish and communicate each participant's network connectivity details. This includes the IP addresses and ports where `Alice` and `Bob's` nodes will be reachable for layer 2 network interactions. For this tutorial, we're using placeholder IP addresses and ports which should be replaced with your actual network details:

=======
If you are collaborating with a partner, exchange the verification (public) keys: `{alice,bob}-node.vk` and `{alice,bob}-hydra.vk` to ensure secure communication
Before launching the `hydra-node`, it's crucial to establish and communicate each participant's network connectivity details. This includes the IP addresses and ports where `Alice` and `Bob's` nodes will be reachable for layer 2 network interactions. For this tutorial, we're using placeholder IP addresses and ports which should be replaced with your actual network details:

Before launching the `hydra-node`, it's crucial to establish and communicate each participant's network connectivity details. This includes the IP addresses and ports where `Alice` and `Bob's` nodes will be reachable for the layer two network interactions. For this tutorial, we're using placeholder IP addresses and ports which should be replaced with your actual network details:
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
<!-- TODO: can we make peers configurable via some text input? -->

Alice: <code>127.0.0.1:5001</code>

Bob: <code>127.0.0.1:5001</code>
The next step involves configuring the protocol parameters for the ledger within our Hydra head. For the purposes of this tutorial, we'll modify the default Cardano layer 1 parameters to eliminate transaction fees, simplifying test interactions:

<<<<<<< HEAD
The next step involves configuring the protocol parameters for the ledger within our Hydra head. For the purposes of this tutorial, we'll modify the default Cardano layer 1 parameters to eliminate transaction fees, simplifying test interactions:

=======
The next step involves configuring the protocol parameters for the ledger within our Hydra head. For the purposes of this tutorial, we'll modify the default Cardano layer one parameters to eliminate transaction fees, simplifying our test interactions:
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
```
cardano-cli query protocol-parameters \
| jq '.txFeeFixed = 0 |.txFeePerByte = 0 | .executionUnitPrices.priceMemory = 0 | .executionUnitPrices.priceSteps = 0' \
> protocol-parameters.json
This command adjusts the fees and pricing mechanisms to zero, ensuring that transactions within the Hydra head incur no costs.
<<<<<<< HEAD
=======
This command adjusts the fees and pricing mechanisms to zero, ensuring that transactions within our Hydra head incur no costs.
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
In summary, the Hydra head participants exchanged and agreed on:
- IP addresses and the port on which their `hydra-node` will run
- A Hydra verification key to identify them in the head
- A Cardano verification key to identify them on the blockchain
- Protocol parameters to use in the Hydra head
<<<<<<< HEAD
=======
## Step 3. Start the Hydra node
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
## Step 3. Start the Hydra node
<<<<<<< HEAD
Scripts are pre-published for all [released](https://github.com/input-output-hk/hydra/releases) HYDRA_VERSIONs of the `hydra-node` and common Cardano networks. Consult the [user manual](../configuration#reference-scripts) for guidance on publishing your own scripts.
=======
Scripts are pre-published for all [released](https://github.com/input-output-hk/hydra/releases) HYDRA_VERSIONs of the `hydra-node` and common Cardano networks. Consult the [user manual](../configuration#reference-scripts) for guidance on publishing your own scripts.
For all [released](https://github.com/input-output-hk/hydra/releases) HYDRA_VERSIONs of the `hydra-node` and common Cardano networks, scripts are pre-published. Consult the [user manual](../configuration#reference-scripts) for guidance on publishing your own scripts.
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
Start the `hydra-node` using these parameters:
<Tabs queryString="role">
Expand Down Expand Up @@ -447,8 +495,16 @@ Send this command to initialize a head through the Websocket connection:
```

The initiation process might take some time as it includes submitting a transaction on-chain. Upon successful initiation, both Hydra nodes and their clients will display a `HeadIsInitializing` message, listing the parties required to commit.
<<<<<<< HEAD

To commit funds to the head, you need to choose which UTXOs you would like to make available on layer 2. Use the HTTP API of `hydra-node` to commit all funds given to `{alice,bob}-funds.vk` beforehand:
=======

To commit funds to the head, you need to choose which UTXOs you would like to make available on layer 2. Use the HTTP API of `hydra-node` to commit all

To commit funds to the head, meaning to choose which UTXOs to make available on layer two. Use the HTTP API of `hydra-node` to commit all
funds given to `{alice,bob}-funds.vk` beforehand:
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
<Tabs queryString="role">
<TabItem value="alice" label="Alice">
Expand Down Expand Up @@ -510,16 +566,27 @@ After you've prepared your transactions, the `hydra-node` will find all UTXOs as
Once the `hydra-node` sees this transaction, you should see a `Committed` status displayed on your WebSocket connection.

When both parties, `alice` and `bob`, have committed, the Hydra head will open automatically. You'll see a `HeadIsOpen` message appear in the WebSocket session, confirming the activation of the head. This message will include details such as the starting balance and UTXO entries. Notably, these entries will match exactly those committed to the head, including transaction hashes and indices, ensuring transparency and consistency.
<<<<<<< HEAD

The head is now operational and ready for further activities.


=======

The head is now operational and ready for further activities.

The head is now operational and ready for further activities.
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
## Step 5. Use the Hydra head

In this step, we'll demonstrate a basic transaction between `alice` and `bob` using the Hydra head. Hydra Head operates as an isomorphic protocol, meaning that functionalities available on the Cardano layer 1 network are also available on the layer 2 network. This compatibility allows us to use familiar tools like `cardano-cli` for transaction creation within the head.

In this example, we will transfer 10 ada from Alice to Bob. Adjust the transaction amount based on the balances previously committed to the head.

<<<<<<< HEAD
=======
In this example, we will transfer `10₳` from Alice to Bob. Adjust the transaction amount based on the balances previously committed to the head.
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
First, we need to select a UTXO to spend. We can find a UTXO by referring to the `utxo` field in the most recent `HeadIsOpen` or `SnapshotConfirmed` messages. Alternatively, we can query the current UTXO set directly from the API:

Expand Down Expand Up @@ -582,6 +649,10 @@ The transation will be validated by both `hydra-node`s and either result in a
🎉 Congratulations, you just processed your first Cardano transaction off-chain
in a Hydra head!

<<<<<<< HEAD
=======
## Step 6. Close the Hydra head
>>>>>>> 01562f8643630225af4221a4a243d3cefc4da7f2
## Step 6. Closing the Hydra head

Expand Down

0 comments on commit 44120f3

Please sign in to comment.