0Chain
Search…
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
1
git clone https://github.com/0chain/zboxcli.git
Copied!
2.Install the zboxcli dependencies
GoLang Binaries
Installation instructions for Go can be found here.
Build-Essential
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.
1
sudo apt update
Copied!
Get Build-essential package.
1
sudo apt-get install build-essential
Copied!
Once dependencies are installed navigate into zboxcli directory using
1
cd zboxcli
Copied!
3. Use the make install command to compile the source code.
1
make install
Copied!
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
1
mkdir $HOME/.zcn
Copied!
.zcn is used to denote a hidden folder.
6. Copy the content from one.yaml to a new config.yaml file using
1
cp network/one.yaml $HOME/.zcn/config.yaml
Copied!
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
1
nano config.yaml
Copied!
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 http://198.18.0.98:9091 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.
1
miners:
2
- http://localhost:7071
3
- http://localhost:7072
4
- http://localhost:7073
5
sharders:
6
- http://localhost:7171
Copied!
9. Start the Zbox by navigating back to zboxcli directory using
1
cd zboxcli
Copied!
and type
1
./zbox
Copied!
On a successful run you will see a help section like this:
1
zbox is a decentralized storage application written on the 0Chain platform.
2
Complete documentation is available at https://docs.0chain.net/0chain/
3
4
Usage:
5
zbox [command]
6
7
Available Commands:
8
add-collab add collaborator for a file
9
alloc-cancel Cancel an allocation
10
alloc-fini Finalize an expired allocation
11
bl-info Get blobber info
12
bl-update Update blobber settings by its delegate_wallet owner
13
commit commit a file changes to chain
14
copy copy an object(file/folder) to another folder on blobbers
15
cp-info Challenge pool information.
16
delete delete file from blobbers
17
delete-collab delete collaborator for a file
18
download download file from blobbers
19
get Gets the allocation info
20
get-diff Get difference of local and allocation root
21
get-download-cost Get downloading cost
22
get-upload-cost Get uploading cost
23
getwallet Get wallet information
24
help Help about any command
25
list list files from blobbers
26
list-all list all files from blobbers
27
listallocations List allocations for the client
28
ls-blobbers Show active blobbers in storage SC.
29
meta get meta data of files from blobbers
30
move move an object(file/folder) to another folder on blobbers
31
newallocation Creates a new allocation
32
register Registers the wallet with the blockchain
33
rename rename an object(file/folder) on blobbers
34
rp-create Create read pool if missing
35
rp-info Read pool information.
36
rp-lock Lock some tokens in read pool.
37
rp-unlock Unlock some expired tokens in a read pool.
38
sc-config Show storage SC configuration.
39
share share files from blobbers
40
sign-data Sign given data
41
sp-info Stake pool information.
42
sp-lock Lock tokens lacking in stake pool.
43
sp-pay-interests Pay interests not payed yet.
44
sp-unlock Unlock tokens in stake pool.
45
sp-user-info Stake pool information for a user.
46
start-repair start repair file to blobbers
47
stats stats for file from blobbers
48
sync Sync files to/from blobbers
49
update update file to blobbers
50
update-attributes update object attributes on blobbers
51
updateallocation Updates allocation's expiry and size
52
upload upload file to blobbers
53
version Prints version information
54
wp-info Write pool information.
55
wp-lock Lock some tokens in write pool.
56
wp-unlock Unlock some expired tokens in a write pool.
57
58
Flags:
59
--config string config file (default is config.yaml)
60
--configDir string configuration directory (default is $HOME/.zcn)
61
-h, --help help for zbox
62
--network string network file to overwrite the network details (if required, default is network.yaml)
63
--silent Do not show interactive sdk logs (shown by default)
64
--wallet string wallet file (default is wallet.json)
65
--wallet_client_id string wallet client_id
66
--wallet_client_key string wallet client_key
67
68
Use "zbox [command] --help" for more information about a command.
Copied!
9.To register a wallet on Zbox to be used both by the blockchain and blobbers. Use the following Zbox command
1
./zbox register
Copied!
Successful Response:
1
Wallet Registered
Copied!
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
1
cd $HOME/.zcn/
Copied!
11. Open the wallet.json file. It should be similar to the similar to the output below:
1
{"client_id":"4af719e1fdb6244159f17922382f162387bae3708250cab6bc1c20cd85fb594c",
2
"client_key":"da1769bd0203b9c84dc19846ed94155b58d1ffeb3bbe35d38db5bf2fddf5a91c91b22bc7c89dd87e1f1fecbb17ef0db93517dd3886a64274997ea46824d2c119",
3
"keys":[{"public_key":"da1769bd0203b9c84dc19846ed94155b58d1ffeb3bbe35d38db5bf2fddf5a91c91b22bc7c89dd87e1f1fecbb17ef0db93517dd3886a64274997ea46824d2c1>
4
"private_key":"542f6be49108f52203ce75222601397aad32e554451371581ba0eca56b093d19"}],
5
"mnemonics":"butter whisper wheat hope duck mention bird half wedding aim good regret maximum illegal much inch immune unlock resource congress drift>
6
"version":"1.0","date_created":"2021-09-09T20:22:56+05:30"}
Copied!
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 :
1
cd blobber/config
Copied!
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:
1
# [configurations above]
2
3
# for testing
4
# 500 MB - 536870912
5
# 1 GB - 1073741824
6
# 2 GB - 2147483648
7
# 3 GB - 3221225472
8
capacity: 1073741824 # 1 GB bytes total blobber capacity
9
read_price: 0.01 # token / GB for reading
10
write_price: 1.00 # token / GB for writing
11
# min_lock_demand is value in [0; 1] range; it represents number of tokens the
12
# blobber earned even if a user will not read or write something
13
# to an allocation; the number of tokens will be calculated by the following
14
# formula
15
#
16
# allocation_size * write_price * min_lock_demand
17
#
18
min_lock_demand: 0.1
19
# max_offer_duration restrict long contacts where,
20
# in the future, prices can be changed
21
max_offer_duration: 744h # 31 day
22
challenge_completion_time: 1m # 15m # duration to complete a challenge
23
24
# delegate wallet for all rewards, if it's empty, then blobber ID used
25
delegate_wallet: 'b145bf241eab00c9865a3551b18028a6d12b3ef84df8b4a5c317c8d184a82412'
Copied!
Copy link