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    

Developer SDK


BTFS is currently compatible with the same JavaScript and Go SDK libraries as IPFS. This guide walks users through a simple example of integrating the BTFS network and TRON smart contracts via the SDK.


Suppose your web-based DApp's main HTML page references the backend JS file:

<script type="text/javascript" src="backend.js?2019.06.03.v2"> </script>

To implement a function adding files to BTFS, you can first define the IP address and accessible port of your BTFS node.

const ipAddr = "";
const ipPort = "443";

Then define a variable with the host IP, port number, and protocol.

const btfs = window.IpfsApi({host:ipAddr, port:ipPort, protocol:'https'});

The add method is of the form .add(data, [options], [callback]), where the data may be:

  • a Readable Stream
  • a Buffer Instance
  • a File
  • a Pull Stream
  • an array of objects, each taking the form:
  path: '/tmp/myfile.txt', // The file path
  content: <data> // A Buffer, Readable Stream, Pull Stream or File with the contents of the file
// backend.js

const ipAddr = "";
const ipPort = "443";

async function add() {
    const btfs = window.IpfsApi({host:ipAddr, port:ipPort, protocol:'https'});
    const Buffer = window.IpfsApi().Buffer;
    const newReader = new FileReader();
    var movieHash, coverHash;
    newReader.onloadend = function () {
        const buf = Buffer.from(newReader.result);
        btfs.files.add(buf, (err, result) => {
            if(err) {
            let url = `https://yourURL./btfs/${result[0].hash}`;
            console.log(`Url --> ${url}`);
            document.getElementById("url").innerHTML= url;
            document.getElementById("url").href= url;
            document.getElementById("url").target = '_blank';
    const DApp = document.getElementById("DApp");


Updated 2 years ago

Developer SDK

Suggested Edits are limited on API Reference Pages

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