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
323 changes: 169 additions & 154 deletions Cargo.lock

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions docs/explorer.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Explorer
sidebar:
order: 4
---

The explorer is a terminal-based UI where you can interact with your wallets and blockchain data in real-time.

## Usage

```bash
cshell explorer
```

## Features

The explorer provides the following features:

### Accounts Tab

Displays a list of your wallets and their balances.

### Blocks Tab

Shows a real-time stream of new blocks as they are added to the blockchain.

### Transactions Tab

Displays a list of recent transactions. And it is possible to fetch older transactions typing the tx hash.

## Keybindings

- `q`: Quit the explorer
- `Tab`: Switch between tabs
- `?`: Show the help popup
60 changes: 60 additions & 0 deletions docs/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: Quickstart
sidebar:
order: 0
---

import { Steps, Tabs, TabItem, Cards, Card } from "@astrojs/starlight/components"

In this guide we're going to learn how to go from zero to a running Cshell instance with the least amount of effort.

<Steps>
1. ### Installation

<Tabs>
<TabItem label="mac">
You can use Homebrew to install the latest version of Cshell in Mac (both x86 / ARM64)

```sh
brew install txpipe/tap/cshell
```
</TabItem>
<TabItem label="linux">
You can install Cshell on linux system using the following command:

```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/txpipe/cshell/releases/latest/download/cshell-installer.sh | sh
```
</TabItem>
<TabItem label="npm">
You can use Npm to install Cshell on your system:

```sh
npm install @txpipe/cshell
```
</TabItem>
</Tabs>

2. ### Configuration

