Step 5 : Register a Wallet using zboxcli
This part assumes that your sharder, and miner containers are perfectly running. In this part, we will register a wallet using zwalletcli and then start the blobber using the wallet id.
1.Now clone the zbox CLI repository using the command
git clone https://github.com/0chain/zboxcli.git
2.Install the zboxcli dependencies
GoLang Binaries
Installation instructions for Go can be found here.
The build**-**essential package is required to build and make Zbox application. It includes the necessary GCC/g++ compilers and other essential critical libraries and utilities.
Run apt update command to update the packages.
sudo apt update
Get Build-essential package.
sudo apt-get install build-essential
Once dependencies are installed navigate into zboxcli directory using
cd zboxcli
3. Use the make install command to compile the source code.
make install
This might take couple of minutes. Sample output after successful compiling:
4.Now Connect the Zbox to the 0Chain network Configuration for the 0chain network by default is stored in network/one.yaml file which we will copy to a new config.yaml file.
The config.yaml file and all the other Zbox component information will be stored in a new zcn folder located in home directory of file system.
5. Make a new zcn folder in home linux directory using
mkdir $HOME/.zcn
.zcn is used to denote a hidden folder.
6. Copy the content from one.yaml to a new config.yaml file using
cp network/one.yaml $HOME/.zcn/config.yaml
To verify whether the config.yaml exist and network configuration is stored properly. From the home directory navigate to zcn folder . You will see config.yaml listed.
7. Check the config file configuration using
nano config.yaml
According to the config mentioned in block worker field of your file, zbox will connect to 8. https://one.devnet-0chain.net/.change it to for the local network.
8. Also create a network.yaml file in .zcn directory which specify the local miner and sharder ports.To check ports run the docker ps command. Here is a sample network.yaml file for 1 sharder and 3 miners.
- http://localhost:7071
- http://localhost:7072
- http://localhost:7073
- http://localhost:7171
9. Start the Zbox by navigating back to zboxcli directory using
cd zboxcli
and type
On a successful run you will see a help section like this:
zbox is a decentralized storage application written on the 0Chain platform.
Complete documentation is available at https://docs.0chain.net/0chain/
zbox [command]
Available Commands:
add-collab add collaborator for a file
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
commit commit a file changes to chain
copy copy an object(file/folder) to another folder on blobbers
cp-info Challenge pool information.
delete delete file from blobbers
delete-collab delete collaborator for a file
download download file from blobbers
get Gets the allocation info
get-diff Get difference of local and allocation root
get-download-cost Get downloading cost
get-upload-cost Get uploading cost
getwallet Get wallet information
help Help about any command
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.
meta get meta data of files from blobbers
move move an object(file/folder) to another folder on blobbers
newallocation Creates a new allocation
register Registers the wallet with the blockchain
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
sign-data Sign given data
sp-info Stake pool information.
sp-lock Lock tokens lacking in stake pool.
sp-pay-interests Pay interests not payed yet.
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
sync Sync files to/from blobbers
update update file to blobbers
update-attributes update object attributes on blobbers
updateallocation Updates allocation's expiry and size
upload upload file to blobbers
version Prints version information
wp-info Write pool information.
wp-lock Lock some tokens in write pool.
wp-unlock Unlock some expired tokens in a write pool.
--config string config file (default is config.yaml)
--configDir string configuration directory (default is $HOME/.zcn)
-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
Use "zbox [command] --help" for more information about a command.
9.To register a wallet on Zbox to be used both by the blockchain and blobbers. Use the following Zbox command
./zbox register
Successful Response:
Wallet Registered
By default, the wallet information will be stored in wallet.json located in the .zcn folder of the Linux home directory. 10.Navigate back to the .zcn folder
cd $HOME/.zcn/
11. Open the wallet.json file. It should be similar to the similar to the output below:
"mnemonics":"butter whisper wheat hope duck mention bird half wedding aim good regret maximum illegal much inch immune unlock resource congress drift>
12..Copy the client_id value and paste it into blobbers and validators settings. These are found in blobber/config directory. 13. Navigate to the config directory :
cd blobber/config
You will see blobber and validation files listed
14.Open both the configuration files and edit the delegate_wallet value with client_id copied from wallet. Here is a sample configuration file below:
# [configurations above]
# for testing
# 500 MB - 536870912
# 1 GB - 1073741824
# 2 GB - 2147483648
# 3 GB - 3221225472
capacity: 1073741824 # 1 GB bytes total blobber capacity
read_price: 0.01 # token / GB for reading
write_price: 1.00 # token / GB for writing
# min_lock_demand is value in [0; 1] range; it represents number of tokens the
# blobber earned even if a user will not read or write something
# to an allocation; the number of tokens will be calculated by the following
# formula
# allocation_size * write_price * min_lock_demand
min_lock_demand: 0.1
# max_offer_duration restrict long contacts where,
# in the future, prices can be changed
max_offer_duration: 744h # 31 day
challenge_completion_time: 1m # 15m # duration to complete a challenge
# delegate wallet for all rewards, if it's empty, then blobber ID used
delegate_wallet: 'b145bf241eab00c9865a3551b18028a6d12b3ef84df8b4a5c317c8d184a82412'
Copy link