Help us shape the future of Go! Take the 2026 Go Developer Survey

borg

module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: Apache-2.0

README

borg

License

Organisations and groups on Bitcoin, replicated by overlay hosts. An organisation issues each member a certificate; a group's membership is a chain of mined tokens; and every removal from a group begins a new epoch whose key the removed member never receives.

How it works

  • Membership is a certificate. Each member holds a BRC-52 certificate issued by the organisation's key, with a role, a scope and an expiry. Its revocation outpoint is the output that funds it on the plane, so one mined spend revokes it for every verifier and retracts it from every host.
  • Changes are ordered by the chain. The roll and each group are chains of mined tokens, one per change. Two changes made at once spend the same output and only one is ever mined: no coordinator, no merge.
  • Removal is a rekey, checked by every host. A transition that removes anyone must begin a new epoch with a new key commitment, or no host admits it. The new key is random, committed before anyone holds it (BRC-369), and wrapped only to the members who remain.
  • Hosts are replicas, not authorities. A host can withhold; it cannot forge. Roots over the roll and over each group's members make withholding visible.
  • Two ways to reach the hosts. On the multicast plane a publisher submits each object once and every subscribed host receives it; without it, the publisher submits to each host itself.
  • Everything is at the hosts. A host that missed something is filled from the others by anyone (borg fill), and a second home of the organisation rebuilds its state from them (borg org sync), opening each epoch key from a wrap like any member.

Documentation

If you want to Read
Try it on one machine in minutes QUICKSTART.md
Run an organisation, or use one as a member docs/user-guide.md
Look up a command, a setting or an exit code docs/usage.md
Implement a compatible organisation, member client or host docs/spec.md (the specification)
Know what cannot change once published docs/frozen.md
Know the defaults and caps, and why each is set where it is docs/limits.md
Run a host: the module, its configuration, its index and its terms route docs/host.md
Read borg's chains from another Go program docs/packages.md

Build and test

$ (cd host && npm ci)   # once
$ make verify           # gofmt, vet, dependency set, licences, typecheck, vectors, tests
$ make borg             # the command, bin/borg
$ make vectors          # regenerate both vector sets
$ make module           # the host module, host/bundle/borg-module.js
$ make e2e REFERENCE_HOST=/path/to/reference-host          # the module on a local reference host (Docker)
$ make e2e-client REFERENCE_HOST=/path/to/reference-host   # the command against two local reference hosts (Docker)
$ make docker-build docker-build-host REFERENCE_HOST_IMAGE=<image>   # the images, locally
$ make quickstart-check # QUICKSTART.md, run as written, on those images

Go 1.27.1 or later and Node 24; NODE=/path/to/node selects a Node 24 binary that is not on PATH. The golden vectors in testdata/vectors are generated by the Go codec (borgrec), and testdata/ts by the TypeScript codec in host/; each side's tests read the other's, byte for byte. Two direct Go dependencies, asserted by make verify: go-sdk at exactly v1.5.2 and bcommon, whose TypeScript package at the same version is vendored under host/vendor.

License

Apache 2.0; see LICENSE.

Directories

Path Synopsis
Package borgrec is the byte-level contract of borg: the organisation and group records that ride mined chain tokens, the membership grant and the epoch-key wrap that ride unmined carriers, the hall and scope grammars, the BRC-369 epoch key, and the lookup question classes.
Package borgrec is the byte-level contract of borg: the organisation and group records that ride mined chain tokens, the membership grant and the epoch-key wrap that ride unmined carriers, the hall and scope grammars, the BRC-369 epoch key, and the lookup question classes.
cmd
borg command
Command borg runs an organisation and its groups on overlay hosts, and reads them as a member: it creates an identity home and halls, begins an organisation and issues its members BRC-52 grants, keeps the roll on a chain of mined tokens, creates groups whose every removal begins a new epoch with a fresh key wrapped only to the members who remain, revokes by the roll and by sweep, opens a group's epoch key as a member, reads the roll and memberships from one or several hosts checking every answer itself, pays a host's 402 for the priced history question, and settles the payments a host accepted as its payee.
Command borg runs an organisation and its groups on overlay hosts, and reads them as a member: it creates an identity home and halls, begins an organisation and issues its members BRC-52 grants, keeps the roll on a chain of mined tokens, creates groups whose every removal begins a new epoch with a fresh key wrapped only to the members who remain, revokes by the roll and by sweep, opens a group's epoch key as a member, reads the roll and memberships from one or several hosts checking every answer itself, pays a host's 402 for the priced history question, and settles the payments a host accepted as its payee.
devchain command
Command devchain is a local stand-in chain for trying borg without a node, a settlement service or any coin: it serves a node's JSON-RPC (generatetoaddress, sendrawtransaction, getinfo) at /rpc, a node's asset API under /api/v1/, and a header source (/v1/root/<height>, /v1/tip) that the borg command and the overlay hosts check proofs against.
Command devchain is a local stand-in chain for trying borg without a node, a settlement service or any coin: it serves a node's JSON-RPC (generatetoaddress, sendrawtransaction, getinfo) at /rpc, a node's asset API under /api/v1/, and a header source (/v1/root/<height>, /v1/tip) that the borg command and the overlay hosts check proofs against.
vectors command
Command vectors writes the golden vectors under testdata/vectors.
Command vectors writes the golden vectors under testdata/vectors.
internal
config
Package config resolves the borg command's settings: flags, then BORG_* in the environment, then the config file, then the built-in default.
Package config resolves the borg command's settings: flags, then BORG_* in the environment, then the config file, then the built-in default.
engine
Package engine is a borg publisher: the organisation's tooling (docs/spec.md sections 7, 9 and 12), run from one identity's home.
Package engine is a borg publisher: the organisation's tooling (docs/spec.md sections 7, 9 and 12), run from one identity's home.
state
Package state is an identity's durable record in its home: the funding trees its carriers and chains spend, the organisation it runs (its own chain, its grants, its groups and every epoch key it sampled), the objects persisted before they are published, the sweeps it built, and, for a member, the epoch keys it opened, the grants it holds and the latest token of each chain it has verified.
Package state is an identity's durable record in its home: the funding trees its carriers and chains spend, the organisation it runs (its own chain, its grants, its groups and every epoch key it sampled), the objects persisted before they are published, the sweeps it built, and, for a member, the epoch keys it opened, the grants it holds and the latest token of each chain it has verified.
testchain
Package testchain is the local stand-ins this module's tests run against: the shared chain, and this application's host.
Package testchain is the local stand-ins this module's tests run against: the shared chain, and this application's host.
unicast
Package unicast publishes objects to overlay hosts one by one, for a deployment with no multicast plane (spec section 12).
Package unicast publishes objects to overlay hosts one by one, for a deployment with no multicast plane (spec section 12).
vectors
Package vectors generates the golden vectors under testdata/vectors from the codec in borgrec.
Package vectors generates the golden vectors under testdata/vectors from the codec in borgrec.
Package reader asks overlay hosts the ls_borg questions and checks every answer itself (docs/spec.md sections 10.2, 12 and 13): a token's record, lock and field signature and its proof against the reader's own headers; a carrier by the host's own admission rules and by SPV through its funding parent; a sweep by its proof.
Package reader asks overlay hosts the ls_borg questions and checks every answer itself (docs/spec.md sections 10.2, 12 and 13): a token's record, lock and field signature and its proof against the reader's own headers; a carrier by the host's own admission rules and by SPV through its funding parent; a sweep by its proof.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL