You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Sometimes You want to just build Iroha 1 on debian-based Linux. In official documentation there are instructions, but many new people are having problems with them. That is why I decided to put all commands with some modifications to fast build & run Iroha 1.
Those instructions are how to build Iroha inside docker instance of Ubuntu 22:04:

1. Running docker instance:

In terminal paste You can paste the code (of course first read description below the code where I explain arguments):

docker run \
    -it \
    --workdir /home \
    --name='ubuntu_test' \
    ubuntu:22.04

Where:

  • -it  - to run image with interactive console (input && output)
  • --workdir /home  - is to set current directory in the docker instance
  • --name='ubuntu_test'  - instance name
  • ubuntu:22.04  - image from docker-hub "ubuntu" version "22.04"

After some time You should be inside docker instance.

2. Building Iroha 1 inside the docker instance of Ubuntu 22:04:

# update package manage cache:
apt-get update

# install dependencies to build iroha (more than in official documentation are required):
apt-get -y --no-install-recommends install \
    build-essential ninja-build \
    git ca-certificates tar curl unzip cmake \
    pkg-config zip python3 python-is-python3 autoconf

# now we can clone iroha 1 from official repository (I need only last commit of branch with tag 1.5.0)
git clone https://github.com/hyperledger/iroha.git --depth=1 -b 1.5.0

cd iroha

# build all dependencies for Iroha 1:
./vcpkg/build_iroha_deps.sh $PWD/vcpkg-build

# prepare configuration to build iroha 1 with ninja, not necessarily options are disabled (smart contracts, tests):
cmake -B build -DCMAKE_TOOLCHAIN_FILE=$PWD/vcpkg-build/scripts/buildsystems/vcpkg.cmake . -DCMAKE_BUILD_TYPE=RELEASE   -GNinja -DUSE_BURROW=OFF -DUSE_URSA=OFF -DTESTING=OFF -DPACKAGE_DEB=OFF

# building program which works like blockchain node with ninja-build:
cmake --build ./build --target irohad

# you can check if the program was sucessfully build (the command needs more arguments to work):
./build/bin/irohad

3. Sample run of iroha node:


In the official Iroha repository You have sample configuration files, You can use them to run a node (here is: documentation of command line arguments). I suggest to read description below before running the command:


 irohad \
    --config /home/config/config.docker \
    --keypair_name /home/keys/node0 \
    -genesis_block /home/config/genesis.block \
    -reuse_state
    #-overwrite_ledger -drop_state

Where:

  • --config  - path to config file, in the config postgres is choosen, so it must be running
  • --keypair_name  - path to private and public keys of a the node
  • -genesis_block  - path to genesis block (first block of network)
  • -reuse_state  - not create network from beginning but use existing
  • -overwrite_ledger -drop_state  - DANGEROUS - it will erase the network (both database and files)

To run irohad  with configuration as above You need first to have working postgres DB. I suggest to use docker instance. To create instance with user&&password compatible with sample config you need command (it needs to be run in host):


docker run --name postgres_tmp \
    -e POSTGRES_USER=postgres \
    -e POSTGRES_PASSWORD=mysecretpassword \
    --network=host \
    -d postgres \
    -c 'max_prepared_transactions=100' \
    -c 'port=5432'

  • No labels