Launch Iroha 2
This tutorial explains how to launch an Iroha 2 network.
1. Prerequisites
To launch an instance of the Iroha 2 network, install the following first:
2. Launch Iroha Network
In your terminal, navigate to the root directory of your local
iroha
repository:bash$ cd ~/Git/iroha
Run the
docker compose
command with thedocker-compose.yml
network configuration file specified to deploy a network of four containerized peers:bash$ docker compose -f defaults/docker-compose.yml up
Depending on your setup, this command will either pull an image from Docker Hub or build the container locally.
Once the process completes, you will see an output similar to the following:
[+] Running 9/9 ✔ irohad2 Pulled 6.3s ✔ irohad0 Pulled 6.3s ✔ irohad3 Pulled 6.3s ✔ irohad1 Pulled 6.3s ✔ ec99f8b99825 Already exists 0.0s ✔ d3a0e7f5d646 Pull complete 1.4s ✔ 1b1d5514cbbf Pull complete 2.1s ✔ 86e58c28036c Pull complete 2.3s ✔ 0d3b3367a826 Pull complete 2.5s [+] Running 5/5 ✔ Network swarm_default Created 0.1s ✔ Container swarm-irohad3-1 Created 0.4s ✔ Container swarm-irohad0-1 Created 0.5s ✔ Container swarm-irohad1-1 Created 0.4s ✔ Container swarm-irohad2-1 Created 0.5s Attaching to irohad0-1, irohad1-1, irohad2-1, irohad3-1 irohad0-1 | 2024-07-15T05:51:39.204411Z INFO irohad: Hyperledgerいろは2にようこそ!(translation) Welcome to Hyperledger Iroha! version="2.0.0-pre-rc.21" git_commit_sha="185ef76" peer=ed0120A98BAFB0663CE08D75EBD506FEC38A84E576A7C9B0897693ED4B04FD9EF2D18D@@0.0.0.0:1337 chain=00000000-0000-0000-0000-000000000000 listening_on=0.0.0.0:8080 irohad0-1 | 2024-07-15T05:51:39.204729Z INFO init:start{listen_addr=WithOrigin { value: 0.0.0.0:1337, origin: Env { id: ParameterId(network.address), var: "P2P_ADDRESS" } } idle_timeout=60s}: iroha_p2p::network: Network bound to listener irohad0-1 | 2024-07-15T05:51:39.209730Z INFO init:kura_init: iroha_core::kura: Kura init complete mode=Strict block_count=0 irohad0-1 | 2024-07-15T05:51:39.210006Z INFO init: irohad: Didn't find a state snapshot; creating an empty state irohad0-1 | 2024-07-15T05:51:39.214759Z INFO init: irohad: Telemetry not started due to absent configuration irohad0-1 | 2024-07-15T05:51:39.215234Z INFO iroha_core::sumeragi: Sumeragi has finished loading blocks and setting up the state ... irohad2-1 | 2024-07-15T05:51:39.332824Z INFO consensus: iroha_core::sumeragi::main_loop: Listening for genesis... peer_id=ed01204EE2FCD53E1730AF142D1E23951198678295047F9314B4006B0CB61850B1DB10@@0.0.0.0:1339 role=Leader irohad0-1 | 2024-07-15T05:51:40.478714Z INFO consensus: iroha_core::sumeragi::main_loop: Block committed peer_id=ed0120A98BAFB0663CE08D75EBD506FEC38A84E576A7C9B0897693ED4B04FD9EF2D18D@@0.0.0.0:1337 prev_role=ProxyTail next_role=ValidatingPeer block_hash=a638001762e365280677a5407bac9adaa119c8cb82c8afe377b72f85e71ed4a9 new_height=1 irohad0-1 | 2024-07-15T05:51:40.478761Z INFO consensus: iroha_core::sumeragi::main_loop: Sumeragi initialized peer_id=ed0120A98BAFB0663CE08D75EBD506FEC38A84E576A7C9B0897693ED4B04FD9EF2D18D@@0.0.0.0:1337 role=ValidatingPeer irohad2-1 | 2024-07-15T05:51:42.085522Z INFO consensus: iroha_core::sumeragi::main_loop: Block committed peer_id=ed01204EE2FCD53E1730AF142D1E23951198678295047F9314B4006B0CB61850B1DB10@@0.0.0.0:1339 prev_role=Leader next_role=ProxyTail block_hash=a638001762e365280677a5407bac9adaa119c8cb82c8afe377b72f85e71ed4a9 new_height=1 irohad2-1 | 2024-07-15T05:51:42.085585Z INFO consensus: iroha_core::sumeragi::main_loop: Sumeragi initialized peer_id=ed01204EE2FCD53E1730AF142D1E23951198678295047F9314B4006B0CB61850B1DB10@@0.0.0.0:1339 role=ProxyTail irohad1-1 | 2024-07-15T05:51:42.109788Z INFO consensus: iroha_core::sumeragi::main_loop: Block committed peer_id=ed01209897952D14BDFAEA780087C38FF3EB800CB20B882748FC95A575ADB9CD2CB21D@@0.0.0.0:1338 prev_role=ValidatingPeer next_role=Leader block_hash=a638001762e365280677a5407bac9adaa119c8cb82c8afe377b72f85e71ed4a9 new_height=1 irohad1-1 | 2024-07-15T05:51:42.109858Z INFO consensus: iroha_core::sumeragi::main_loop: Sumeragi initialized peer_id=ed01209897952D14BDFAEA780087C38FF3EB800CB20B882748FC95A575ADB9CD2CB21D@@0.0.0.0:1338 role=Leader irohad3-1 | 2024-07-15T05:51:42.117040Z INFO consensus: iroha_core::sumeragi::main_loop: Block committed peer_id=ed0120CACF3A84B8DC8710CE9D6B968EE95EC7EE4C93C85858F026F3B4417F569592CE@@0.0.0.0:1340 prev_role=ObservingPeer next_role=ObservingPeer block_hash=a638001762e365280677a5407bac9adaa119c8cb82c8afe377b72f85e71ed4a9 new_height=1 irohad3-1 | 2024-07-15T05:51:42.117083Z INFO consensus: iroha_core::sumeragi::main_loop: Sumeragi initialized peer_id=ed0120CACF3A84B8DC8710CE9D6B968EE95EC7EE4C93C85858F026F3B4417F569592CE@@0.0.0.0:1340 role=ObservingPeer irohad0-1 | 2024-07-15T05:52:39.238596Z INFO iroha_core::snapshot: Successfully created a snapshot of state at_height=1 irohad1-1 | 2024-07-15T05:52:39.266902Z INFO iroha_core::snapshot: Successfully created a snapshot of state at_height=1 irohad3-1 | 2024-07-15T05:52:39.276634Z INFO iroha_core::snapshot: Successfully created a snapshot of state at_height=1 irohad2-1 | 2024-07-15T05:52:39.349409Z INFO iroha_core::snapshot: Successfully created a snapshot of state at_height=1
After deploying the network, you can interact with it using the Iroha Client CLI.
TIP
You can monitor blockchain events in the terminal where the network runs.
Docker Options
The following options are also available for local compilation:
- To test Iroha code quickly, use the
docker-compose-single.yml
network configuration file, which starts a container with a single peer. - To test Iroha code in normal conditions, use the
docker-compose-local.yml
network configuration file, which starts four connected containers with peers.
Note
There is ongoing work to make our configurations for Docker even more customizable with the help of Swarm.