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.
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
@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.
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.
See also BUILD.md
for a full guide, including Bitcoin and Lightning.
git clone git@github.com:FabricLabs/fabric.git
cd fabric
git checkout feature/v0.1.0-RC1
npm install -g
npm run build
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.
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
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 the EventEmitter
pattern, you can create an instance of Fabric to use
it as an event source.
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);
});
Fabric is an extensible framework, supporting a variety of plugins.
Package | Description | Status |
---|---|---|
@fabric/http |
serve Fabric apps to the legacy web (HTTP) | |
@fabric/hub |
run your own Fabric Hub | |
@fabric/matrix |
connect to Matrix servers | |
@fabric/doorman |
an artificially intelligent assistant |
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.
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 |
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 |
The best place to get started is in the #learning channel, a collection of empassioned educators eager to help you.
Fabric on Twitter: @FabricProtocol