blogs

module
v0.6.4 Latest Latest
Warning

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

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

README

blogs

CI Release Go version License

[!WARNING] Experimental software. blogs 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.

Distributed logging on Bitcoin. A producer appends signed, numbered batches of log lines to a stream; overlay hosts keep them; and one small mined anchor per interval commits the interval's batches, so any host's copy can be proven complete and any auditor can prove when a line was committed, against block headers it checks itself.

$ tail -F /var/log/app.log | blogs produce app_qzxkvbmwtr
$ blogs -hosts https://logs.example.com verify-interval app_qzxkvbmwtr 02c0ffee… 1
VERIFIED interval 1 of app_qzxkvbmwtr by 02c0ffee…: seqs 1 to 4, root 5d7f…3999, committed no later than block 912430

blogs runs on BSV mainnet (-network main, the default) and testnet (-network test), and needs no node and no infrastructure of its own: headers and chain lookups come from the public WhatsOnChain API, checked against proof of work, and transactions are broadcast through GorillaPool's public arcade. Readers and auditors need only the hosts that keep a stream: no coin, no home. A producer pays for its own anchors and batches from coin it already owns (about 113 satoshis an anchor and 6 a batch): install, init, pay the fund address from your wallet, fund, produce (QUICKSTART.md). A node of your own, or a header service you run, can replace any public service (docs/configuration.md).

New here? QUICKSTART.md starts on the real network, then gives a local development sandbox (a private regtest chain, no coin needed) with two hosts and a verified interval in about five minutes.

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 blogs-host image runs the TypeScript module.

How it works

  • Batches are never mined. Each rides an unmined carrier transaction that spends one output of a mined funding tree, so it verifies by SPV without paying for block space, and the producer can retract it by spending that output.
  • One anchor per interval is mined. It commits the RFC 6962 root over the interval's batches and spends the previous interval's anchor, so the anchors form one chain that covers every batch of the stream once.
  • Hosts are replicas, not authorities. A reader and an auditor verify everything a host answers; a host can withhold, but it cannot forge. Any host's copy of an interval is either complete and proven, or visibly not.
  • Two ways to reach the hosts. On the multicast plane a producer submits each object once and every subscribed host receives it. Without it, in unicast mode, the producer submits to each host itself and a host that missed something is repaired by backfill.

Documentation

If you want to Read
Get started on mainnet or testnet, or try it locally with no coin QUICKSTART.md
Learn what it is for and how to use it, end to end, with examples docs/user-guide.md
See how the pieces fit: command, hosts, chain, code layout docs/architecture.md
Set a key, an environment variable or a flag docs/configuration.md
Look up a command, its flags, an exit code or a message docs/usage.md
Run without the multicast plane, and repair a host docs/unicast.md
Know the defaults and caps, and why each is set where it is docs/limits.md
Run it as a logging backend: syslog, OTLP and Loki push in, Grafana out, every line marked verified docs/backend.md
Run a host other people reach docs/self-host.md
Load the module into an overlay host you already run docs/host.md
Implement a compatible producer, reader or host docs/spec.md (the specification), docs/frozen.md

Install

go install github.com/lightwebinc/blogs/cmd/blogs@latest      # Go 1.27.2 or later
Release binaries static blogs for Linux and macOS (amd64, arm64) on the releases page, each tarball with its licenses, plus SHA256SUMS
Container docker run --rm -v blogs-home:/home/nonroot/.blogs ghcr.io/lightwebinc/blogs doctor (the command), ghcr.io/lightwebinc/blogs-host (a host), ghcr.io/lightwebinc/blogs-devchain (the local development chain)
Source make blogs into bin/blogs
A host of your own deploy/compose.yaml (docs/self-host.md)

Build and test

(cd host && npm ci)    # once: the host module's toolchain (Node 24)
make verify            # what CI runs: format, vet, dependency set, licenses, typecheck, vectors, tests under -race
make lint              # golangci-lint
make docker-build      # the command's and the local chain's images
make docker-smoke      # both images, offline and together
make e2e-client  REFERENCE_HOST=/path/to/host   # the command against two reference hosts (plane-style)
make e2e-unicast REFERENCE_HOST=/path/to/host   # the same in unicast mode
make e2e-backend REFERENCE_HOST=/path/to/host   # the logging backend against three reference hosts
make quickstart-check  # QUICKSTART.md, run as written, in Docker Compose

NODE=/path/to/node selects a Node 24 binary that is not on PATH. Two direct Go dependencies, both pinned exactly and asserted by make verify: go-sdk and bcommon (with its devkit module, used only by tests and the development commands), whose TypeScript package at the same version is vendored under host/vendor. Moving bcommon, the vectors and the end-to-end targets are described in docs/usage.md.

Security

Report a vulnerability privately: SECURITY.md.

License

Apache-2.0 (LICENSE). One dependency is under the Open BSV License Version 5, whose grant is revocable and which limits use to the BSV blockchains; NOTICE explains, and LICENSE-THIRD-PARTY carries every license text.

Directories

