Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 37 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ Then run:
kaleido setup
```

`kaleido setup` walks you through either:
`kaleido setup` creates and starts one mutinynet node with defaults. You can also run:

- a market-only setup that works without Docker
- a local-node setup that creates a Docker environment for you
```bash
kaleido setup signetcustom
```

Use `kaleido setup --mode market --defaults` for a market-only setup that works without Docker.

### Alternative installers

Expand Down Expand Up @@ -99,19 +102,19 @@ If you want to configure manually, use:

```bash
kaleido config show # view current config
kaleido config set api-url https://api.kaleidoswap.com
kaleido config set network signet
kaleido config set api-url https://api.signet.kaleidoswap.com/
kaleido config set network mutinynet
kaleido config reset # reset to defaults
```

Override per-command with flags or environment variables:

```bash
kaleido --node-url http://localhost:3001 wallet balance
kaleido --api-url https://api.kaleidoswap.com market pairs
kaleido --api-url https://api.signet.kaleidoswap.com/ market pairs

export KALEIDO_NODE_URL=http://localhost:3001
export KALEIDO_API_URL=https://api.kaleidoswap.com
export KALEIDO_API_URL=https://api.signet.kaleidoswap.com/
```

Valid config keys: `api-url`, `node-url`, `network`, `spawn-dir`
Expand All @@ -120,10 +123,11 @@ Valid config keys: `api-url`, `node-url`, `network`, `spawn-dir`

## Node Environments

The CLI uses a **named environment** model. Each environment is an isolated Docker Compose setup with its own compose file and data volumes stored under a base directory (default: `~/.kaleido/spawn/`).
The CLI uses a **named environment** model. Each environment is an isolated Docker Compose setup with its own compose file and data volumes stored under `~/.kaleido/` by default.

```
~/.kaleido/spawn/
~/.kaleido/
├── config.json
├── mainenv/
│ ├── docker-compose.yml
│ └── volumes/
Expand All @@ -138,17 +142,21 @@ The CLI uses a **named environment** model. Each environment is an isolated Dock
### Creating an environment

```bash
kaleido setup # create/start one mutinynet node with defaults
kaleido setup signetcustom # create/start one node on an explicit network
kaleido node create
# or give it a name directly:
kaleido node create testenv
```

`mutinynet`, `signetcustom`, and `customsignet` are accepted as aliases for the Kaleidoswap custom signet RLN network.

The wizard prompts for:

1. **Base directory** — where all environments are stored (saved to config as `spawn-dir`)
1. **Base directory** — where all environments are stored (default: `~/.kaleido`, saved to config as `spawn-dir`)
2. **Environment name** — becomes a subdirectory under the base dir
3. **Node count** — number of RGB Lightning Nodes to spin up
4. **Network** — `regtest`, `signet`, or `mainnet`
4. **Network** — `mutinynet` (default), `signetcustom`/`customsignet`, `signet`, `regtest`, or `mainnet`
5. **Node ports** — base daemon API port (3001+) and LDK peer port (9735+)
6. **Start now** — whether to bring containers up immediately

Expand Down Expand Up @@ -179,9 +187,9 @@ kaleido node use testenv --node 2 # use node 2 of 'testenv' (port 3002)
`kaleido node list` marks the currently active node with `●`:

```
Environments in ~/.kaleido/spawn:
Environments in ~/.kaleido:

testenv → ~/.kaleido/spawn/testenv
testenv → ~/.kaleido/testenv
● node 1: http://localhost:3001
○ node 2: http://localhost:3002
```
Expand Down Expand Up @@ -211,7 +219,7 @@ kaleido --json market pairs

