Skip to content

Commit f99e3ac

Browse files
committed
Update Readme, Refactor docs
1 parent b4372f5 commit f99e3ac

File tree

7 files changed

+184
-4
lines changed

7 files changed

+184
-4
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ volumes:
44
node-db:
55
services:
66
cardano-node:
7-
image: inputoutput/cardano-node:${CARDANO_NODE_VERSION:-9.2.0}
7+
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-10.5.1}
88
environment:
99
NETWORK: ${NETWORK:-preprod}
1010
volumes:

docs/docs/hydra-js-client/examples/commiting-utxos-to-hydra.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This example demonstrates how to set up a `Cip30ShelleyWallet` and use it to sig
1919
import { readFileSync } from "fs";
2020
import { loadCrypto, Ed25519Key, Value } from "libcardano";
2121
import { ShelleyWallet, Cip30ShelleyWallet } from "libcardano-wallet";
22-
import { KuberHydraApiProvider } from "../../../src/service/KuberHydraApiProvider"; // Adjust path as needed
22+
import { KuberHydraApiProvider } from "kuber-client"; // Adjust path as needed
2323
import { UTxO } from "libcardano/cardano/serialization";
2424

2525
async function runCip30CommitExample() {
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Setting Up
2+
3+
This guide walks through the steps to set up and run a Hydra Head using the `kuber-hydra` relay server. We’ll demonstrate the process using two Hydra nodes—**Alice** and **Bob**—on the Cardano testnet.
4+
5+
## **1. Hydra Node Setup**
6+
7+
To set up a Hydra Head on the testnet, follow the official Hydra protocol tutorial:
8+
👉 [Hydra Head Protocol Documentation](https://hydra.family/head-protocol/docs/tutorial)
9+
10+
In our example setup:
11+
12+
- **Alice's Hydra Node** runs on `172.16.238.10:4001`
13+
- **Bob's Hydra Node** runs on `172.16.238.20:4002`
14+
15+
## **2. Kuber-Hydra Relay Server**
16+
17+
### **Repository**
18+
19+
- GitHub: [kuber](https://github.com/dquadrant/kuber)
20+
21+
### **Configuration**
22+
23+
You can run `kuber-hydra` either directly or using Docker.
24+
25+
#### **Option 1: Running Natively**
26+
27+
To run `kuber-hydra` natively, you need to set the required environment variables and then run the application using `cabal`.
28+
29+
1. **Set Environment Variables (Required):**
30+
Before running, you must set the following environment variables:
31+
```bash
32+
export CARDANO_NODE_SOCKET_PATH=/path/to/cardano-node/preview/node.socket
33+
export NETWORK=2
34+
```
35+
- `CARDANO_NODE_SOCKET_PATH`: The path to your Cardano node socket.
36+
- `NETWORK`: The Cardano network ID (e.g., `2` for Preview testnet). This is a **required** environment variable.
37+
38+
2. **Run `kuber-hydra`:**
39+
Navigate to the `kuber-hydra` directory and run the application using `cabal`:
40+
```bash
41+
cd kuber-hydra
42+
cabal run kuber-hydra -- --hydra-url ws://172.16.238.10:4001 --port 8081
43+
```
44+
- `--hydra-url`: The WebSocket URL of your Hydra node. This is a **required** command-line argument.
45+
- `--port`: The port for the Kuber-Hydra relay server. If not specified, it defaults to `8081`.
46+
47+
> The Kuber-Hydra relay API will be accessible at `http://localhost:8081`.
48+
49+
#### **Option 2: Running with Docker (Recommended for quick setup)**
50+
51+
For a quick setup, you can use the provided `docker-compose.yml` to run `kuber-hydra` along with a Cardano node and Hydra node.
52+
53+
1. **Navigate to the `kuber-hydra` directory:**
54+
```bash
55+
cd kuber-hydra
56+
```
57+
2. **Start the services:**
58+
```bash
59+
docker-compose up -d
60+
```
61+
This will start `cardano-node`, `hydra-node`, and `kuber-hydra` in detached mode.
62+
63+
3. **Verify services are running:**
64+
```bash
65+
docker-compose ps
66+
```
67+
Ensure all services are up and healthy.
68+
69+
4. **Access the Kuber-Hydra Relay API:**
70+
The API will be accessible at `http://localhost:8081`.
71+
72+
## **3. Kuber Client**
73+
74+
Example repository: [kuber-client-example](https://github.com/cardanoapi/kuber-client-example)
75+
76+
### Hydra Service Initialization
77+
78+
Assuming that the hydra node is running and kuber-hdra server is started on localhost:8081, we can pass the host url to this class constructor to create the service:
79+
80+
```ts
81+
import { KuberHydraService } from "kuber-client/service/kuberHydraService";
82+
83+
const hydraService = new KuberHydraService("http://localhost:8081");

docs/docs/hydra-js-client/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Installation and Quick Start
1+
# Start developing
22

33
## Installation
44

docs/sidebars.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,15 @@ const sidebars: SidebarsConfig = {
7070
},
7171
],
7272
hydraJsClient: [
73+
{
74+
type: "doc",
75+
id: "hydra-js-client/getting-started",
76+
label: "🚀 Setting Up",
77+
},
7378
{
7479
type: "doc",
7580
id: "hydra-js-client/installation",
76-
label: "🚀 Installation & Quick Start",
81+
label: "📦 Start Developing",
7782
},
7883
{
7984
type: "category",

kuber-hydra/README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,52 @@
22

33
- [Project Scope and Planning](https://dquadrant.github.io/kuber/hydra_docusaurus/docs/milestones)
44
- [Architecture](https://dquadrant.github.io/kuber/hydra_docusaurus/docs/architecture)
5+
- [Getting Started with Kuber-Hydra](https://dquadrant.github.io/kuber/hydra_docusaurus/docs/hydra-js-client/getting-started)
6+
7+
## Running Kuber-Hydra
8+
9+
### Natively
10+
11+
To run `kuber-hydra` natively, you need to set the required environment variables and then run the application using `cabal`.
12+
13+
1. **Set Environment Variables (Required):**
14+
Before running, you must set the following environment variables:
15+
```bash
16+
export CARDANO_NODE_SOCKET_PATH=/path/to/cardano-node/preview/node.socket
17+
export NETWORK=2
18+
```
19+
- `CARDANO_NODE_SOCKET_PATH`: The path to your Cardano node socket.
20+
- `NETWORK`: The Cardano network ID (e.g., `2` for Preview testnet). This is a **required** environment variable.
21+
22+
2. **Run `kuber-hydra`:**
23+
Navigate to the `kuber-hydra` directory and run the application using `cabal`:
24+
```bash
25+
cd kuber-hydra
26+
cabal run kuber-hydra -- --hydra-url ws://172.16.238.10:4001 --port 8081
27+
```
28+
- `--hydra-url`: The WebSocket URL of your Hydra node. This is a **required** command-line argument.
29+
- `--port`: The port for the Kuber-Hydra relay server. If not specified, it defaults to `8081`.
30+
31+
### With Docker
32+
33+
For a quick setup, you can use the provided `docker-compose.yml` to run `kuber-hydra` along with a Cardano node and Hydra node.
34+
35+
1. **Navigate to the `kuber-hydra` directory:**
36+
```bash
37+
cd kuber-hydra
38+
```
39+
2. **Start the services:**
40+
Update the hydra-node configuration in docker-compose.yml and run the stack.
41+
```bash
42+
docker-compose up -d
43+
```
44+
This will start `cardano-node`, `hydra-node`, and `kuber-hydra` in detached mode.
45+
46+
3. **Verify services are running:**
47+
```bash
48+
docker-compose ps
49+
```
50+
Ensure all services are up and healthy.
51+
52+
4. **Access the Kuber-Hydra Relay API:**
53+
The API will be accessible at `http://localhost:8081`.

kuber-hydra/docker-compose.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
version: '3.8'
2+
3+
volumes:
4+
node-ipc:
5+
node-db:
6+
7+
services:
8+
cardano-node:
9+
image: ghcr.io/intersectmbo/cardano-node:${CARDANO_NODE_VERSION:-10.5.1}
10+
environment:
11+
NETWORK: ${NETWORK:-preprod}
12+
volumes:
13+
- node-db:/data/db
14+
- node-ipc:/ipc
15+
logging:
16+
driver: "json-file"
17+
options:
18+
max-size: "2M"
19+
max-file: "10"
20+
hydra-node:
21+
image: ghcr.io/cardano-scaling/hydra-node:0.22.0
22+
command: [] # appropriate command accordint to your cluster configuration
23+
volumes:
24+
- node-ipc:/ipc
25+
26+
kuber-hydra:
27+
image: dquadrant/kuber-hydra:latest
28+
ports:
29+
- "8081:8081"
30+
environment:
31+
HYDRA_URL: "hydra-node:5001"
32+
CARDANO_NODE_SOCKET_PATH: "/ipc/node.socket"
33+
NETWORK: ${NETWORK:-preprod}
34+
volumes:
35+
- node-ipc:/ipc
36+
depends_on:
37+
- cardano-node
38+
- hydra-node
39+
logging:
40+
driver: "json-file"
41+
options:
42+
max-size: "2M"
43+
max-file: "10"

0 commit comments

Comments
 (0)