How to config BTFS node

Please follow and like us:

BTFS Node Configuration

In the file explorer window, navigate to your .btfs folder. This is the directory in which you set your BTFS Path. There should be a config file, which governs the configuration settings for your BTFS node. Open this config file in your preferred text editor. The following is an explanation of the configuration parameters.


The two parameters are PeerID and PrivKey. PeerID refers to the Identity information of your node, while PrivKey is the node’s base64-encoded protobuf describing the node’s private key. This is immutable.


The Datastore config option configures the on-disk storage system. StorageMax refers to the soft upper limit on size of your BTFS repository’s datastore. StorageGCWatermark refers to the percentage of StorageMax value at which garbage collection is automatically triggered if the BTFS node was run with automatic garbage collection enabled (default is false). GCPeriodrefers to the time duration specifying frequency of running garbage collection.


The three address types are SwarmAPI, and Gateway. Swarm addresses are what the node uses to listen for connections from other BTFS peers. These addresses should be accessible from outside machines (i.e. no firewalls blocking). API addresses are the local IP addresses in which you can send API commands to the BTFS node. These addresses should not be accessible via outside machines. The Gateway address is the address in which users can make HTTP requests into the BTFS network.


MDNS refers to multicast DNS peer discovery, which is useful for enabling peer discovery on the local network. Routing type dht refers to distributed hash tables. If you change Type value to dhtclient, it makes your node not a DHT node (which means it doesn’t serve requests to the BTFS network) and helps to reduce memory, CPU usage, and bandwidth usage.


This config array specified a list of BTFS peers your node will connect to on startup.


Assuming gateway address is opened in the Addresses config, this config manages the gateway options. By default, the HTTP only supports the GET method, which allows users to fetch data via the hash, but if Writeable flag is enabled, then users can also use POST, PUT, and DELETE methods. This allows clients to add data to the BTFS network. Enable this by setting Gateway.Writeable to true.


Under the connection manager configurator (Swarm.ConnMgr), there are the four parameters of TypeLowWaterHighWater, and GracePeriod. This is where you can manage the number of peer connections to your node. LowWater refers to the minimum number of peer connections to try and maintain. HighWater refers to the connection threshold that, when exceeeded, triggers a garbage cleanup (drop connections). GracePeriodrefers to the time duration that new connections are immune from being closed by the connection manager.


This config has the two parameters of Interval and StrategyIntervalcontrols the time between rounds of re-providing local content to the routing system. For example, if you set Interval to “0”, it will disable content reproviding, which results in other nodes on the network not being able to discover the objects in your file repository.

Strategy can take values of “all”, “pinned”, or “roots”. "all" announces all stored data, "pinned" announces only pinned data, and "roots" announces directly pinned keys and root keys of recursive pins.

Modifications Walkthrough

In the Routing config, adjust Typeto dhtclient. This helps to reduce DHT traffic, which in turn should help reduce bandwidth usage.

Launch bfs node and swarm settings
BTFS get command and WebUI access
BTFS add command and swarm peers
Enable BTFS gateway
Start BTFS daemon and path environment setting
YAML data settings: maximun storage
Please follow and like us:

Leave a Reply