Step 3: Initialize and Build the Züs components

Initialize the Sharder and Miner directories

  1. Navigate to 0chain directory

cd 0chain

2. Run the init.setup.sh script located in the docker.local/bin directory using the command

./docker.local/bin/init.setup.sh

After running the script you will see the sharder and miner directories populated in docker.local folder.

3. Lets verify whether the directories exist by navigating to docker.local folder and running

ls docker.local/

The output should be similar to this:

Makefile    build.benchmarks  build.sc_unit_test     build.unit_test  miner2  miner6    sharder2
benchmarks  build.genkeys     build.sharder          config           miner3  miner7    sharder3
bin         build.magicBlock  build.swagger          docker-clean     miner4  miner8    sharder4
build.base  build.miner       build.test.multisigsc  miner1           miner5  sharder1  sql_script

Build the miner and sharder containers

1. Navigate to 0chain directory

cd 0chain

2. First build the base containers using the script.(This may take few minutes)

./docker.local/bin/build.base.sh

Screenshot after successful build:

  1. Build mocks from the Makefile in the repo, from 0chain directory run:

 make build-mocks 

Note: Mocks have to be built once in the beginning. Building mocks require mockery and brew which can be installed from here .

  1. For building the sharder containers use the following command :

./docker.local/bin/build.sharders.sh

Screenshot of successful sharder build:

  1. Build the miner containers using

./docker.local/bin/build.miners.sh

Screenshot of a successful miner build:

Initialize the blobber directories

  1. Navigate to blobber directory

cd blobber

2. Inside blobber directory, run the commands below .The first command makes the shell script executable and while the next ones execute the shell script to create blobber directories.

chmod +x ./docker.local/bin/blobber.init.setup.sh
./docker.local/bin/blobber.init.setup.sh

NOTE: For Mac :

chmod +x ./docker.local/bin/blobber.init.setup-mac.sh
./docker.local/bin/blobber.init.setup-mac.sh

After running the script you will see the blobber directories populated in docker.local folder

3. Let's verify whether the directories exist by navigating to docker.local folder and running

ls docker.local/

The output should be like this:

   b0docker-compose.yml  blobber4            Dockerfile
   bin                   blobber5            IntegrationTestsBlobberDockerfile
   blobber1              blobber6            keys_config
   blobber2              docker-clean        p0docker-compose.yml
   blobber3              docker-compose.yml  ValidatorDockerfilecd blobber/config
  1. Navigate to the config directory using

cd blobber/config

Use the nano editor to edit the block_worker field for both files :

nano 0chain_blobber.yaml

and

nano 0chain_validator.yaml

Note : Change the default value of block_worker field with the following: http://198.18.0.98:9091/ for the local chain.

Build the blobber containers

  1. Go back to blobber directory

cd blobber

2. Now run the following scripts located in the docker.local/bin directory.

./docker.local/bin/build.base.sh
./docker.local/bin/build.blobber.sh
./docker.local/bin/build.validator.sh

Screenshot after a successful blobber build:

Note: The blobber scripts defined above works fine for Linux and Intel Mac .If you want to run blobber and validator on Apple Silicon Mac(M1 or M2) follow the guide here. In case you are still facing issues with blobbers on M1 or M2 mac check Troubleshooting Guide for Blobbers Setup (Mac M1 or M2).

Last updated