The irohad crate contains the Iroha server (peer) 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.
Pass the --language <code> flag to override automatic language detection for informational and error messages.
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 --releaseThe 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-telemetryA 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-featuresThis 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 -- cryptoExpand 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 --jsonNOTE: 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.
-
Build the binaries.
cargo build --release -p irohad cargo build --release -p iroha_kagami
-
Stage a runtime directory. Copy the release binary and the closest configuration template (the Sora Nexus profile ships under
defaults/nexus/):mkdir -p deploy/peer cp target/release/irohad deploy/peer/ cp defaults/nexus/config.toml deploy/peer/config.toml cp defaults/nexus/genesis.json deploy/peer/genesis.json
Adjust the file layout if you prefer another location.
irohadresolves relative paths from the directory that containsconfig.toml. -
Provision keys and network settings.
-
Generate a validator key pair with Kagami and capture it in JSON so the public/private pair can be pasted into the config and genesis manifests:
cargo run --release -p iroha_kagami -- \ crypto --json --algorithm ed25519 \ --seed "$(uuidgen)" > deploy/peer/validator_keys.json
-
Update
config.tomlwith the newchain,public_key, andprivate_keyvalues, plus thetrusted_peersyou expect in your initial topology. Ensure each peer advertises a uniquenetwork.address/Torii port pair.
-
-
Generate and sign the genesis block.
-
Produce a template genesis manifest and tweak it as needed (additional accounts, assets, instructions, etc.):
cargo run --release -p iroha_kagami -- \ genesis generate default \ --genesis-public-key <PEER_PUBLIC_KEY> \ > deploy/peer/genesis.json
-
Sign the manifest to obtain the Norito block (
.nrt) that the daemon expects:cargo run --release -p iroha_kagami -- \ genesis sign deploy/peer/genesis.json \ --public-key <PEER_PUBLIC_KEY> \ --private-key <PEER_PRIVATE_KEY> \ --out-file deploy/peer/genesis.signed.nrt
Then edit
config.tomlso that the[genesis]section references the signed block:[genesis] file = "genesis.signed.nrt" public_key = "<PEER_PUBLIC_KEY>"
See
crates/iroha_kagami/CommandLineHelp.mdanddocs/genesis*.mdfor additional subcommands such asvalidateandembed-pop.
-
-
Start an Iroha peer. Point the daemon at your staged configuration (add
--sorawhen using the Nexus profile fromdefaults/nexus/):cd deploy/peer ./irohad --config ./config.toml # or, for the Nexus demo profile: ./irohad --sora --config ./config.toml
Repeat the configuration/key/genesis steps for every peer. Remember that to tolerate f Byzantine faults the network must contain at least 3f + 1 peers with mutually listed
trusted_peersentries.
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. Update TRUSTED_PEERS and provide matching TRUSTED_PEERS_POP entries (PoPs for every validator key, including the local one).
-
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