Path Synopsis
cmd
blogs command
Command blogs is a producer and reader of blogs log streams: it creates a producer home and a stream, turns lines from stdin or a followed file into signed batches published on the stream's topic, anchors them in one mined token per interval, retracts batches by sweeping their funding outputs, and reads, audits, backfills and archives streams from overlay hosts, checking every answer itself.
Command blogs is a producer and reader of blogs log streams: it creates a producer home and a stream, turns lines from stdin or a followed file into signed batches published on the stream's topic, anchors them in one mined token per interval, retracts batches by sweeping their funding outputs, and reads, audits, backfills and archives streams from overlay hosts, checking every answer itself.
devchain command
Command devchain is a local stand-in chain for trying blogs 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 blogs 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).
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
archive
Package archive is a storage adapter for one overlay host: it follows the host's ls_log answers for one producer's stream, checks every answer as a reader does, and writes the batches, the canonical anchor tokens and the proof of each interval to local files, so that the stream outlives the host and an interval can be proved from the files alone.
Package archive is a storage adapter for one overlay host: it follows the host's ls_log answers for one producer's stream, checks every answer as a reader does, and writes the batches, the canonical anchor tokens and the proof of each interval to local files, so that the stream outlives the host and an interval can be proved from the files alone.
config
Package config resolves the blogs command's settings: flags, then BLOGS_* in the environment, then the config file, then the built-in default.
Package config resolves the blogs command's settings: flags, then BLOGS_* in the environment, then the config file, then the built-in default.
gateway
Package gateway is the read gateway: a Loki API in front of a stock Loki that marks every line it returns verified or unverified, checked against the interval roots an archive holds, and answers each stream's coverage (intervals proven, holes, retraction receipts).
Package gateway is the read gateway: a Loki API in front of a stock Loki that marks every line it returns verified or unverified, checked against the interval roots an archive holds, and answers each stream's coverage (intervals proven, holes, retraction receipts).
ingest
Package ingest is the provenance sidecar's engine: it turns what log shippers send (syslog over TCP or TLS, OTLP logs over HTTP, Loki push) into records, writes each record as one line in the line form, batches the lines onto blogs streams through the producer engine, and forwards each published line, with where it was published, to a log store.
Package ingest is the provenance sidecar's engine: it turns what log shippers send (syslog over TCP or TLS, OTLP logs over HTTP, Loki push) into records, writes each record as one line in the line form, batches the lines onto blogs streams through the producer engine, and forwards each published line, with where it was published, to a log store.
limits
Package limits is the blogs command's policy limits: the defaults and hard caps of docs/limits.md, and the checks that apply them to a producer's and a reader's settings.
Package limits is the blogs command's policy limits: the defaults and hard caps of docs/limits.md, and the checks that apply them to a producer's and a reader's settings.
logrec
Package logrec is the byte-level contract of a blogs log stream: the batch record a carrier holds, the digest-only locator, the interval anchor record a mined token holds, and the RFC 6962 leaf rule an anchor's root is computed by, and the topic manager's transaction rules (Admit): which output claims a record, and the carrier, anchor token and funding rules in their refusal order.
Package logrec is the byte-level contract of a blogs log stream: the batch record a carrier holds, the digest-only locator, the interval anchor record a mined token holds, and the RFC 6962 leaf rule an anchor's root is computed by, and the topic manager's transaction rules (Admit): which output claims a record, and the carrier, anchor token and funding rules in their refusal order.
metrics
Package metrics is a small set of counters and gauges written in the Prometheus text exposition format: what the sidecar and the read gateway count, including the metering counters billing reads (docs/backend.md).
Package metrics is a small set of counters and gauges written in the Prometheus text exposition format: what the sidecar and the read gateway count, including the metering counters billing reads (docs/backend.md).
produce
Package produce is a blogs producer: it turns batches of log lines into signed carriers on one stream, publishes each once, and anchors the stream's batches in one mined token per interval (docs/spec.md sections 3 to 6 and 12).
Package produce is a blogs producer: it turns batches of log lines into signed carriers on one stream, publishes each once, and anchors the stream's batches in one mined token per interval (docs/spec.md sections 3 to 6 and 12).
reader
Package reader asks overlay hosts the three ls_log questions and checks every answer itself (docs/spec.md sections 7.2 and 13): a batch carrier's rules, its funding parent's proof against the reader's own headers, an anchor token's rules and its proof, a funding tree's txid and proof, the chain of anchors and an interval's root.
Package reader asks overlay hosts the three ls_log questions and checks every answer itself (docs/spec.md sections 7.2 and 13): a batch carrier's rules, its funding parent's proof against the reader's own headers, an anchor token's rules and its proof, a funding tree's txid and proof, the chain of anchors and an interval's root.
state
Package state is a producer's durable record of one stream: its head (seq and commitment), the carrier persisted before it is published, the commitments not yet anchored, the anchor chain's head and the anchor in flight, and the funding trees carriers and anchors spend.
Package state is a producer's durable record of one stream: its head (seq and commitment), the carrier persisted before it is published, the commitments not yet anchored, the anchor chain's head and the anchor in flight, and the funding trees carriers and anchors spend.
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.
vectors
Package vectors generates the golden vectors under testdata/vectors from the logrec codec.
Package vectors generates the golden vectors under testdata/vectors from the logrec codec.
Package module is the blogs overlay module in Go: `tm_log_<name>_<suffix>` for each configured stream and `ls_log` 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 blogs overlay module in Go: `tm_log_<name>_<suffix>` for each configured stream and `ls_log` 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.

Jump to

Keyboard shortcuts

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