BTFS2.0 Storage Rental
Stoage the upload process
If a BTFS node is created locally, then file uploading can be done via command line. It includes several steps such as configuring, adding files, uploading files to the network, etc., as follows.
- configuring the current node for the renter role.
- topping up to the vault address.
- uploading files to the local BTFS node.
- uploading files in the local node to the BTFS network, returning the sessionID.
- check the current status by sessionID.
1. Renter settings:
Enter the following command for the storage-client setup.
//Client Configuration
$ btfs config profile apply storage-client
//View Configuration
$ btfs config show
...
// Under "Experimental", the StorageClientEnabled setting is set to true
"StorageClientEnabled": true,
...
//Synchronize host node to local node
$ btfs storage hosts sync
//Check host status
$ btfs storage hosts info | jq
2. Top up to the vault address
In the node startup log, find the vault address as follows.
self vault: 0x47813456f0951493347010a4f27aafbdcca61025
You can top up to the vault address through your own wallet, before you can upload the file.
Top-up with WBTT.
How to get WBTT?
Open the metaMask wallet, switch to the BTTC test network(Related parameters reference address https://doc.bt.io/v1/doc/#network-details), click on the SEND button, three points need to be noted.
1 - You need to fill in the contract address of WBTT, 0x107742EB846b86CEaAF7528D5C85cddcad3e409A.
2 - Amount: you need to fill in how much BTT you want to convert, BTT and WBTT is a 1:1 exchange relationship
3 - Gas Fee (gwei), need to be changed to 300000.
3.BTFS Adding Files
Add a file with the btfs add file
command.
$ btfs add <file-name>
// Output
added QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCmnb <file-name>
163 B / 163 B [=======================================================] 100.00%
4.BTFS Upload files to BTFS network
A Direct upload method, default copy=0
$ btfs storage upload <file-hash>
B Add parameters to set multiple copies
$ btfs storage upload <file-hash> --copy=num
Storage parameter options:
Option | Description | Flag |
---|---|---|
Leaf Hash | Flag to specify given hash(es) is leaf hash(es). Default: False | [--leaf-hash | -l] |
Host Select Mode | Based on mode to select the host and upload automatically. | [--host-select-mode= | -m] |
Host Selection | Use only these selected hosts in order on 'custom' mode. Use ',' as a delimiter. | [--host-selection= | -s] |
Host Search Local | Enable host search under all domains 0.0.0.0 (useful for local test). Default: True | [--host-search-local=false] |
Storage Length | The length in Days to store the file. Default: 30 days | [--storage-length= | --len] |
Copy Num | Set num copy to upload. If set --copy=1, will be 1(origin) + 1(copy) =2 to upload. | [--copy=num] |
Uploading to the BTFS network, for example.
// Store the upload file hash and set the time to 35 days
$ btfs storage upload QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCf7b --storage-length=35
{"ID":"15f635e0-3171-445f-b089-95c04ecb3d83"}
5. Example of viewing upload status.
// You can follow the jq tool to help view the json result output
$ btfs storage upload <session-id> status | jq '.Status'
6. Other
Downloading files stored in BTFS
$ btfs get <file-hash>
Deleting files stored in BTFS
$ btfs rm <file-hash>
Updated almost 3 years ago