![]() |
Fabric is an open DHT network for Nostr and Spaces to let you discover records and relay information using a sovereign handle (e.g. |
---|
Note
Fabric is an experimental project and will see frequent updates. Expect some bumps as we refine it—join us to shape its evolution!
Fabric makes it easy to share who you are or find others in a decentralized world. It’s like an address book for the internet’s sovereign future—built on hyperdht, it links Nostr messages and Spaces (sovereign handles, like @example
) so anyone can look up a name or an npub without needing a middleman.
Fabric is not a replacement for Nostr relays! It's intended for publishing small pieces of discovery information. For example, you could share a NIP-65 relay list for your npub! Fabric accepts replaceable and addressable Nostr events.
Fabric enables spaces to publish Nostr events and DNS records on the DHT without needing to store any bloat on the Bitcoin blockchain!
npm install -g @spacesprotocol/fabric
beam
is a query tool and publisher.
- Querying Nostr events:
beam <pubkey_or_space> <event kind> <optional-d-tag>
- Querying DNS records
beam @buffrr TXT
By default, beam grabs a list of trust anchors from your local spaces client at http://127.0.0.1:7225/root-anchors.json to verify spaces. This works if you’re running a spaces client with Bitcoin Core locally. But if you just want to try out Fabric, you can use an external service instead:
export FABRIC_REMOTE_ANCHORS=https://bitpki.com/root-anchors.json
Or add it when you run beam:
beam @buffrr TXT --remote-anchors https://bitpki.com/root-anchors.json
Note: This means you’re trusting BitPKI (or whoever you pick) to provide accurate anchors file, so its best to run your own Bitcoin full node + spaces client locally to generate your own, and keep it up to date.
For example, here’s how to sign and share a NIP-65 relay list tied to your npub
(your public key):
-
Create the relay list (sign & save as
nip65.json
):{ "kind": 10002, "created_at": 1679673265, "pubkey": "97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322", "tags": [ ["r", "wss://alicerelay.example.com"], ["r", "wss://brando-relay.com"], ["r", "wss://expensive-relay.example2.com", "write"], ["r", "wss://nostr-relay.example.com", "read"] ], "content": "", "sig": "<signature>" }
-
Publish it with
beam
:
beam publish nip65.json
- Look it up:
beam 97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322 10002
Records stay live on the network for up to 48 hours. To keep them active, re-publish periodically with the same command, or give it to some service to pin
it for you.
A DNS zone could be wrapped in a Nostr event and signed for publishing, alternatively you may sign any accepted Nostr event and publish it for your space.
- Create a DNS zone file (e.g.,
example.zone
):
@example. 3600 CLASS2 A 127.0.0.1
@example. 3600 CLASS2 TXT "hello world"
- Sign the zone file with
space-cli
:
space-cli signzone @example example.zone > event.json
- Publish with beam:
beam publish event.json
The network retains records for up to 48 hours. To refresh, run:
space-cli refreshanchor event.json
beam publish event.json
You can also distribute event.json to a Fabric service operator for continuous publication.
To contribute to the network, run a Fabric node by specifying a reachable IP and port:
fabric --host <public-ip-address> --port <public-port>
After about 30 minutes of uptime, your node becomes persistent.
We welcome more bootstrap nodes. To contribute:
-
Run a node with a reachable IP/port using the
--bootstrap
flag:fabric --host <public-ip-address> --port <public-port> --bootstrap
-
Submit a pull request updating
constants.js
with your node’s details.
- The Spaces client performs Client Side Validation (CSV) reading Bitcoin blocks and verifying the protocol state, summarizing it all into a Merkle tree root
- The client generates a trust anchors file that's used by Fabric to verify PUT requests.
Basic support for encrypted connections over named spaces is available. Use beam serve
and beam connect
—follow the CLI instructions.
Contributions are welcome! Please submit issues, feature requests, or pull requests to help improve Fabric.
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.