☁️
Züs
  • About Züs
  • Concepts
    • Architecture
      • Mining on the Züs Blockchain
        • Onboarding a New Miner or Sharder
        • Block Production Protocol
        • Block Finalization
        • Merkle Patricia Trees(MPT) and Recovery
        • View Change and Distributed Key Generation(DKG)
      • Payment
      • Storage
      • Token Bridge Protocol
      • Resources
    • Tokenomics
      • Staking Process
      • Block Rewards
      • Delegation
    • Store
    • Earn
    • Build
    • NFT
  • Resources
    • Whitepapers
      • Tokenomics Paper
      • Architecture Paper
      • Storage Paper
    • Patents
      • NON-FUNGIBLE TOKEN BLOCKCHAIN PROCESSING
      • FREE STORAGE PROTOCOL FOR BLOCKCHAIN PLATFORM
      • TRANSFERRING CONTENT VIA PROXY RE-ENCRYPTION
      • STREAMING CONTENT VIA BLOCKCHAIN TECHNOLOGY
      • SPLIT-KEY WALLET ACCESS BETWEEN BLOCKCHAINS
      • ENFORCING SECURITY PARAMETERS SPECIFIED BY AN OWNER ON A BLOCKCHAIN PLATFORM
      • CLIENT AUTHENTICATION USING SPLIT KEY SIGNING ON A BLOCKCHAIN PLATFORM
      • BLOCKCHAIN CONTENT PURCHASING PROTOCOL
      • BLOCKCHAIN BASED PRIVACY COMPLIANCE PLATFORM
      • SYSTEMS AND METHODS OF SELF-ADMINISTERED PROTOCOLS ON A BLOCKCHAIN PLATFORM
      • SYSTEMS AND METHODS OF AGGREGATE SIGNING OF DIGITAL SIGNATURES ON MULTIPLE MESSAGES SIMULTANEOUSLY U
      • SYSTEMS AND METHODS OF BLOCKCHAIN PLATFORM FOR AUTOMATED ASSET BASED PROVISIONING OF RESOURCES
      • SYSTEMS AND METHODS OF SELF-FORKING BLOCKCHAIN PROTOCOL
      • SYSTEMS AND METHODS OF SUSTAINABILITY PROTOCOL USING DISTRIBUTED BLOCKCHAIN APPLICATION WITH IoT SEN
      • SYSTEMS AND METHODS OF BLOCKCHAIN PLATFORM FOR DISTRIBUTED APPLICATIONS
  • API Reference
    • Endpoints
      • Block
      • Client
      • Connection
      • DNS
      • File
      • Smart Contracts
      • Blobber Stats
      • Transactions
      • Miners and Sharders
        • Stats
        • State
        • Diagnostics
        • Configuration
        • Smart Contract State
        • Smart Contract Stats
        • Chain Stats
  • Hackathon
    • Register to Hackathon
      • How to Add Members to Hackathon Team
    • Repos
    • Documentation
  • Products
    • Bolt
      • Get Started
      • Stake
      • Activity
      • Buy ZCN
      • Sell ZCN
      • Send Tokens
      • Receive Tokens
      • Settings
        • Manage Profile
        • Wallet
        • Read Pool
      • Troubleshooting
    • Vult
      • Sign Up
      • Upload File
      • Upload an Encrypted File
      • Upload a File to a Folder
      • Share a Uploaded File
      • Move a Uploaded File
      • Delete a File
      • Make File Available Offline
      • Troubleshooting
    • Atlus
      • Dashboard Overview
      • Service Providers
      • Charts
        • Market Charts
        • Network Charts
        • Storage Charts
        • Züs Explainer
      • Blockchain
      • Server Map
    • Blimp
      • Sign Up
        • Buy ZCN for Storage
      • Use Blimp as Direct Storage
      • Use Blimp as S3 Server
        • S3 Operations
      • Use Blimp for Cloud Migration
      • Manage Allocations
        • Extend Size
        • Extend Duration
        • Add Blobber
        • Replace Blobber
        • Make allocation Immutable
        • Freeze Allocation
        • Cancel Allocation
    • Chimney
      • Get Started
      • Deploy Blobber on Own Server
      • Deploy Blobber on Rented Server
      • Stake Blobber
      • Add Blobber
      • Monitor Blobbers
      • Visualize Blobber Logs
      • View Blobber Rank
    • Chalk
      • Sign Up
      • Create NFT Collection
        • Buy ZCN for NFT via ERC token
        • Buy ZCN for NFT via Credit card
      • Explore NFT Collections
      • My NFTs
      • Profile
        • Withdraw Earnings
        • Manage Collections
  • Guides
    • Zus GO SDK
    • Zus JS SDK
    • Zbox CLI
      • Repo
      • Get Started
      • Creating and Managing Allocations
      • Uploading and Managing Files
      • Lock and Unlock Tokens
      • Tips and Troubleshooting
    • Zwallet CLI
      • Repo
      • Get Started
      • Zwallet Operations
      • Staking on miners and sharders
      • Burn and Mint Tokens using Zwallet
      • Troubleshooting
    • Add a Blobber
      • Repo
      • Getting Started
    • Add a Miner/Sharder
      • Repo
      • Getting Started
    • Setup a Blockchain
      • Repo
      • Quickstart
        • Understand the Script
      • Step 1: Set up the project
      • Step 2: Setup the network for Züs components
      • Step 3: Initialize and Build the Züs components
      • Step 4: Start Sharder and Miner Containers
      • Step 5 : Create a wallet using zwalletcli
      • Step 6: Starting the blobber containers
      • Step 7: Validate Züs deployment
      • Step 8: Creating an Allocation on Blobber
      • Restarting Sharder and Miner Containers with CleanDB.
      • Additional Tips and Troubleshooting
    • Glossary
  • Support
    • Help Center
      • Community
      • Issues on Github
      • Contact Us
