BTFS

The BTFS Developer Hub

Welcome to the BTFS developer hub. You'll find comprehensive guides and documentation to help you start working with BTFS as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Storage Rental

Guide on CLI commands for renting storage on the BTFS network

Renter

Please refer to Deposit BTT to BTFS guide here: https://docs.btfs.io/docs/deposit-btt-to-btfs#section-get-private-key-in-hex-format

Setup

Users who have set up a BTFS node can immediately begin renting storage on the BTFS network via the command line functions. The storage process is comprised of the following steps:

  1. Apply the BTFS renter config settings.
  2. Upload the file to your local go-btfs node.
  3. Upload the file hash onto the BTFS storage network.
  4. Query your upload status.

Renter Config Settings

Enable BTFS renter settings by running the following command:

btfs config profile apply storage-client

Check your updated config settings:

btfs config show

// Under "Experimental", the StorageClientEnabled setting is set to true

"StorageClientEnabled": true,

Sync BTFS hosts and view the hosts info:

btfs storage hosts sync
btfs storage hosts info | jq

BTFS Add

Add your desired file by running btfs add. This command encodes the file with Reed-Solomon encoding and uploads it to your local node.

btfs add --chunker=reed-solomon <file-name>

// Sample Output
added QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCf7b <file-name>
 242 B / 242 B [=======================================================] 100.00%

Option

Description

Flag

Reed Solomon Chunker

File is encoded with Reed-Solomon encoding, then uploaded to your local BTFS daemon.

--chunker=reed-solomon

BTFS Storage Upload

Upload the file onto the BTFS storage network.

btfs storage upload <file-hash>

Storage Options

Option

Description

Flag

Leaf Hash

Flag to specify given hash(es) is leaf hash(es). Default: False

[--leaf-hash | -l]

Price

The price in JUST (10^-6 BTT) for storage.

[--price= | -p]

Replication Factor

Replication factor for the file with erasure coding built-in. Default: 3

[--replication-factor= | -r]

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.

[--storage-length= | --len]

Usage Examples

// Store a file to BTFS with storage length of 35 days and price of 0.75 BTT/GB/day

btfs storage upload QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCf7b --storage-length=35 --price=750000

// Sample Output
{"ID":"15f635e0-3171-445f-b089-95c04ecb3d83"}

Use the outputted Session ID from btfs storage upload to check the storage upload status.

btfs storage upload <session-id> status | jq '.Status'

// Install the "jq" utility to parse the JSON output in the terminal

Retrieve File from BTFS

btfs get <file-hash>

Remove File from BTFS (Locally)

btfs rm <file-hash>
// Remove stored file on host before contract expires

btfs rm --force <file-hash>

Updated 5 months ago

Storage Rental


Guide on CLI commands for renting storage on the BTFS network

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.