bstore

module
v0.6.1 Latest Latest
Warning

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

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

README

bstore

License

Object storage as a market on Bitcoin. A writer publishes an object once; storage providers compete to hold it for a bounty; a reader proves every byte it gets. Readers and writers may speak S3.

How it works

  • Publish once, many providers. An object is a CHIRP (BRC-167) closure sent to every provider of its bucket, with a signed entry on the bucket's records topic. Providers advertise what they hold with ordinary UHRP (BRC-26) advertisements.
  • A bounty races the write. A writer may commit a hold bounty that its own client pays, by rank, to the first providers to advertise and pass a challenge, with BRC-178's square-root split.
  • Anyone can buy time or proof. A renewal extends a provider's holding; a challenge samples 4 KiB segments and proves each into the object's proof root.
  • The bucket proves its own listing. The owner's chain of mined tokens commits to the whole key map, so a reader proves what a key names, that a key is absent and that a listing page is complete.
  • Incumbent UHRP hosts join unchanged through a bridge (bstore-bridge) that speaks their HTTP routes.
  • Honest about limits. Availability is a market outcome, keys are not copies, and enforcement is reputation in this version.

Documentation

If you want to Read
Try it on one machine, in Docker, with no coin QUICKSTART.md
Learn the ideas and the day-to-day use, by role docs/user-guide.md
Know the bounds, what each operation costs, and the known limits docs/limits.md
Look up a command, a flag or a setting docs/usage.md
Run a storage provider docs/provider.md
Run the S3 gateway, and what S3 clients can do through it docs/s3.md
Run an overlay host that carries buckets docs/host.md
Implement a compatible writer, provider, host or reader docs/spec.md (the specification)
Know what cannot change once published docs/frozen.md
Use or check the codec and its golden vectors docs/codec.md

Building

cd host && npm ci && cd ..
make verify NODE=/path/to/node24
make bstore bstore-provider       # bin/: the command line (and bstore s3d), the provider
make module NODE=/path/to/node24  # host/bundle/bstore-module.js
make docker-build                 # the images

Go 1.27 and Node 24. bstore pins go-sdk v1.7.1 and bcommon v0.12.0.

License

Apache License 2.0. See LICENSE, and NOTICE for the third-party software and standards.

Directories

