You nailed it. Now hit the right arrow to continue the presentation.

In partnership with Protocol Labs

Product overview

Textile maintains a suite of libraries that aim to make it faster to adopt IPFS and Filecoin. We'll look at each one below.

  • Threads - Database over Libp2p.
  • Buckets - Object storage like S3 on IPFS + Filecoin.
  • Hub - Hosted access to IPFS & Filecoin.
  • Miner Index - Store your data cheap and fast.
  • Powergate - Build your own platform or service on IPFS & Filecoin.

Threads

Threads are built to provide fast, reliable, multi-peer synchronization of data. Threads write to local databases and push/pull updates to peers over Libp2p.

 

  • go-threads - Go client and implementation.
  • js-threads - JavaScript client and local database.
  • Daemon - Service and gateway to build and extend.

Press down arrow to learn more about threads.

Threads Concepts

Threads have just a few concepts to understand before getting started.

  • DBs - Most applications will interact with a database in threads.
  • Thread IDs - Each DB is known by its unique ThreadID, used to connect or invite others to a database.
  • Collections - Each DB can contain one or many collections. Each collection has its own schema and write validator.
  • Records - Each collection is made up of records.

Press down arrow to learn more about threads.

// Go example
threadID := thread.NewIDV1(thread.Raw, 32)

err := db1.NewDB(context.Background(), threadID)

dbInfo, err := db1.GetDBInfo(context.Background(), threadID)

reflector := jsonschema.Reflector{}
mySchema = reflector.Reflect(&Person{}) // Generate a JSON Schema from a struct

err := db.NewCollection(context.Background(), myThreadID, db.CollectionConfig{
    Name:    "Persons",
    Schema:  mySchema,
    Indexes: []db.Index{{
      Path:   "name",
      Unique: true, 
    }},
})
...

// db2 is a different client (this would normally be done on a different machine)
err := db2.NewDBFromAddr(context.Background(), dbInfo.Addrs[0], dbInfo.Key)

You can do everything with threads using the go-threads

  • Daemon - Run a full thread node.
  • go-threads - Connect to the daemon or the remote Hub daemon using a Go Client.
  • Read the Getting Started section of the go-threads docs to learn more.

Press down arrow to learn more about threads.

// Go example
threadID := thread.NewIDV1(thread.Raw, 32)

err := db1.NewDB(context.Background(), threadID)

dbInfo, err := db1.GetDBInfo(context.Background(), threadID)

reflector := jsonschema.Reflector{}
mySchema = reflector.Reflect(&Person{}) // Generate a JSON Schema from a struct

err := db.NewCollection(context.Background(), myThreadID, db.CollectionConfig{
    Name:    "Persons",
    Schema:  mySchema,
    Indexes: []db.Index{{
      Path:   "name",
      Unique: true, 
    }},
})
...

// db2 is a different client (this would normally be done on a different machine)
err := db2.NewDBFromAddr(context.Background(), dbInfo.Addrs[0], dbInfo.Key)

You can connect to threads using the Textile JavaScript client. 

  • Thread Client - Connect to a full thread node run on the Textile Hub.
  • Local first - Use a local-first, offline database with Threads in Javascript.
  • Read the Local First blog post to get started.

Press down arrow to learn more about threads.

import { Database } from "@textile/threaddb"

// Create an empty db, with a defined schema, and open it
const db = await new Database("demo", { name: "Person", schema }).open(1); // Versioned dbs

const Person = db.collection("Person")
await Person.insert({ name: "Carson", age: 37 })
// [ '01ENVC6YJ94K0DVXXESQJYE8WD' ]

const entity = Person.create({ name: "Other", age: 2 });
await entity.exists() // false
await Person.has(entity._id); // false

await entity.save(); // Write to the local store
await entity.exists(); // true

await Person.find({}).count(); // Should be at least 2

future threads

Threads are designed to be a blockchain agnostic layer2 for any project.

  • Database sync - Using fast event-sourcing over libp2p.
  • P2P services - Replace the rest server with a network of open APIs.
  • Interoperable - Built on open standards like DIDs, IPLD, and more.
  • Join the discussion here.

Press down arrow to learn more about threads.

Get inspired by these thread users:

What could you build with threads?

  • build a p2p API for Filecoin miners to transfer offline deals.
  • build a postgresql wrapper that syncs data to Filecoin.
  • design an NFT that owns its own thread so that only the current NFT holder can mutate the thread contents.
  • create a thread exit node that converts any user's thread to a webhook, json api, or RSS feed.

Buckets

Buckets provide object storage, synchronization, and sharing over IPFS and Filecoin. They are easy to use and full of features.

  • CLI or API - Buckets can be used from your command-line or built into your application or web-app using a fully-featured API.
  • Single-user - Use buckets to push your data to the IPFS in a single command.
  • Multi-user - Invite others to watch or help manage your buckets.

press down to learn more about buckets or right to continue the tour

Buckets

Buckets bridge multiple protocols so you can use the best for any use-case.

  • IPFS - When connected to the Textile Hub, all bucket contents are published over IPFS. The IPFS CID will update on each change.
  • IPNS - Every bucket gets its own IPNS address that provides a stable address to the bucket over IPFS.
  • HTTP - The Textile Hub will give your bucket a static HTTP URL to use at `<key>.textile.space`.
  • Filecoin - The bucket archive API can be used to store snapshots of your buckets on Filecoin.

