The irohad
crate contains the Iroha server binary. The binary is used to instantiate a peer and bootstrap an Iroha-based network. The capabilities of the network are determined by the feature flags used to compile the binary.
Requirements: a working Rust toolchain (version 1.62.1), installed and configured.
Optionally, Docker can be used to build images containing any of the provided binaries. Using Docker buildx is recommended, but not required.
Build the Iroha peer binary as well as every other supporting binary:
cargo build --release
The results of the compilation can be found in <IROHA REPO ROOT>/target/release/
, where <IROHA REPO ROOT>
is the path to where you cloned this repository (without the angle brackets).
To add optional features, use --features
. For example, to add the support for dev telemetry, run:
cargo build --release --features dev-telemetry
A full list of features can be found in the cargo manifest file for this crate.
By default, the Iroha binary is compiled with the telemetry
, and schema-endpoint
features. If you wish to remove those features, add --no-default-features
to the command.
cargo build --release --no-default-features
This flag can be combined with the --features
flag in order to precisely specify the feature set that you wish.
To run the Iroha peer binary, you must generate the keys and provide a configuration file.
We highly recommend you to generate a new key pair for any non-testing deployment. We also recommend using the Ed25519
algorithm. For convenience, you can use the provided kagami
tool to generate key pairs. For example,
cargo run --bin kagami -- crypto
Expand to see the output
Public key (multihash): "ed0120BDF918243253B1E731FA096194C8928DA37C4D3226F97EEBD18CF5523D758D6C"
Private key (ed25519): "0311152FAD9308482F51CA2832FDFAB18E1C74F36C6ADB198E3EF0213FE42FD8BDF918243253B1E731FA096194C8928DA37C4D3226F97EEBD18CF5523D758D6C"
To see the command-line options for kagami
, you must first terminate the arguments passed to cargo
. For example, run the kagami
binary with JSON formatting:
cargo run --bin kagami -- crypto --json
NOTE: The kagami
binary can be run without cargo
using the <IROHA REPO ROOT>/target/release/kagami
binary.
Refer to generating key pairs with kagami
for more details.
Note: this section is under development. You can track it in the issue.
You may deploy Iroha as a native binary or by using Docker.
-
Prepare a deployment environment.
If you plan on running the
irohad
binary from the directorydeploy
, copyconfig.json
andgenesis.json
:# FIXME # cp ./target/release/irohad # cp ./defaults/peer/config.json deploy # cp ./defaults/peer/genesis.json deploy
-
Make the necessary edits to
config.json
andgenesis.json
, such as:- Generate new key pairs and add their values to
genesis.json
) - Adjust the port values for your initial set of trusted peers
- Change the number of trusted peers to fit your initial network topology
NOTE: the number of peers needed for tolerating f byzantine faults is 3f+1.
- Generate new key pairs and add their values to
-
Start an Iroha peer.
cd deploy ./irohad
We provide a sample configuration for Docker in docker-compose.yml
. We highly recommend that you adjust the config.json
to include a set of new key pairs.
Generate the keys and put them into services.*.environment
in docker-compose.yml
. Don't forget to update the public keys of TRUSTED_PEERS
.
-
Build images:
docker-compose build
-
Run containers:
docker-compose up
To keep containers up and running after closing the terminal, use the
-d
(detached) flag:docker-compose up -d
-
Stop containers:
docker-compose stop
-
Remove containers:
docker-compose down