Path Synopsis
Package auth104 is the server side of BRC-103 mutual authentication over HTTP (BRC-104), as a provider's routes need it: the handshake at /.well-known/auth, and each authenticated request checked and its answer signed, the way the SDK's clients (authhttp in Go, AuthFetch in TypeScript) send and check them.
Package auth104 is the server side of BRC-103 mutual authentication over HTTP (BRC-104), as a provider's routes need it: the handshake at /.well-known/auth, and each authenticated request checked and its answer signed, the way the SDK's clients (authhttp in Go, AuthFetch in TypeScript) send and check them.
Package backend is the hold-backend interface of spec section 17 and the native content-addressed backend on local disk.
Package backend is the hold-backend interface of spec section 17 and the native content-addressed backend on local disk.
cmd
bstore command
Command bstore is bstore's command line: the publisher client (spec sections 9 and 14), the bucket owner's tooling (sections 3.4 to 3.6 and 4.4), a verified reader (section 15) and the S3 gateway (`bstore s3d`, section 16).
Command bstore is bstore's command line: the publisher client (spec sections 9 and 14), the bucket owner's tooling (sections 3.4 to 3.6 and 4.4), a verified reader (section 15) and the S3 gateway (`bstore s3d`, section 16).
bstore-provider command
Command bstore-provider is a bstore storage provider: the market front of spec section 17 over the native content-addressed hold backend.
Command bstore-provider is a bstore storage provider: the market front of spec section 17 over the native content-addressed hold backend.
devchain command
Command devchain is a local stand-in chain for trying bstore 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 bstore commands, the providers and the overlay hosts check proofs against.
Command devchain is a local stand-in chain for trying bstore 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 bstore commands, the providers 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
acceptcfg
Package acceptcfg is the payment acceptance settings every bstore configuration file names (bcommon acceptance.Policy): the writer's home, the gateway's and the provider's, the same keys in each.
Package acceptcfg is the payment acceptance settings every bstore configuration file names (bcommon acceptance.Policy): the writer's home, the gateway's and the provider's, the same keys in each.
anchor
Package anchor is the bucket owner's tooling (spec sections 3.4 to 3.6 and 4.4): it creates a bucket chain, and anchors the entries of the owner and its writers into the chain's next tokens, exactly as frozen.
Package anchor is the bucket owner's tooling (spec sections 3.4 to 3.6 and 4.4): it creates a bucket chain, and anchors the entries of the owner and its writers into the chain's next tokens, exactly as frozen.
efleg
Package efleg hands a settlement leg every transaction with its inputs' source transactions attached.
Package efleg hands a settlement leg every transaction with its inputs' source transactions attached.
publish
Package publish is bstore's publisher (spec sections 5, 9, 13 and 14): it builds an object's CHIRP closure and proof root while the content streams (Store.Stage), mints a hold output when a bounty is asked for, makes the piece carriers and the entry, and delivers them over the plane, by unicast to the hosts and providers configured, or by BRC-167 upload session; it judges each bounty's race (race.go), settles it by rank or reclaims it after its deadline (settle.go), challenges providers (challenge.go), publishes outcome records, and sweeps its funding trees (sweep.go).
Package publish is bstore's publisher (spec sections 5, 9, 13 and 14): it builds an object's CHIRP closure and proof root while the content streams (Store.Stage), mints a hold output when a bounty is asked for, makes the piece carriers and the entry, and delivers them over the plane, by unicast to the hosts and providers configured, or by BRC-167 upload session; it judges each bounty's race (race.go), settles it by rank or reclaims it after its deadline (settle.go), challenges providers (challenge.go), publishes outcome records, and sweeps its funding trees (sweep.go).
reader
Package reader is a bstore reader (spec section 15): it asks the hosts it is given the free lookup questions of spec section 11.1, verifies every token, entry and advertisement against its own headers, proves what a key names, that a key is absent and that a listing page is complete against the chain's latest token, and reads an object's closure from its advertisers, every byte held to its hash before it is released.
Package reader is a bstore reader (spec section 15): it asks the hosts it is given the free lookup questions of spec section 11.1, verifies every token, entry and advertisement against its own headers, proves what a key names, that a key is absent and that a listing page is complete against the chain's latest token, and reads an object's closure from its advertisers, every byte held to its hash before it is released.
s3d
Package s3d is `bstore s3d`, the S3 gateway of spec section 16: a reader and a writer for clients that speak S3, authenticated with AWS Signature Version 4 in gateway mode.
Package s3d is `bstore s3d`, the S3 gateway of spec section 16: a reader and a writer for clients that speak S3, authenticated with AWS Signature Version 4 in gateway mode.
testwriter
Package testwriter is a minimal bstore writer for tests only: it funds itself from a local test chain's coinbase, builds an object's CHIRP closure, mints its piece carriers, a hold output and the entry, submits them, asks hosts for advertisements, challenges providers, verifies their signed responses as a buyer does (spec section 7.4), buys renewals, and settles a bounty by rank with BRC-29 outputs and remittances (spec section 9.5).
Package testwriter is a minimal bstore writer for tests only: it funds itself from a local test chain's coinbase, builds an object's CHIRP closure, mints its piece carriers, a hold output and the entry, submits them, asks hosts for advertisements, challenges providers, verifies their signed responses as a buyer does (spec section 7.4), buys renewals, and settles a bounty by rank with BRC-29 outputs and remittances (spec section 9.5).
vectors
Package vectors generates the golden vectors under testdata/vectors from the codec in storerec.
Package vectors generates the golden vectors under testdata/vectors from the codec in storerec.
Package provider is bstore-provider: the market front of spec section 17 over a hold backend.
Package provider is bstore-provider: the market front of spec section 17 over a hold backend.
Package storerec is the byte-level contract of bstore: the bucket record a mined token carries, the object entry, the piece, the outcome record and the front statement that ride unmined carriers, the challenge request and response, the hold terms, the key map and its contexts, the proof tree, settlement, BRC-26 advertisements, the names and lookup questions, the topic manager's transaction rules and a reader's checks that need no network.
Package storerec is the byte-level contract of bstore: the bucket record a mined token carries, the object entry, the piece, the outcome record and the front statement that ride unmined carriers, the challenge request and response, the hold terms, the key map and its contexts, the proof tree, settlement, BRC-26 advertisements, the names and lookup questions, the topic manager's transaction rules and a reader's checks that need no network.

Jump to

Keyboard shortcuts

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