| Command | Description |
|-------------------------------------------|-----------------------------------------------------|
| `kaleido setup` | Guided first-run setup for market-only or local use |
| `kaleido setup [network]` | Create/start one node, mutinynet by default |
| `kaleido node create [name]` | Wizard: configure and generate a named environment |
| `kaleido node list` | List all environments with node URLs |
| `kaleido node use <name> [--node N]` | Set node-url to node N in an environment |
Expand All @@ -224,9 +232,8 @@ kaleido --json market pairs
| `kaleido node init` | Initialise node wallet (once after first start) |
| `kaleido node unlock` | Unlock wallet (after every restart) |
| `kaleido node lock` | Lock the wallet |
| `kaleido node info` | Show detailed node + network info |
| `kaleido node taker pubkey` | Show the node's taker public key |
| `kaleido node taker whitelist <swap>` | Whitelist a swap on the taker side |
| `kaleido node info` | Show node info from `/nodeinfo` |
| `kaleido node network` | Show network info from `/networkinfo` |

### `wallet` — BTC wallet

Expand Down Expand Up @@ -287,7 +294,7 @@ kaleido market quote BTC/USDT --from-amount 100000 --from-layer BTC_LN --to-laye

- `kaleido swap order ...` for maker swap-order flows on the Kaleidoswap server
- `kaleido swap atomic ...` for atomic swaps against the Kaleidoswap maker server
- `kaleido swap node ...` for low-level local RLN node swap flows
- `kaleido node swap ...` for low-level local RLN node swap flows

| Command | Description |
|-------------------------------------|----------------------------------------------------------|
Expand All @@ -299,11 +306,12 @@ kaleido market quote BTC/USDT --from-amount 100000 --from-layer BTC_LN --to-laye
| `kaleido swap atomic init <pair>` | Initialize an atomic swap against the maker server |
| `kaleido swap atomic execute` | Execute an atomic swap against the maker server |
| `kaleido swap atomic status <hash>` | Check atomic swap status against the maker server |
| `kaleido swap node init` | Initialize a low-level local node swap |
| `kaleido swap node whitelist` | Whitelist a swap on the local taker node |
| `kaleido swap node execute` | Execute a low-level local node swap |
| `kaleido swap node status <hash>` | Check local node swap status by payment hash |
| `kaleido swap node list` | List swaps known to the local RLN node |
| `kaleido node swap pubkey` | Show the local node's taker public key |
| `kaleido node swap init` | Initialize a low-level local node swap |
| `kaleido node swap whitelist` | Whitelist a swap on the local taker node |
| `kaleido node swap execute` | Execute a low-level local node swap |
| `kaleido node swap status <hash>` | Check local node swap status by payment hash |
| `kaleido node swap list` | List swaps known to the local RLN node |

### `config` — CLI configuration

Expand All @@ -322,17 +330,17 @@ kaleido market quote BTC/USDT --from-amount 100000 --from-layer BTC_LN --to-laye
# 1. Install
curl -fsSL https://raw.githubusercontent.com/kaleidoswap/kaleido-cli/master/install.sh | sh

# 2. Run the guided setup
# 2. Create/start one mutinynet node
kaleido setup

# 3. If you chose a local node, initialise and unlock the wallet
# 3. Initialise and unlock the wallet
kaleido node init
kaleido node unlock

# 4. If you chose a local node, confirm it is healthy
# 4. Confirm the node is healthy
kaleido node info

# 5. If you chose a local node, get a funding address
# 5. Get a funding address
kaleido wallet address

