Documentation
¶
Overview ¶
Package bcommon is the root of a library of building blocks for BSV overlay applications that publish and verify committed records: a deterministic CBOR codec, RFC 6962 roots, store references and manifests, BRC-42/43 derivation and tagged PushDrop outputs, a non-final carrier that commits a payload to the chain, transaction builders with a fee loop, funding-tree state, node, arcade and wallet clients, the producer's orchestration of fees, funding trees and proofs around them, a header source, host sets with quorum fan-out, BRC-24 lookup, BRC-169 and BRC-180 resolution, a pinned-key file, SPV verdicts, a payee's ledger and settle run, and a filter for text that reaches a terminal. Each subdirectory that holds Go code is one package; this root package holds no code of its own.
An application supplies what makes these packages its own: the payload schema, the derivation protocol and key ids, the output tags, the wallet profile, the RPC id and the pin file's header all arrive as parameters rather than defaults. A default derivation or wallet profile would quietly re-key an application that forgot to pass one.
testdata is not a package. Its fixtures directory holds response bodies vendored from the services the network packages talk to, and its vectors directory the vectors an independent generator (tools/vectors) writes, which the packages' tests compare their own output against byte for byte. Both are kept at the root so every package reads them by the same relative path.
Imports ¶
Every package here, in production code and in tests, imports only the standard library, github.com/bsv-blockchain/go-sdk and other packages of this module. One outside dependency is what an application pinning this library takes on, so a second one would be a cost to every application at once. TestBoundary and TestBoundaryFiles enforce the rule. The vector generator in tools/vectors is a separate module that nothing here imports, held to a rule of its own: it may add an independent CBOR encoder, and it may never import this module.
Nor does any package take on what belongs to an application's command: flags, logging, the environment, the user's configuration directories, the standard streams, other processes or the process's exit. Settings and output arrive as parameters. TestNoProcessConcerns enforces it.
Versioning ¶
The library is pre-1.0. An application pins an exact tag and moves to a newer one deliberately, because a v0 minor version may change the API.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package acceptance decides how much evidence a payment needs before the receiver acts on it, and gathers that evidence.
|
Package acceptance decides how much evidence a payment needs before the receiver acts on it, and gathers that evidence. |
|
Package bwallet is an embedded BRC-100 wallet backend for an application that publishes on chain, and the Signer through which such an application signs with it or with any other wallet.Interface.
|
Package bwallet is an embedded BRC-100 wallet backend for an application that publishes on chain, and the Signer through which such an application signs with it or with any other wallet.Interface. |
|
Package carrier is an object's transport: one transaction that is never mined, whose record output holds the object's payload as a signed PushDrop [payload] under the producer's derivation, and whose txid is the commitment a mined token can carry.
|
Package carrier is an object's transport: one transaction that is never mined, whose record output holds the object's payload as a signed PushDrop [payload] under the producer's derivation, and whose txid is the commitment a mined token can carry. |
|
Package cbor is the deterministic CBOR that committed records are written in.
|
Package cbor is the deterministic CBOR that committed records are written in. |
|
Package chaintoken reads and writes the BEEF a host admits a mined chain token in, and the token's own output.
|
Package chaintoken reads and writes the BEEF a host admits a mined chain token in, and the token's own output. |
|
Package chainview answers, from the network's own words and the node's view of outputs, whether a transaction can still mine: what a settlement leg's error means, and which input another transaction spent, in words over bcommon's view of the node (nodeapi.Asset.SpentElsewhere).
|
Package chainview answers, from the network's own words and the node's view of outputs, whether a transaction can still mine: what a settlement leg's error means, and which input another transaction spent, in words over bcommon's view of the node (nodeapi.Asset.SpentElsewhere). |
|
Package chirp is a codec for CHIRP (BRC-167) major version 1 and its chunking profile 1: the root and branch node encodings, the canonical construction of a closure from content, the verification of a closure fetched object by object, and the UHRP object identifier and CHIRP URL of a hash.
|
Package chirp is a codec for CHIRP (BRC-167) major version 1 and its chunking profile 1: the root and branch node encodings, the canonical construction of a closure from content, the verification of a closure fetched object by object, and the UHRP object identifier and CHIRP URL of a hash. |
|
Package commit computes RFC 6962 Merkle roots and inclusion paths: the root a store reference commits to, one per named store, over the commitments (carrier txids) of that store's members.
|
Package commit computes RFC 6962 Merkle roots and inclusion paths: the root a store reference commits to, one per named store, over the commitments (carrier txids) of that store's members. |
|
Package funding keeps a producer's funding tree between runs, and the transactions it published before they mined.
|
Package funding keeps a producer's funding tree between runs, and the transactions it published before they mined. |
|
Package goldentest holds the helpers a package's tests share when they check themselves against a committed test vector: a fixed test key, hex and transaction parsing that fail the test rather than return an error, and a chain tracker that knows only the roots the test hands it.
|
Package goldentest holds the helpers a package's tests share when they check themselves against a committed test vector: a fixed test key, hex and transaction parsing that fail the test rather than return an error, and a chain tracker that knows only the roots the test hands it. |
|
Package guard checks bytes someone else supplied before the SDK is allowed to allocate for them or to trust them: a BRC-74 BUMP, a BEEF (BRC-62, BRC-96, and the Atomic BEEF of BRC-95 around either), a raw transaction or the Extended Format (BRC-30) of one, and a compressed public key.
|
Package guard checks bytes someone else supplied before the SDK is allowed to allocate for them or to trust them: a BRC-74 BUMP, a BEEF (BRC-62, BRC-96, and the Atomic BEEF of BRC-95 around either), a raw transaction or the Extended Format (BRC-30) of one, and a compressed public key. |
|
Package headers is a chain tracker over a header source: an overlay bridge's native /v1 routes (github.com/lightwebinc/overlay-bridge), the public WhatsOnChain API, or a chaintracks v2 service.
|
Package headers is a chain tracker over a header source: an overlay bridge's native /v1 routes (github.com/lightwebinc/overlay-bridge), the public WhatsOnChain API, or a chaintracks v2 service. |
|
Package hostset chooses which address answers for an overlay host.
|
Package hostset chooses which address answers for an overlay host. |
|
Package keyed holds the part of BRC-369 keyed content that every application keyed under a random scalar shares: the content key, its symmetric key and its commitment (BRC-369 sections 2.1 and 2.2), the check a holder runs on a key it has just unwrapped, and BRC-2's symmetric form, in which a key is wrapped and a certificate field is encrypted.
|
Package keyed holds the part of BRC-369 keyed content that every application keyed under a random scalar shares: the content key, its symmetric key and its commitment (BRC-369 sections 2.1 and 2.2), the check a holder runs on a key it has just unwrapped, and BRC-2's symmetric form, in which a key is wrapped and a certificate field is encrypted. |
|
Package knownkeys reads and writes a pin store: the key each address was last seen with, one line per record.
|
Package knownkeys reads and writes a pin store: the key each address was last seen with, one line per record. |
|
Package lookup asks an overlay host a BRC-24 question and returns its output-list answer.
|
Package lookup asks an overlay host a BRC-24 question and returns its output-list answer. |
|
Package mint builds the mined transactions an application's state lives on: a transition of its state token, a funding tree, and a plain payment, each with a fee input and a change output supplied by the caller.
|
Package mint builds the mined transactions an application's state lives on: a transition of its state token, a funding tree, and a plain payment, each with a fee input and a change output supplied by the caller. |
|
Package nodeapi talks to a Teranode node over HTTP: JSON-RPC for mining and direct submission, the asset API for reading what got mined.
|
Package nodeapi talks to a Teranode node over HTTP: JSON-RPC for mining and direct submission, the asset API for reading what got mined. |
|
Package payee is the payee side of BRC-105 payments for priced questions: the payee key a host is configured with, the ledger in which a host's listener records each payment it accepted, and settle, which takes those payments into the payee's coin pool.
|
Package payee is the payee side of BRC-105 payments for priced questions: the payee key a host is configured with, the ledger in which a host's listener records each payment it accepted, and settle, which takes those payments into the payee's coin pool. |
|
Package producer is the orchestration a producer of committed records runs around the builders in mint and carrier: where the fee for a mined transaction comes from and where its change goes, the funding tree a carrier spends and when to mint the next one, the one copy of each transaction the producer keeps while it is unproven, and the collection of proofs for what was published before it mined.
|
Package producer is the orchestration a producer of committed records runs around the builders in mint and carrier: where the fee for a mined transaction comes from and where its change goes, the funding tree a carrier spends and when to mint the next one, the one copy of each transaction the producer keeps while it is unproven, and the collection of proofs for what was published before it mined. |
|
Package publish is the publisher's dual submission: one signed transaction, two encodings, two transports, and never one writer for both.
|
Package publish is the publisher's dual submission: one signed transaction, two encodings, two transports, and never one writer for both. |
|
Package purse is the two payment actions the embedded wallet does not implement, over the embedded wallet (the identity key and its coin pool): the client leg and the payee leg of a BRC-105 payment for a priced question.
|
Package purse is the two payment actions the embedded wallet does not implement, over the embedded wallet (the identity key and its coin pool): the client leg and the payee leg of a BRC-105 payment for a priced question. |
|
Package pushdrop is the key derivation an application locks its PushDrop outputs under, and the tagged PushDrop those outputs carry: a leading tag field, the application's own fields, and the wallet's signature over them.
|
Package pushdrop is the key derivation an application locks its PushDrop outputs under, and the tagged PushDrop those outputs carry: a leading tag field, the application's own fields, and the wallet's signature over them. |
|
Package record is the bounded, ordered reading of one application record: a canonical CBOR map with unsigned-integer keys, whose key 0 is the record's magic and whose keys above the last one a version defines are preserved and ignored.
|
Package record is the bounded, ordered reading of one application record: a canonical CBOR map with unsigned-integer keys, whose key 0 is the record's magic and whose keys above the last one a version defines are preserved and ignored. |
|
Package resolve turns a user@domain into an identity key and the overlay host that serves it, using only the two documents a domain publishes about itself: its BRC-180 manifest and its BRC-169 handle-resolution endpoint.
|
Package resolve turns a user@domain into an identity key and the overlay host that serves it, using only the two documents a domain publishes about itself: its BRC-180 manifest and its BRC-169 handle-resolution endpoint. |
|
Package sanitize filters text someone else wrote before a renderer shows it, in a terminal or on a web page, by one ordered set of character rules and one pinned Unicode property table, so that every implementation shows the same characters for the same value.
|
Package sanitize filters text someone else wrote before a renderer shows it, in a terminal or on a web page, by one ordered set of character rules and one pinned Unicode property table, so that every implementation shows the same characters for the same value. |
|
Package store is how a record commits to a set of other records and how a reader opens that set: the refs entry that names a store and commits to its root, the manifest that lists a store's members, and the rule that computes the root from the entry and the members' commitments.
|
Package store is how a record commits to a set of other records and how a reader opens that set: the refs entry that names a store and commits to its root, the manifest that lists a store's members, and the rule that computes the root from the entry and the members' commitments. |
|
Package termsafe filters text someone else wrote before it reaches a terminal, and checks text an application is about to publish against the same rules.
|
Package termsafe filters text someone else wrote before it reaches a terminal, and checks text an application is about to publish against the same rules. |
|
Package testchain is a local stand-in for the chain an application's tests and local trials run against: a chain that mines what it is sent, served as a node's JSON-RPC (generatetoaddress, sendrawtransaction, getinfo) and asset API, as an ARC-compatible broadcaster under /arcade, as a fabric ingress (Ingress), and as a header source in the overlay bridge's native shape (/v1/root/<height>, /v1/tip).
|
Package testchain is a local stand-in for the chain an application's tests and local trials run against: a chain that mines what it is sent, served as a node's JSON-RPC (generatetoaddress, sendrawtransaction, getinfo) and asset API, as an ARC-compatible broadcaster under /arcade, as a fabric ingress (Ingress), and as a header source in the overlay bridge's native shape (/v1/root/<height>, /v1/tip). |
|
Package verify is what a reader shares with every other reader: the outcome vocabulary it reports (codes.go), the verdict on one transaction against the reader's own headers (Check), and the check every carrier a host answers gets before a reader believes it (VerifyCarrier).
|
Package verify is what a reader shares with every other reader: the outcome vocabulary it reports (codes.go), the verdict on one transaction against the reader's own headers (Check), and the check every carrier a host answers gets before a reader believes it (VerifyCarrier). |
|
Package wirewallet reaches a BRC-100 wallet over the wallet wire, the binary substrate both SDKs implement, and answers the one question an application asks a wallet before anything else: whose identity is this.
|
Package wirewallet reaches a BRC-100 wallet over the wallet wire, the binary substrate both SDKs implement, and answers the one question an application asks a wallet before anything else: whose identity is this. |