press down to learn more about buckets or right to continue the tour

js-buckets

You can embed the buckets API in your app and give your users their own buckets.

  • @textile/buckets - buckets client written in typescript and available for NodeJS or in the Browser. Available in @textile/hub too.
  • Account Keys - manage your personal or your organization's buckets on the Textile Hub.
  • User Keys - embed buckets in your app and let your users create/edit their own.

press down to learn more about buckets or right to continue the tour

cryptography = await import("https://unpkg.com/@textile/crypto?module")
api = await import("https://unpkg.com/@textile/[email protected]?module")
buck = await api.Buckets.withKeyInfo({ key: "apikey", secret: "secret" })

const alice = cryptography.PrivateKey.fromRandom()
await buck.getToken(alice)

const { root, threadID } = await buck.getOrCreate('bucket', {
    threadName: 'default',
    encrypted: false,
})

const nodes = await buckets.listPath(key, "")
if (nodes.item) {
    for (const obj of nodes.item.items) {
        if (obj.name === '.textileseed') continue
        if (obj.isDir) {
            console.log(`${obj.name}`)
        }
    }
}

Fresh off the press. go-buckets is a full node for services and apps.

  • services - expose bucket APIs as part of your own platform or service. gRPC API and client.
  • desktop - use go-buckets to build desktop applications, tray utilities, and background services that efficiently move data across IPFS and Filecoin.
  • pinning services - run your own pinning service, with permissioning and pinset sync, in seconds.

press down to learn more about buckets or right to continue the tour

buckets & threads

buckets are built on threads! so you can combine them for even more magic

  • Mapping - store data in a bucket and use a custom collection in the same thread to manage a schema and map folder objects to that schema.
  • CIDs - every file in the bucket has it's own CID (or path from the root CID) that can be added to any Thread collections for sharing.
  • Snapshots - Use bucket archives to roll that data up to Filecoin for anchoring & replication.

press down to learn more about buckets or right to continue the tour

cryptography = await import("https://unpkg.com/@textile/crypto?module")
api = await import("https://unpkg.com/@textile/[email protected]?module")
buck = await api.Buckets.withKeyInfo({ key: "apikey", secret: "secret" })

const alice = cryptography.PrivateKey.fromRandom()
await buck.getToken(alice)

const { root, threadID } = await buck.getOrCreate('bucket', {
    threadName: 'default',
    encrypted: false,
})

const nodes = await buckets.listPath(key, "")
if (nodes.item) {
    for (const obj of nodes.item.items) {
        if (obj.name === '.textileseed') continue
        if (obj.isDir) {
            console.log(`${obj.name}`)
        }
    }
}

Get inspired by these bucket users:

What could you build with buckets?

  • build a tray app for p2p sharing of files over libp2p or ipfs.
  • combine buckets and nucypher to provide new forms of shared data.
  • create a minting service that can read threads and buckets to mint a new NFT from any contents.
  • build a data dao, where token holders have the ability to modify a bucket's contents and data is stored on Filecoin.

Textile Hub

Hosted access to the IPFS and Filecoin network. Bucket persistence, Thread APIs, and more.

  • Free signup
  • Instant access to IPFS pinning for your buckets.
  • Easy to use client libraries to embed threads and buckets in your app.
  • Simple Filecoin API for your data.

press down to learn more about the hub or right to continue the tour

Zero-config access to everything Textile offers. Including hosted IPFS pinning, Filecoin access and wallets, and more.

Use the Hub as a tool to collaborate or an API to build on.

Filecoin storage

  • Use the Textile Hub to manage deal creation on Filecoin.
  • Push any bucket as a new deal to store on the network.
  • Use the Miner Index to find cheap miners ready to store your data.
  • Fetch or recover previously stored buckets easily.
> hub init
> hub buck init --cid=bafybeifowfggkfpjxsvf7cke32ohwqo2i4zd2uycyx2ooxigiu6bpbkytm
> hub fil addrs
> hub buck archive set-default-config --fast-retrieval --trusted-miners {A,B} --rep-factor 2 {--verified-deal}
> hub buck archive
Success! Archive queued successfully

1. Init account

2. CD into a new directory. Init bucket (WARN: 5Gib download)

3. List and fund your Hub wallet address

4. Set bucket default storage config to use your miner

5. Kick off the storage deal with your miner

press down to learn more about the hub or right to continue the tour

Get started

Free and easy way to get started with IPFS, Filecoin, and the suite of Textile libraries.

 

Check out the docs to learn more:

Miner Index

An easy to use API to discover miners on the Filecoin network and store your data.

Powergate

  • A production-ready Filecoin development stack.
  • Handle one-to-thousands of wallets.
  • Manage scalable deal-storage pipelines.
  • Integrated IPFS pinning API.
  • Get started here.

press down to learn more about powergate or right to continue the tour

Localnet

  • Develop with a full featured Filecoin network right on your device.
  • Dockerized miners that run fast
  • Experience the full network capabilities and workflow while building your application.
  • Get started here.

press down to learn more about powergate or right to continue the tour

Production

Thanks!

Learn more at textile.io

Get in touch at https://slack.textile.io