Before you start, make sure the following is installed on your machine:
Golang (1.21+)
Make (the make command)
Clone the repo
You need to clone the zboxcli repo:
git clone https://github.com/0chain/zboxcli.git
This will clone the repo on your local machine in zboxcli in your working directory.
Install dependencies
Move to the zboxcli directory and run the install command
cd zboxcli
make install
This installs the dependencies for the zboxcli tool and then builds the tool binary.
Run the binary
Now the binary is in your zboxcli directory, you can run it like this:
❯ ./zbox
zbox is a decentralized storage application written on the 0Chain platform.
Complete documentation is available at https://docs.zus.network/guides/zbox-cli
Usage:
zbox [command]
Available Commands:
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-download-cost Get downloading cost
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
rename rename an object(file/folder) on blobbers
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
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 (default false) 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)
Use "zbox [command] --help" for more information about a command.
This output means the tool is installed successfully. It also shows the help text for the tools with the available commands and the global flags (flags applied with any command).
To show the help of any command, run the following:
./zbox <command> --help
macOS (M1 and newer) Users
If you are using an Apple Silicon (M1 or newer) Mac, you need to sign the application with the following command:
codesign --force --deep --sign - zbox
Otherwise, the application will be terminated by the shell.
Running some basic commands
Let's try two of the simplest commands in zboxcli:
1. Listing blobbers command ls-blobbers
This command lists the information of all the blobbers: