bstore

module
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0

README

bstore

Storage as a market. Object storage where the price is set by open competition, every byte is proven before it is used, and no platform stands between the people who write and the people who hold.

CI Release Go Reference Go version License

[!WARNING] Experimental software. bstore is part of bstack, the applications and patterns built on BSV Layered Multicast. It is published to be built on and improved. Interfaces, formats and behavior may change rapidly between releases; pin an exact version.

A writer publishes an object once and names a bounty for holding it. Every storage provider that holds the bytes advertises the fact on the BSV blockchain and competes to settle the bounty by passing a settlement challenge: a proof of retrievability, sampled and checked by the writer's own client. The first K providers to pass are paid by the writer's own transaction, by rank. Every record in the market is a mined, SPV-verifiable transaction, so nobody trusts anybody, and there is no platform in the middle to fail, to raise its price or to lock you in.

Writers and readers may speak S3. Providers run on commodity hardware and set their own price per gigabyte per day. The bytes travel once, over a multicast plane, to every provider of the bucket, however many there are. bstore promises less and proves more.

The TypeScript host module under host/ is frozen: bug fixes only. New behavior goes to its Go twin under module/, written to bcommon's module contract and mounted by a Go overlay engine (docs/host.md). The bstore-host image runs the TypeScript module.

Why a market

What you get How bstore does it
No platform risk, no lock-in Buckets, entries, holdings and payments are transactions on a public chain. Any compatible client reads them; any provider may serve them.
Verifiable durability A challenge samples 4 KiB segments of an object and proves each into its proof root. You hold the proofs, not a dashboard's word.
Open competition sets the price Providers publish their terms per GB per day. A writer's bounty goes to whoever holds and proves first; nobody negotiates.
Pay only for what is held and proven A bounty is paid after a passed challenge, from the writer's own transaction, split by rank. Nothing is paid for a promise.
Your S3 tooling works unchanged The gateway speaks S3 with SigV4. The AWS CLI, SDKs and most S3 clients need only an endpoint and keys.
Replicas by policy K is the number of providers a writer pays and t the number it needs before it pays anyone. The writer chooses both per object.
Providers earn without a sales relationship A provider subscribes to a bucket, holds what it chooses, advertises, and is paid by the chain. No contract, no account manager.
Everything auditable Advertisements, settlements, renewals and published challenge outcomes are public records anyone can check against block headers.
Bytes delivered once A put is carried over the multicast plane once; every subscribed provider receives the same bytes. Ten providers cost the writer one send.

How it works

flowchart LR
  W["Writer<br/>bstore put or S3"] -->|"entry + bounty<br/>(mined hold output)"| H["Overlay hosts<br/>records topic"]
  W -->|"pieces, once<br/>(multicast plane)"| P1["Provider A"]
  W --> P2["Provider B"]
  W --> P3["Provider C"]
  P1 -->|"advertisement<br/>(mined)"| H
  P2 --> H
  P3 --> H
  W -->|"settlement challenge<br/>(sampled proof)"| P1
  W --> P2
  W -->|"pays first K to pass<br/>(one transaction)"| C[("BSV chain")]
  R["Reader<br/>bstore get or S3"] -->|"proven key"| H
  R -->|"blobs, held to their hashes"| P2
  1. An object is a CHIRP closure (BRC-167): 4 MiB blobs under a root node whose hash names the object everywhere. Pieces go to every provider of the bucket; a signed entry goes to the bucket's records topic.
  2. A bounty races the write. The writer may lock a hold output. Each provider that checks the closure advertises it (a mined BRC-26 advertisement). The writer's client ranks advertisers by first sight, challenges each, and pays the first K that pass with BRC-178's square-root split.
  3. Anyone can buy time or proof. A renewal extends a holding; a challenge samples segments and proves each into the object's proof root. Outcomes may be published for everyone to read.
  4. 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.
  5. Two flows, one proof. The bytes ride the data carrier and are never mined; what is mined is the proof. A 1 GiB put mines about 14 KB, and the link between the two is provable from block headers alone (docs/limits.md).
  6. Existing UHRP hosts join through a bridge (bstore-bridge) that speaks their HTTP routes. Current uhrp-server-basic releases need a one-line fix to commit CHIRP roots; the bridge checks before it pays.

Honest about limits. Availability is a market outcome, keys are not copies, and enforcement is reputation in this version. The gateway's bounty is flat per put, small objects under about 10 MB cost more than S3 by the GB, and there are no public providers and no directory yet. docs/limits.md has every bound and known limit; docs/architecture.md shows the pieces and how they fit.

Measured

Measured on a lab fabric: one S3 gateway, one facade, a multicast plane and two providers on commodity hosts. Details and method in docs/benchmarks.md.

xychart-beta horizontal
  title "A 4 GiB put, end to end (seconds)"
  x-axis ["acknowledged", "carried to all", "verified by all"]
  y-axis "seconds" 0 --> 25
  bar [3.75, 4.3, 17.5]
Measure Result
A 4 GiB put acknowledged by the S3 gateway 3.75 s, about 1,145 MB/s
The same put carried over the multicast plane, lossless 1,002 MB/s
Every provider verified the object 15 to 18 s after the put
Small puts answered 200 by one gateway 400 a second
Roots held and advertised by one provider about 150 a second

