Skip to content

Fabric is an experimental protocol for exchanging information.

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
COPYING
Notifications You must be signed in to change notification settings

FabricLabs/fabric

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@fabric/core — the Fabric Reference Client

Project Status Coverage Status GitHub contributors Community

The @fabric/core project provides an API for building peer-to-peer applications on Bitcoin.

Fabric is an experimental approach to the secure establishment and execution of peer-to-peer agreements ("contracts") using Bitcoin as a bonding mechanism. The @fabric/core project provides a robust set of implementations as JavaScript classes, enabling the rapid prototyping and testing of Bitcoin-based applications for downstream developers.

Quick Start

npm i -g FabricLabs/fabric#master

Install Fabric CLI to your system using the above command, then run:

fabric setup
🚨 Stop here!
The output of the above command will include your SEED, which should never be shared.

Once complete, you'll have a fully configured Fabric client available by running:

fabric

For help, try entering "insert mode" by pressing the "i" key then typing /help and pressing enter — you'll get a short help prompt followed by a list of available commands. Feel free to explore!

If you run into any trouble, read on for clues, then [join the chat][chat-help] with any remaining questions.

You'll also want bitcoind installed, and fully synchronized with your preferred network. You can use scripts/playnet.sh to run a local playnet node, for which you can use the faucet: https://faucet.playnet.fabric.pub

What is Fabric?

@fabric/core provides the reference implementation for the Fabric Protocol, a "language" for exchanging information through peer-to-peer networks. Written in JavaScript, it is meant to be well-documented and easy to understand — but not the final implementation.

Contributing

Fork and clone the Fabric GitHub repository and launch a local web server with npm run examples to view the examples, or npm run docs once you're ready to integrate Fabric into your application.

Compiling from Source

See also BUILD.md for a full guide, including Bitcoin and Lightning.

git clone [email protected]:FabricLabs/fabric.git
cd fabric
git checkout feature/v0.1.0-RC1
npm install -g
npm run build

Available Commands

  • npm run cli provides a direct command-line interface to the Fabric network.
  • npm run dev serves a developer interface over localhost HTTP.
  • npm run docs creates a local HTTP server for browsing documentation.
  • npm run examples creates a local HTTP server for interacting with examples.
  • npm start creates a local Fabric node.

Native Dependencies

Installing Fabric from npm (npm i @fabric/core or npm i FabricLabs/fabric#develop) will generally compile the following dependencies from the local system:

  • secp256k1
  • level
  • zeromq

API

The Fabric reference implementation exposes a simple message-passing interface using the actor model, enabling your downstream applications to subscribe to simple events for rapid prototyping of distributed applications.

Using as a Library

Using the EventEmitter pattern, you can create an instance of Fabric to use it as an event source.

Simple Example

const Peer = require('@fabric/core/types/peer');

async function main () {
  const peer = new Peer({
    alias: 'Example',
    peers: ['hub.fabric.pub:7777']
  });

  peer.on('message', (message) => {
    console.log('Received message from Fabric:', message);
  });

  peer.start();
  return { peer };
}

main().catch((exception) => {
  console.error('Example error:', exception);
}).then((output) => {
  console.log('Example output:', output);
});

Plugins

Fabric is an extensible framework, supporting a variety of plugins.

Package Description Status
@fabric/http serve Fabric apps to the legacy web (HTTP) Coverage Status
@fabric/hub run your own Fabric Hub Coverage Status
@fabric/matrix connect to Matrix servers Coverage Status
@fabric/doorman an artificially intelligent assistant Coverage Status

Running on Fabric

Several successful projects are built with or are running on Fabric, including:

  • Doorman, an artificially intelligent assistant
  • IdleRPG, a simple RPG game which rewards you for remaining idle
  • Verse, a virtual universe simulator

To add your project to the list, read the API docs, create a public repository for the source code, then edit this file to include a link to your work.

Edge Nodes

Full Fabric nodes connected to the World Wide Web (WWW). Only SSL (port 443) is supported.

Host Status
hub.fabric.pub ONLINE
labs.fabric.pub OFFLINE

Fabric Projects

Either Fabric libraries or projects running Fabric, this list encompasses the most interesting work in the ecosystem.

Name Description Status v0.1.0-RC1 ready
@fabric/core Core Library
@fabric/http Edge Nodes
hub.fabric.pub
labs.fabric.pub
grove.chat
sensemaker.io FALSE
verse.pub
trynovo.com FALSE

Learning More

The best place to get started is in the #learning channel, a collection of empassioned educators eager to help you.

Fabric on Twitter: @FabricProtocol