Powered by GitBook
On this page
  1. Guides
  2. Setup a Blockchain
  3. Quickstart

Understand the Script

  1. The script starts by displaying a menu to choose a deployment option (Local or Server) and reads the user's choice.

+ echo 'Choose deployment option:'
Choose deployment option:
+ echo '1. Local'
1. Local
+ echo '2. Server'
2. Server
+ read -p 'Enter your choice (1/2): ' choice
Enter your choice (1/2): 
  1. The script creates a directory named "zus-repos" and navigates into it.

mkdir zus-repos
+ cd zus-repos
  1. The script declares an associative array named "arr" to store deployment commands.

 declare -A arr
  1. The script then populates the "arr" array with various Docker commands for pulling, tagging, and removing images for different services. These services include "sharder," "miner," "blobber," and "validator," and they are tagged with the "staging" version.

+ arr[0,0]='pull 0chaindev/sharder:staging'
+ arr[0,1]='tag 0chaindev/sharder:staging sharder'
+ arr[0,2]='image rm 0chaindev/sharder:staging'
+ arr[1,0]='pull 0chaindev/miner:staging'
+ arr[1,1]='tag 0chaindev/miner:staging miner'
+ arr[1,2]='image rm pull 0chaindev/miner:staging'
+ arr[2,0]='pull 0chaindev/blobber:staging'
+ arr[2,1]='tag 0chaindev/blobber:staging blobber'
+ arr[2,2]='image rm 0chaindev/blobber:staging'
+ arr[3,1]='pull 0chaindev/validator:staging'
+ arr[3,2]='tag 0chaindev/validator:staging validator'
+ arr[3,3]='image rm 0chaindev/validator:staging'
  1. The script then enters two nested loops with counters "i" and "j" to iterate through the "arr" array. These loops seem to be set up to execute the Docker commands stored in the array. Inside the loops, the script executes "docker pull" commands to pull Docker images for the specified services from the Docker Hub. After each "docker pull" command, it increments the "i" counter to move to the next command in the array and checks if it has completed all the commands for the current service.

+ docker pull 0chaindev/sharder:staging
staging: Pulling from 0chaindev/sharder
9621f1afde84: Pull complete
a2b0fab95789: Pull complete
77b50bae27c3: Pull complete


+ docker pull 0chaindev/miner:staging
staging: Pulling from 0chaindev/miner
951e1e941ca: Pull complete
3f67f767ac07: Pull complete
Digest: sha256:0d70ef0f24dd8bccd58e9553f30014aa5a259e92b5ba10ca2310b53a21ae4534
Status: Downloaded newer image for 0chaindev/miner:staging
docker.io/0chaindev/miner:staging

+ docker pull 0chaindev/blobber:staging
staging: Pulling from 0chaindev/blobber
96526aa774ef: Pull complete
97574bc8a632: Pull complete
92333ca1ae6e38728cf1ee53004bbebc36545c67be533b051Status: Downloaded newer image for 0chaindev/blobber:staging
docker.io/0chaindev/blobber:staging

What's Next?
  View a summary of image vulnerabilities.
+ (( i++ ))
+ (( i<=3 ))
+ docker
  1. Inside the loop, the script uses git clone to clone Git repositories specified in the repo array. It creates local copies of these repositories in the current working directory.

