BTFS2.0 Storage Rental
Storage 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.
//modify Configuration
$ vim config
...
// Under "Experimental", the StorageClientEnabled setting is set to true
"StorageClientEnabled": false,
...
//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 network(Related parameters reference address https://doc.bt.io/v1/doc/network.html#mainnet-chainid-0xc9-decimal-199), click on the SEND button, three points need to be noted.
1 - First you should ensure your wallet have enough BTT you want to convert WBTT.
2 - You need to fill in the contract address of WBTT,0x23181F21DEa5936e24163FFABa4Ea3B316B57f3C.
3 - Amount: you need to fill in how much WBTT you want to convert, BTT and WBTT is a 1:1 exchange relationship
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%
$ btfs add -r <dir-name>
// Output
added QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCmnb <dir-name/file-name>
added QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCmnb <dir-name/file-name>
......
added QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCmnb <dir-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
C Add parameters to set multiple tokens
$ btfs storage upload <file-hash> --token-type=WBTT
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] |
Token Type | Set token type to upload. such as WBTT/TRX/USDD/USDT. | [--token-type=WBTT] |
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
// get file
$ btfs get <file-hash>
// get dir(files)
$ btfs get <dir-hash>
Deleting files stored in BTFS
$ btfs rm <file-hash>
Updated 11 months ago