Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Binaries guide #480

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
143 changes: 143 additions & 0 deletions src/guide/get-started/binaries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Working with Iroha Binaries

When working with Iroha, certain components (e.g., `iroha_client_cli`) are delivered as binary files that can be built and installed as standalone tools locally, and also come prepackaged with Iroha 2.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When working with Iroha, certain components (e.g., `iroha_client_cli`) are delivered as binary files that can be built and installed as standalone tools locally, and also come prepackaged with Iroha 2.
When working with Iroha, certain components (e.g., `iroha`) are delivered as binary files that can be built and installed as standalone tools locally, and also come prepackaged with Iroha 2.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is a bit confusing. It should just say that working with Iroha involves using several binaries, and this is how.


::: info

For details on the differences between the versions of Iroha 2, see [Get Started > Install Iroha 2: Choose Version](guide/get-started/install.md#choose-version).

:::

Iroha 2 provides the following binary executables:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

irohad and kagami are mandatory for running Iroha peers, and together with iroha (one of the ways of interacting with Iroha peers) they are bundled in the Docker image.

There are also the tool binaries: iroha_swarm, kura_inspector, iroha_wasm_builder, iroha_wasm_test_runner, parity_scale_cli. They are not part of the Docker image, and are not required.


- [`iroha`](https://github.com/hyperledger/iroha/tree/iroha2-dev/cli) — the main Iroha CLI that is used to start a peer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [`iroha`](https://github.com/hyperledger/iroha/tree/iroha2-dev/cli) — the main Iroha CLI that is used to start a peer.
- [`irohad`](https://github.com/hyperledger/iroha/tree/main/cli) — the main Iroha CLI that is used to start a peer.

- [`iroha_client_cli`](https://github.com/hyperledger/iroha/tree/iroha2-dev/client_cli) — Iroha Client CLI that is used to interact with an Iroha peer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [`iroha_client_cli`](https://github.com/hyperledger/iroha/tree/iroha2-dev/client_cli) — Iroha Client CLI that is used to interact with an Iroha peer.
- [`iroha`](https://github.com/hyperledger/iroha/tree/main/client_cli) — Iroha Client CLI that is used to interact with an Iroha peer.

- [`kagami`](https://github.com/hyperledger/iroha/tree/iroha2-dev/tools/kagami) — a tool that is used to generate and validate various types of data (e.g., cryptographic keys, genesis blocks, default client and peer configuration files).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- [`kagami`](https://github.com/hyperledger/iroha/tree/iroha2-dev/tools/kagami) — a tool that is used to generate and validate various types of data (e.g., cryptographic keys, genesis blocks, default client and peer configuration files).
- [`kagami`](https://github.com/hyperledger/iroha/tree/main/tools/kagami) — a tool that is used to generate and validate various types of data (e.g., cryptographic keys, genesis blocks, default client and peer configuration files).

> See also:
> - [Generating Cryptographic Keys](guide/security/generating-cryptographic-keys.md) — instructions on how to generate cryptographic keys with `kagami`.
> - [Configure Iroha > Genesis Block: Generation](guide/configure/genesis.md#generation) — instructions on how to generate a default genesis block with `kagami`.
> - [Configure Iroha > Peer Configuration: Generation](guide/configure/peer-configuration.md#generation) — instructions on how to generate a default peer configuration file with `kagami`.
> - [Configure Iroha > Client Configuration: Generation](guide/configure/client-configuration.md#generation) — instructions on how to generate a default client configuration file with `kagami`.

There are two main ways to work with Iroha 2 binaries:

1. [Using the pre-built Docker images](#docker-install).
2. [Using the source GitHub repository](#source):
- [Installing from source GitHub repository](#source-install).
- [Running from cloned GitHub repository](#source-run).

## Using the Pre-Built Docker Images {#docker-install}

First, install the following Docker prerequisites:

- [Docker](https://docs.docker.com/get-docker/)

To install a binary from a pre-built Docker image, execute one of the following commands:

::: code-group

```shell [`iroha`]
docker run -t hyperledger/iroha2:dev
```
Comment on lines +39 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```shell [`iroha`]
docker run -t hyperledger/iroha2:dev
```
```shell [`irohad`]
docker run -t hyperledger/iroha:dev


```shell [`iroha_client_cli`]
docker run -t hyperledger/iroha2:client-cli-dev
```
Comment on lines +43 to +45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```shell [`iroha_client_cli`]
docker run -t hyperledger/iroha2:client-cli-dev
```
```shell [`iroha`]
docker run -t hyperledger/iroha:dev iroha


```shell [`kagami`]
docker run -t hyperledger/iroha2:kagami-dev
```
Comment on lines +47 to +49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```shell [`kagami`]
docker run -t hyperledger/iroha2:kagami-dev
```
```shell [`kagami`]
docker run -t hyperledger/iroha:dev kagami


## Using the Source GitHub Repository {#source}

To perform any of the actions using the GitHub repository (i.e., [building & installing](#source-install), or [running](#source-run) binaries), the [Rust toolchain](https://www.rust-lang.org/) must first be installed. The toolchain is delivered with the package manager—[Cargo](https://doc.rust-lang.org/cargo/index.html)—that allows for installation of Rust crates from different sources, including GitHub.

The recommended way to install the Rust toolchain is through the Rust installer and version management tool—[Rustup](https://rust-lang.github.io/rustup/) (See also: [Install Rust](https://www.rust-lang.org/tools/install))—by executing the following command in your terminal:

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
Comment on lines +53 to +59
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the cargo documentation is too much. It's enough to redirect users to Rust's get started guide: https://www.rust-lang.org/learn/get-started.


::: info

Depending on the operating system that you are using or other limitations, you may want to opt for a different installation method.

For all available installation methods, see the [Rust Forge: Other Rust Installation Methods](https://forge.rust-lang.org/infra/other-installation-methods.html) article.

In case you experience any issues with Rust installation, see our [Troubleshooting Rust Toolchain](/guide/troubleshooting/installation-issues#troubleshooting-rust-toolchain) topic.

:::

### Installing from Source GitHub Repository {#source-install}

To perform a system-wide installation of an Iroha 2 binary with `cargo install`, execute one of the following commands in your terminal:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To perform a system-wide installation of an Iroha 2 binary with `cargo install`, execute one of the following commands in your terminal:
Iroha binaries may be installed system-wide using `cargo install`:


::: code-group

```shell [Command structure]
cargo install [options] --git [repo url] --branch [branch name] [binary name]
```

```shell [`Iroha`]
cargo install --git https://github.com/hyperledger/iroha.git --branch iroha2-dev iroha

iroha --help
Comment on lines +82 to +84
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cargo install --git https://github.com/hyperledger/iroha.git --branch iroha2-dev iroha
iroha --help
cargo install --git https://github.com/hyperledger/iroha.git irohad
irohad --help

```

```shell [`Iroha Client CLI`]
cargo install --git https://github.com/hyperledger/iroha.git --branch iroha2-dev iroha_client_cli

iroha_client_cli --help
Comment on lines +88 to +90
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cargo install --git https://github.com/hyperledger/iroha.git --branch iroha2-dev iroha_client_cli
iroha_client_cli --help
cargo install --git https://github.com/hyperledger/iroha.git iroha
iroha --help

```

```shell [`Kagami`]
cargo install --git https://github.com/hyperledger/iroha.git --branch iroha2-dev kagami

kagami --help
Comment on lines +94 to +96
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cargo install --git https://github.com/hyperledger/iroha.git --branch iroha2-dev kagami
kagami --help
cargo install --git https://github.com/hyperledger/iroha.git kagami
kagami --help

```

:::

::: tip

For more details on `cargo install` and its `[options]`, see [The Cargo Book > cargo-install(1)](https://doc.rust-lang.org/cargo/commands/cargo-install.html).

:::

### Running from Cloned GitHub Repository {#source-run}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You may want to run the binaries without installing them system-wide. This will involve cloning Iroha's source code and using `cargo run`.

First, clone the [hyperledger/iroha](https://github.com/hyperledger/iroha.git) GitHub repository:

```shell
git clone https://github.com/hyperledger/iroha.git <clone-folder>
cd <clone-folder>
git checkout iroha2-dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
git checkout iroha2-dev

```

To run an Iroha 2 binary with `cargo install`, execute one of the following commands in your terminal:

::: code-group

```shell [Command structure]
cargo run [options] --bin [binary name] -- [arguments for the binary]
```

```shell [Iroha]
cargo run --release --bin iroha -- --help
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cargo run --release --bin iroha -- --help
cargo run --release --bin irohad -- --help

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment that --release will result in better performance due to the project being built in the optimized release mode.

```

```shell [Client CLI]
cargo run --release --bin iroha_client_cli -- --help
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cargo run --release --bin iroha_client_cli -- --help
cargo run --release --bin iroha -- --help

```

```shell [Kagami]
cargo run --release --bin kagami -- --help
```

:::

::: tip

For more details on `cargo run` and its `[options]`, see [The Cargo Book > cargo-run(1)](https://doc.rust-lang.org/cargo/commands/cargo-run.html).

:::
Loading