Install

Build the command line, the S3 gateway and a provider from the module.

go install github.com/lightwebinc/bstore/cmd/bstore@latest
go install github.com/lightwebinc/bstore/cmd/bstore-provider@latest

Release tarballs for Linux and macOS (amd64, arm64), each with its SHA256SUMS entry, are on the releases page. The container images (ghcr.io/lightwebinc/bstore, bstore-provider, bstore-devchain, bstore-host) are published for a tagged release by a manual workflow, built from the Dockerfile and host/Dockerfile; see docs/configuration.md.

On mainnet in five commands

No node is needed. By default the chain is read from WhatsOnChain (every header held to its proof of work, every proof to those headers) and transactions are broadcast through GorillaPool's public arcade. Your own node (-chain asset:URL) is the better chain view, and every backend is a setting (docs/configuration.md). You need only the overlay hosts that carry your bucket.

Make an identity, print the address to fund it, and see the empty pool.

bstore init -network main -hosts https://overlay-a.example.com,https://overlay-b.example.com
bstore fund

Send a small amount from your own wallet to the fund address (100,000 satoshis, 0.001 BSV, is ample to try every role but a bounty).

Import the payment as the BEEF your wallet hands over, or by txid once it has a block.

bstore fund -beef payment.beef
bstore fund -txid <txid of your payment>

Make a bucket and put an object into it.

bstore bucket new photos          # prints the "served" line your hosts add
bstore put photos/cat.jpg ./cat.jpg

Read it back from any machine, every byte proven, with no coin at all.

bstore bucket add photos_hmqzvtkwrx -owner 02... -id 5f...
bstore -bucket photos_hmqzvtkwrx get photos/cat.jpg ./cat.jpg -proof-root

Testnet is the same with -network test. docs/examples.md walks each role on a real network, with what each step costs.

Documentation

If you want to Read
Do a task on mainnet or testnet: fund, make a bucket, put, read, challenge, renew docs/examples.md
Learn the ideas and the day-to-day use, by role docs/user-guide.md
See the numbers and how they were measured docs/benchmarks.md
See the components, the data flow and the code layout docs/architecture.md
Look up a flag, an environment variable, a config key or an image docs/configuration.md
Look up a command and what it does, step by step docs/usage.md
Know the bounds, what each operation costs, and the known limits docs/limits.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
Try everything on one machine: a local development sandbox (no coin needed, a private regtest chain) QUICKSTART.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

Build everything from a checkout: binaries, the host module and the images.

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.2 and Node 24. bstore pins go-sdk v1.7.8 and bcommon v0.40.0 (exact tags in go.mod, asserted by make verify).

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.
Package chaincfg builds what every bstore program reads the chain through from its configuration: the chain view (transactions, proofs, spends), the header source and the tip, the settlement leg, and the miner fee policy.
Package chaincfg builds what every bstore program reads the chain through from its configuration: the chain view (transactions, proofs, spends), the header source and the tip, the settlement leg, and the miner fee policy.
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), the S3 gateway (`bstore s3d`, section 16) and an S3 client (`bstore cp` with an s3:// side).
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), the S3 gateway (`bstore s3d`, section 16) and an S3 client (`bstore cp` with an s3:// side).
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: bcommon devkit's devchain (a node's JSON-RPC at /rpc, its asset API under /api/v1/ and a header source at /v1/root/<height> and /v1/tip, every transaction mined at once).
Command devchain is a local stand-in chain for trying bstore without a node, a settlement service or any coin: bcommon devkit's devchain (a node's JSON-RPC at /rpc, its asset API under /api/v1/ and a header source at /v1/root/<height> and /v1/tip, every transaction mined at once).
perfcorpus command
Command perfcorpus builds a replayable corpus of real bstore records for step-load runs on a lab (lab and tests only, never for real use).
Command perfcorpus builds a replayable corpus of real bstore records for step-load runs on a lab (lab and tests only, never for real use).
vectors command
Command vectors writes the golden vectors under testdata/vectors, or with -check compares them byte for byte and writes nothing (bcommon devkit's vectors runner over this repository's generator).
Command vectors writes the golden vectors under testdata/vectors, or with -check compares them byte for byte and writes nothing (bcommon devkit's vectors runner over this repository's generator).
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 (coinbase: only on a regtest chain you run, development and tests), 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 (coinbase: only on a regtest chain you run, development and tests), 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 module is the bstore overlay module in Go: `tm_bstore_<bucket>` for each configured bucket, `tm_bstoreblob_<bucket>` where the host's topics name one, and `ls_bstore` for all of them, written to bcommon's engine-neutral contract (github.com/lightwebinc/bcommon/module) so that any Go overlay host that carries the adapter mounts it.
Package module is the bstore overlay module in Go: `tm_bstore_<bucket>` for each configured bucket, `tm_bstoreblob_<bucket>` where the host's topics name one, and `ls_bstore` for all of them, written to bcommon's engine-neutral contract (github.com/lightwebinc/bcommon/module) so that any Go overlay host that carries the adapter mounts it.
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