Skip to content

Build Instructions

Harshit Mehndiratta edited this page Nov 6, 2023 · 18 revisions

Build zbox on Linux and Mac

System requirements

To properly build components, you must have a machine with the following requirements:

  • Linux (Ubuntu Preferred) Version: 20.04 and Above
  • Mac(Apple Silicon or Intel) Version: Big Sur and Above
  • 4 vCPU, 4 GB memory at Minimum
  • 2 GB of space minimum for zbox build components and storage allocation.

Prerequisites

Note: zbox binaries are designed to function optimally with gcc 11 as the default compiler. Notably, Ubuntu 22 is equipped with gcc 11 by default. However, Ubuntu 20 initially comes with gcc 9. To upgrade the gcc version, execute the following commands:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install build-essential
sudo apt install gcc-11 g++-11

Go

Go for Mac and Linux can be downloaded from here. After downloading a binary release suitable for your operating system, please follow the installation instructions.

Git (Not Required for Mac)

Git is required to retrieve and clone the zbox repository. Install Git by using the command below:

sudo apt install git

Building Zbox

  1. Clone the Zbox Repository using the command
git clone https://github.com/0chain/zboxcli.git
  1. Navigate into zboxcli directory using
cd zboxcli
  1. Use the make install command to compile the source code.
make install
  1. Start the Zbox by navigating back to the zboxcli directory using
cd zboxcli

and type

./zbox

When you execute the ./zbox command in the terminal without any arguments, it will display a comprehensive list of all available commands along with the global flags.

Usage:
  zbox [command]

Available Commands:
  add                Adds free storage assigner
  alloc-cancel       Cancel an allocation
  alloc-fini         Finalize an expired allocation
  bl-info            Get blobber info
  bl-update          Update blobber settings by its delegate_wallet owner
  collect-reward     Collect accrued rewards for a stake pool.
  completion         Generate the autocompletion script for the specified shell
  copy               copy an object(file/folder) to another folder on blobbers
  cp-info            Challenge pool information.
  createdir          Create directory
  decrypt            Decrypt text with passphrase
  delete             delete file from blobbers
  download           download file from blobbers
  feed               download segment files from remote live feed, and upload
  get-diff           Get difference of local and allocation root
  get-download-cost  Get downloading cost
  get-mpt            Directly view blockchain data
  get-upload-cost    Get uploading cost
  getallocation      Gets the allocation info
  getwallet          Get wallet information
  help               Help about any command
  kill-blobber       punitively deactivate a blobber
  kill-validator     punitively deactivate a validator
  list               list files from blobbers
  list-all           list all files from blobbers
  listallocations    List allocations for the client
  ls-blobbers        Show active blobbers in storage SC.
  ls-validators      Show active Validators.
  meta               get meta data of files from blobbers
  move               move an object(file/folder) to another folder on blobbers
  newallocation      Creates a new allocation
  recent-refs        get list of recently added refs
  rename             rename an object(file/folder) on blobbers
  rollback           rollback file to previous version
  rp-create          Create read pool if missing
  rp-info            Read pool information.
  rp-lock            Lock some tokens in read pool.
  rp-unlock          Unlock some expired tokens in a read pool.
  sc-config          Show storage SC configuration.
  share              share files from blobbers
  shutdown-blobber   deactivate a blobber
  shutdown-validator deactivate a validator
  sign-data          Sign given data
  sp-info            Stake pool information.
  sp-lock            Lock tokens lacking in stake pool.
  sp-unlock          Unlock tokens in stake pool.
  sp-user-info       Stake pool information for a user.
  start-repair       start repair file to blobbers
  stats              stats for file from blobbers
  stream             capture video and audio streaming form local devices, and upload
  sync               Sync files to/from blobbers
  transferallocation Transfer an allocation from one account to another
  update             update file to blobbers
  updateallocation   Updates allocation's expiry and size
  upload             upload file to blobbers
  validator-info     Get validator info
  validator-update   Update validator settings by its delegate_wallet owner
  version            Prints version information
  wp-lock            Lock some tokens in write pool.
  wp-unlock          Unlock some expired tokens in a write pool.

Flags:
      --config string              config file (default is config.yaml)
      --configDir string           configuration directory (default is $HOME/.zcn)
      --fee float                  transaction fee for the given transaction (if unset, it will be set to blockchain min fee)
  -h, --help                       help for zbox
      --network string             network file to overwrite the network details (if required, default is network.yaml)
      --silent                     Do not show interactive sdk logs (shown by default)
      --wallet string              wallet file (default is wallet.json)
      --wallet_client_id string    wallet client_id
      --wallet_client_key string   wallet client_key
      --withNonce int              nonce that will be used in transaction (default is 0)