Skip to content

Commit 6e773c4

Browse files
committed
Enable a stateless mode of operation
1 parent 4c14e2c commit 6e773c4

23 files changed

+2709
-4273
lines changed

README.md

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,9 @@
77

88
Fabric is a trustless, distributed DNS resolver built on top of [hyperdht](https://github.com/holepunchto/hyperdht), extending its capabilities to allow publishing signed zone files using [spaces](https://spacesprotocol.org) as keys authenticated by Bitcoin. [Spaces](https://spacesprotocol.org) are sovereign Bitcoin identities and serve as a trust anchor, while Fabric DHT enables publishing records off-chain without adding any unnecessary on-chain bloat.
99

10-
**Note:** Fabric currently defaults to Bitcoin testnet4 since spaces are not yet on Bitcoin mainnet.
11-
12-
## Prerequisites
13-
To use `fabric` and `beam`, you need to:
14-
15-
- Run Bitcoin Core on testnet4
16-
- Install and sync spaces
17-
18-
You may use [this guide](https://docs.spacesprotocol.org/getting-started/installation) to set these up.
1910

2011
## Installation
2112

22-
After [setting up spaces](https://docs.spacesprotocol.org/getting-started/installation), install Fabric:
2313

2414
```shell
2515
npm install -g @spacesprotocol/fabric
@@ -31,69 +21,65 @@ npm install -g @spacesprotocol/fabric
3121
Use `beam` it's like a distributed `dig`!
3222

3323
```
34-
beam @onion TXT
24+
beam @buffrr TXT --remote-anchors http://127.0.0.1:7225/root-anchors.json
3525
```
3626

37-
Space @now also has TXT records published.
38-
39-
**Note**: `beam` will automatically connect to a locally run spaces node using its default port for `testnet4` to verify answers from the DHT.
27+
`--remote-anchors http://127.0.0.1:7225/root-anchors.json`: will load trust anchors file from your local spaces client connected to Bitcoin core.
4028

29+
You may also specify a local anchors file e.g. `--local-anchors /path/to/root-anchors.json`
4130

42-
## How to publish records for a Space?
31+
## How to publish records for a space?
4332

44-
1. Create a zone file (e.g., example.zone) with an SOA record and the records you want to publish:
33+
1. Create a DNS zone file (e.g., example.zone) with an SOA record and the records you want to publish:
4534

4635

4736
```
48-
@ORIGIN @example.
49-
50-
; YOU MUST INCREMENT ZONE SERIAL WITH EACH UPDATE
51-
@ 3600 CLASS2 SOA . . ( 1 3600 600 604800 3600 )
52-
@ 3600 CLASS2 TXT "Hello spaces!"
37+
@example. 3600 CLASS2 SOA . . ( 1 3600 600 604800 3600 )
38+
@example. 3600 CLASS2 A 127.0.0.1
39+
@example. 3600 CLASS2 TXT "hello world"
5340
```
5441

55-
2. Find the space's private key using `space-cli`
42+
43+
44+
2. Sign it with `space-cli`
5645

5746
```shell
58-
space-cli --chain testnet4 exportwallet | grep '"spaces_descriptor"' | sed -E 's/.*(tprv[^\/]*).*/\1/'
47+
space-cli signzone example.zone
5948
```
6049

61-
it should look something like this:
50+
It will create `example.packet.json` that you can publish!
6251

63-
```
64-
tprv8ZgxMBicQKsPeUUxV746bQ9JmsytoyEeioAd9b962bQxcq7PfK8vRbFkSR7JD7ySoBoyswHX5vQvnhS95dHKUxW2maG2Tt7bJcCHsY66gNF
65-
```
6652

53+
3. Publish the file using `beam`:
54+
55+
56+
```shell
57+
beam publish example.packet.json
58+
```
6759

68-
3. Use `beam` to sign your zone file `example.zone`:
60+
The network will keep it for up to 48 hours, then it will become stale and will be removed.
6961

62+
To refresh, and re-publish it:
7063

7164
```shell
72-
beam sign example.zone --private-key <private-key>
65+
space-cli refreshpacket example.packet.json
66+
beam publish example.packet.json
7367
```
7468

75-
Distribute the signed zone file (`example.zone.signed`) to the network:
7669

77-
You can either:
78-
- Place it in the `--watch` directory of a running Fabric node
79-
- OR Share it with other Fabric node operators to have them keep it alive
70+
Alternatively, distribute the signed packet file (`example.packet.json`) to a Fabric service operator to continue to publish it for you. The packet is signed with your keys so you don't need to trust them!
8071

8172

8273
## Running a Fabric node
8374

84-
Run a node if you want to publish your own zones and also contribute to the network. Specify a reachable ip/port:
85-
86-
**Note**: Fabric will automatically connect to a locally run spaces node using its default port for testnet4.
75+
Run a node to contribute to the network. Specify a reachable ip/port:
8776

8877
```
89-
fabric --host <ip-address> --port <public-port>
78+
fabric --host <ip-address> --port <public-port> --remote-anchors http://127.0.0.1/root-anchors.json
9079
```
9180

92-
Specify a directory to watch for publishing space zones:
81+
or you could use `--local-anchors /path/to/root-anchors.json`. Fabric will continue to watch changes to this file.
9382

94-
```shell
95-
fabirc --host <ip-address> --port <public-port> --watch /path/to/signed/zone/files/directory
96-
```
9783

9884
After about 30 minutes of uptime, your node will become persistent and contribute to the network's storage.
9985

@@ -107,7 +93,7 @@ We could use more bootstrap nodes:
10793
1. Run a node with a reachable IP/Port specifying `--bootstrap` option
10894

10995
```shell
110-
fabric --host <ip-address> --port <port> --bootstrap
96+
fabric --host <ip-address> --port <port> --bootstrap --remote-anchors http://127.0.0.1/root-anchors.json
11197
```
11298

11399
2. Create a pull request updating `constants.js` to include your bootstrap node.

0 commit comments

Comments
 (0)