# 6. Browse available trading pairs
Expand All @@ -342,10 +350,10 @@ kaleido market pairs
kaleido market quote BTC/USDT --from-amount 100000
```

For a non-interactive local setup with defaults:
For a non-interactive local setup with mutinynet defaults:

```bash
kaleido setup --mode local --create-node --defaults
kaleido setup
```

### Working with multiple nodes
Expand Down
47 changes: 28 additions & 19 deletions kaleido_cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import typer

from .config import load_config
from .config import DEFAULT_API_URL, DEFAULT_NETWORK, load_config
from .context import state
from .onboarding import SetupMode, run_setup
from .output import set_agent_mode, set_json_mode
Expand All @@ -20,7 +20,8 @@
help=(
"Manage RGB Lightning Nodes and interact with the Kaleidoswap protocol.\n\n"
"[bold]First time here?[/bold]\n\n"
" [cyan]kaleido setup[/cyan] Guided setup for market-only or local-node use\n\n"
" [cyan]kaleido setup[/cyan] Create/start one mutinynet node with defaults\n"
" [cyan]kaleido setup signetcustom[/cyan] Create/start a node on a specific network\n\n"
"[bold]Global flags[/bold] can be placed before any sub-command:\n\n"
" [cyan]kaleido --node-url http://localhost:3001 wallet balance[/cyan]\n"
" [cyan]kaleido --json market pairs[/cyan]\n"
Expand Down Expand Up @@ -77,15 +78,23 @@ def _root(
"setup",
epilog=(
"[bold]Examples[/bold]\n\n"
" Interactive first-run setup:\n"
" Create and start one mutinynet node with defaults:\n"
" [cyan]kaleido setup[/cyan]\n\n"
" Create and start one node on an explicit network:\n"
" [cyan]kaleido setup signetcustom[/cyan]\n\n"
" Market-only defaults without prompts:\n"
" [cyan]kaleido setup --mode market --defaults[/cyan]\n\n"
" Create and start a local node environment with defaults:\n"
" [cyan]kaleido setup --mode local --create-node --defaults[/cyan]"
" Use a custom environment name:\n"
" [cyan]kaleido setup mutinynet --env-name taker-1[/cyan]"
),
)
def setup_command(
network: Annotated[
str | None,
typer.Argument(
help="Bitcoin network for the local node. Defaults to mutinynet.",
),
] = None,
mode: Annotated[
SetupMode | None,
typer.Option("--mode", help="Setup profile: 'market' or 'local'."),
Expand All @@ -101,10 +110,6 @@ def setup_command(
str | None,
typer.Option("--api-url", help="Kaleidoswap API URL to save in config."),
] = None,
network: Annotated[
str | None,
typer.Option("--network", help="Bitcoin network to save in config."),
] = None,
node_url: Annotated[
str | None,
typer.Option("--node-url", help="RGB Lightning Node URL to save in config."),
Expand Down Expand Up @@ -133,14 +138,20 @@ def setup_command(
typer.Option("--start/--no-start", help="Start the node environment after creating it."),
] = None,
) -> None:
"""Guide first-time configuration and optionally create a local node environment."""
"""Create a local mutinynet node by default, or run the selected setup profile."""
resolved_mode = mode or SetupMode.local
resolved_defaults = defaults or mode is None
resolved_create_node = create_node
if mode is None and resolved_create_node is None:
resolved_create_node = True

run_setup(
mode=mode,
defaults=defaults,
api_url=api_url,
network=network,
mode=resolved_mode,
defaults=resolved_defaults,
api_url=api_url or (DEFAULT_API_URL if resolved_mode == SetupMode.local else None),
network=network or (DEFAULT_NETWORK if resolved_mode == SetupMode.local else None),
node_url=node_url,
create_node=create_node,
create_node=resolved_create_node,
spawn_dir=spawn_dir,
env_name=env_name,
node_count=node_count,
Expand All @@ -162,9 +173,7 @@ def setup_command(
from .commands.swap import swap_app # noqa: E402
from .commands.wallet import wallet_app # noqa: E402

app.add_typer(
node_app, name="node", help="Manage the RLN node via Docker (start, stop, spawn, init…)."
)
app.add_typer(node_app, name="node", help="Manage the RLN node via Docker (start, stop, init…).")
app.add_typer(
wallet_app, name="wallet", help="BTC wallet — balance, addresses, send, UTXOs, backup, restore."
)
Expand All @@ -186,7 +195,7 @@ def setup_command(
app.add_typer(
swap_app,
name="swap",
help="Swap flows grouped by scope: maker order flow, maker atomic flow, and local node flow.",
help="Swap flows grouped by scope: maker order flow and maker atomic flow.",
)
app.add_typer(config_app, name="config", help="CLI configuration stored in ~/.kaleido/config.json.")

Expand Down
Loading
Loading