['1']='https://github.com/0chain/blobber.git' 
['2']='https://github.com/0chain/0dns.git')
+ git clone https://github.com/0chain/0chain.git
Cloning into '0chain'...
Cloning into 'blobber
+ git clone https://github.com/0chain/0dns.git
Cloning into '0dns'...
  1. The script changes the current working directory to a directory named 0dns.

if [ 1 == 1 ]: This appears to be a conditional statement, but it always evaluates to true since it compares the integer 1 with itself.

CONFIG_FILE=docker.local/config/0dns.yaml: A variable CONFIG_FILE is assigned a file path.

sed -i 's/use_https.*/use_https: false/' docker.local/config/0dns.yaml: This line uses the sed command to perform an in-place (in the file) search and replace operation in the 0dns.yaml file. It replaces a line containing "use_https" with "use_https: false."

sed -i 's/use_path.*/use_path: false/' docker.local/config/0dns.yaml: Similar to the previous line, this one replaces a line containing "use_path" with "use_path: false" in the same file.

+ cd 0dns
+ '[' 1 == 1 ']'
+ CONFIG_FILE=docker.local/config/0dns.yaml
+ sed -i 's/use_https.*/use_https: false/' docker.local/config/0dns.yaml
+ sed -i 's/use_path.*/use_path: false/' docker.local/config/0dns.yaml
  1. The script then build the 0dns container.

echo ' docker build'
docker.local/bin/build.sh 
docker.local/bin  
+ cd ../0chain
docker:default+ docker.local/bin/setup.network.sh
ecacd3253b4bd7810fbe2444ce569c2f003bf21b1fc689964e6bd72096b8f105
+ cd ../0dns
+ docker.local/bin/start.sh                                                                              0.0s
+ cd ../0chain
+ docker.local/bin/init.setup.sh
  1. The script then automates the installation and setup of various tools and processes. Let's break it down step by step: echo 'Mocks Installation and Creation Phase': This line simply prints the text "Mocks Installation and Creation Phase" to the standard output.

  • echo '': This line prints an empty line, likely for formatting purposes.

  • curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh: This line uses the curl command to download a script and install Homebrew, a package manager for macOS and Linux.

  • /bin/bash -c ...: This line executes the downloaded script using the Bash shell. The script appears to install Homebrew and provides information about the installation, including its success and some additional details about Homebrew.

  • /home/linuxbrew/.linuxbrew/bin/brew shellenv: This line seems to run the brew shellenv command, which is likely setting up the environment for Homebrew.

  • brew doctor: This command checks the system's configuration and environment to ensure that it is ready to use Homebrew.

  • echo 'Install Mockery In Progress': This line prints the text "Install Mockery In Progress."

  • brew install mockery: This command uses Homebrew to install a tool or package called "mockery."

  • echo 'Install Mockery In Completed': This line prints the text "Install Mockery In Completed."

  • echo 'Build-Mocks in progress': This line prints the text "Build-Mocks in progress."

  • make build-mocks: This command likely invokes a make target called "build-mocks" to build something, presumably related to mock objects or mock data.

  • echo 'Build-Mocks completed': This line prints the text "Build-Mocks completed."

+ echo ' Mocks Installtion and Creation Phase'
 Mocks Installtion and Creation Phase
+ echo ''
++ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
+ /bin/bash -c '#!/bin/bash
==> Downloading and installing Homebrew...
HEAD is now at 4e2c9adc2 Merge pull request #16131 from Homebrew/sponsors-maintainers-man-completions
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Next steps:
- Install Homebrew's dependencies if you have sudo access:
    sudo apt-get install build-essential
  For more information, see:
    https://docs.brew.sh/Homebrew-on-Linux
- We recommend that you install GCC:
    brew install gcc
- Run brew help to get started
- Further documentation:
    https://docs.brew.sh

++ /home/linuxbrew/.linuxbrew/bin/brew shellenv
+ eval ''
+ brew doctor
Your system is ready to brew.
+ echo 'Install Mockery In Progress'
Install Mockery In Progress
+ brew install mockery
+ echo 'Install Mockery In Completed'
Install Mockery In Completed
+ echo 'Build-Mocks in progress'
Build-Mocks in progress
+ make build-mocks
+ echo ' Build-Mocks completed'
 Build-Mocks completed
PreviousQuickstartNextStep 1: Set up the project

Last updated 1 year ago

The script then changes the current working directory to 0chain and executes various Docker-related scripts like 0dns script. and These scripts are used for setting up and initializing a network related to the project.

start.sh
setup.network.sh
init.setup.sh.