_Cshell_ requires a UtxoRPC and TRP provider, the UtxoRPC is to fetch on-chain data, and the TRP is to resolve and submit transactions. You can get one free instance on [demeter](https://demeter.run/). So when you have the UtxoRPC and TRP url, run the following command that will guide you through a set of questions to define a provider:

```sh
cshell provider create
```

With the provider configured, it is possible to create a wallet or import one. The following example shows how to create one.

```sh
cshell wallet create
```

3. ### Running

Explore the commands in the docs or run `cshell --help`. The following command opens a GUI explorer using the default provider.

```sh
cshell explorer
```

</Steps>
42 changes: 42 additions & 0 deletions docs/provider.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Provider
sidebar:
order: 1
---

import { Aside } from '@astrojs/starlight/components';

Cshell uses [**UtxoRPC**](https://utxorpc.org) as its on-chain data provider. It connects to a UtxoRPC server to collect blockchain data and follow the tip. Any service that implements the UtxoRPC interface can act as a data provider for Cshell, for example, [**Dolos**](https://github.com/txpipe/dolos).

UtxoRPC is used only for supplying on-chain data. For transaction resolution and submission, Cshell uses a TRP (Transaction Resolution Protocol) server. TRP, used with [**Tx3**](https://github.com/tx3-lang/tx3), exposes a JSON-RPC interface to resolve and submit transactions. Any application that implements that JSON-RPC interface can serve as Cshell's TRP provider, for example [**Hydra TRP**](https://github.com/tx3-lang/tx3-hydra).

<Aside type="tip">
Use [**Demeter**](https://demeter.run/) to get a free tier UtxoRPC and TRP instance.
</Aside>

### Provider storage
All cshell provider configurations are stored in a single file on your local machine:

- File: **cshell.toml**
- Location: In your user home directory (examples: **~/cshell.toml**)

This file contains the definitions for every provider you create.

## Usage
When providers are available, create and configure a provider in Cshell using the **interactive** command below:

```bash
cshell provider create
```

You can manage providers using Cshell's provider commands. To see which provider commands are available, run the following:

```bash
cshell provider --help
```

And the `--help` flag can be used anywhere in Cshell. For example, after choosing the create command, you can check the options available for that command as well:

```bash
cshell provider create --help
```
52 changes: 52 additions & 0 deletions docs/usage.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Usage
sidebar:
order: 3
---

import { Aside } from '@astrojs/starlight/components';

With Cshell fully configured ([provider](/cshell/provider) and [wallet](/cshell/wallet)), it's time to start using it to manage transactions or fetch on-chain data.

You can execute any transaction in Cshell using [**tx3**](https://docs.txpipe.io/tx3). Cshell will call the TRP to resolve and submit the transaction.

<Aside type="tip">
Use `--help` to view the CLI options.
</Aside>

<Aside type="note">
The `--help` flag can be used anywhere in Cshell
</Aside>

## Commands
The commands below are used to handle transactions and fetch on-chain data.

### Transactions
You can manage transactions by using Cshell's `tx` or `transactions` commands. To see which tx commands are available, run the following:

```bash
cshell tx --help
```

Use the `--help` flag with any command to view its available options.

```bash
cshell tx invoke --help
```

### Search
You can search by block or transactions using the commands search. To see which search commands are available, run the following

<Aside type="note">
Use the `--output-format` flag to change the output format, it supports `json`, `table`. Default is `table`.
</Aside>

```bash
cshell search --help
```

Use the `--help` flag with any command to view its available options.

```bash
cshell search block --help
```
63 changes: 63 additions & 0 deletions docs/wallet.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: Wallet
sidebar:
order: 2
---

import { Aside } from '@astrojs/starlight/components';

How cshell handles wallet creation, storage, and security. Understanding these concepts is crucial for managing your funds safely.

### Wallet storage
All cshell wallet configurations are stored in a single file on your local machine:

- File: **cshell.toml**
- Location: In your user home directory (examples: **~/cshell.toml**)

This file contains the definitions for every wallet you create, import, or restore.

### Security and encryption
Cshell protects private keys using a password-based encryption model.

- When you create a wallet you set a spending password.
- The password is run through Argon2 to derive an encryption key, and that key is used with the `ChaCha20-Poly1305` cipher to encrypt the wallet’s private key.
- **Your password is never stored on disk**, it exists only in memory when needed to sign a transaction.

<Aside type="caution">
Because the password is never stored, it cannot be recovered. If you lose it you must restore the wallet from its mnemonic seed phrase
</Aside>

### Unsafe wallets (plain-text keys)
Cshell supports an `--unsafe` option at creation time (wallet create --unsafe).

- What it does: disables password protection and stores the private key in plain text inside cshell.toml.
- Intended use: temporary, disposable wallets for development or testing only.

<Aside type="caution">
Never store real funds in an unsafe wallet. Anyone with access to cshell.toml can control those funds
</Aside>

### Importing vs restoring wallets
Cshell supports both wallet import and wallet restore, these are different operations with different functional implications.

- Import: creating read-only (watch-only) wallets.
- Restore: recovering fully functional wallets using the mnemonic seed phrase.

## Usage
Create a wallet using the **interactive** command below:

```bash
cshell wallet create
```

You can manage wallets using Cshell's wallet commands. To see which wallet commands are available, run the following:

```bash
cshell wallet --help
```

And the `--help` flag can be used anywhere in Cshell. For example, after choosing the create command, you can check the options available for that command as well:

```bash
cshell wallet create --help
```
2 changes: 1 addition & 1 deletion src/explorer/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl EventTask {
self.check_balances().await?;
}
TipEvent::Reset(point) => {
self.send(Event::App(AppEvent::Reset(point.index)))?;
self.send(Event::App(AppEvent::Reset(point.slot)))?;
self.check_balances().await?;
}
}
Expand Down
15 changes: 6 additions & 9 deletions src/explorer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl App {
events: EventHandler::new(context.clone()),
accounts_tab_state: AccountsTabState::default(),
blocks_tab_state: BlocksTabState::default(),
transactions_tab_state: TransactionsTabState::default(),
transactions_tab_state: TransactionsTabState::new(Arc::clone(&context)),
}
}

Expand Down Expand Up @@ -173,7 +173,7 @@ impl App {
_ => self.accounts_tab_state.handle_key(&key),
},
SelectedTab::Blocks(_) => self.blocks_tab_state.handle_key(&key),
SelectedTab::Transactions(_) => self.transactions_tab_state.handle_key(&key),
SelectedTab::Transactions(_) => self.transactions_tab_state.handle_key(&key).await,
}
}
}
Expand All @@ -197,13 +197,10 @@ impl App {
.update_scroll_state(self.chain.blocks.borrow().len());

self.transactions_tab_state
.update_scroll_state(self.chain.blocks.borrow().iter().map(|b| b.tx_count).sum());
.update_blocks(Rc::clone(&self.chain.blocks));

self.selected_tab = match &self.selected_tab {
SelectedTab::Blocks(_) => SelectedTab::Blocks(BlocksTab::from(&*self)),
SelectedTab::Transactions(_) => {
SelectedTab::Transactions(TransactionsTab::from(&*self))
}
x => x.clone(),
}
}
Expand All @@ -223,7 +220,7 @@ impl App {
.update_scroll_state(self.chain.blocks.borrow().len());

self.transactions_tab_state
.update_scroll_state(self.chain.blocks.borrow().iter().map(|b| b.tx_count).sum());
.update_blocks(Rc::clone(&self.chain.blocks));

self.selected_tab = match &self.selected_tab {
SelectedTab::Blocks(_) => SelectedTab::Blocks(BlocksTab::from(&*self)),
Expand All @@ -233,7 +230,7 @@ impl App {

fn select_previous_tab(&mut self) {
self.selected_tab = match &self.selected_tab {
SelectedTab::Accounts(_) => SelectedTab::Transactions(TransactionsTab::from(&*self)),
SelectedTab::Accounts(_) => SelectedTab::Transactions(TransactionsTab {}),
SelectedTab::Blocks(_) => SelectedTab::Accounts(AccountsTab::new(self.context.clone())),
SelectedTab::Transactions(_) => SelectedTab::Blocks(BlocksTab::from(&*self)),
}
Expand All @@ -242,7 +239,7 @@ impl App {
fn select_next_tab(&mut self) {
self.selected_tab = match &self.selected_tab {
SelectedTab::Accounts(_) => SelectedTab::Blocks(BlocksTab::from(&*self)),
SelectedTab::Blocks(_) => SelectedTab::Transactions(TransactionsTab::from(&*self)),
SelectedTab::Blocks(_) => SelectedTab::Transactions(TransactionsTab {}),
SelectedTab::Transactions(_) => {
SelectedTab::Accounts(AccountsTab::new(self.context.clone()))
}
Expand Down
Loading