mint

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package mint builds the two mined transactions of the design, the state token and the funding tree, through a wallet.Interface, with a fee input and a change output supplied by the caller.

The carrier is built by package carrier because it is never mined and pays no fee; the transactions here are mined, so they pay one. The builders and the fee loop that sets it are the library's (package mint of github.com/lightwebinc/bcommon), which takes lock scripts rather than deriving them; this package is finger's use of it, supplying the token lock and value, the default token unlocker and the funding lock, and keeps the API finger's callers were built on.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInsufficient = bcmint.ErrInsufficient
	ErrNoChange     = bcmint.ErrNoChange
)

The library's sentinels, the same values, so errors.Is matches either name.

View Source
var DefaultFees = bcmint.DefaultFees

DefaultFees is the network's rate, 100 satoshis per 1000 bytes, with a 100 satoshi floor and a 100/1000 cap: what a real transaction pays unless configured otherwise.

View Source
var LegacyFees = bcmint.LegacyFees

LegacyFees is one satoshi per byte with a 250 satoshi floor, the default before the network rate. The test vectors and goldens are built with it, so a change of default never moves a pinned byte.

Functions

func FundingTree

func FundingTree(ctx context.Context, w wallet.Interface, originator string, count int, sats uint64,
	fee Input, change *script.Script, fees Fees) (*transaction.Transaction, error)

FundingTree builds and signs a funding tree: count outputs of sats each, locked to the identity's record key, plus change. Each carrier spends one; one mined spend of any of them by the owner (the kill switch) is a transaction the caller builds with the same record unlocker.

func Payment

func Payment(ctx context.Context, dest *script.Script, sats uint64, fee Input, change *script.Script, fees Fees) (*transaction.Transaction, error)

Payment builds and signs a simple payment: one output of sats to dest, change back to the payer. It is the BRC-29 leg: the destination is a key derived from the recipient's identity, and the transaction itself is an ordinary P2PKH spend.

func Token

func Token(ctx context.Context, w wallet.Interface, originator string, c [32]byte,
	prev *Input, fee Input, change *script.Script, fees Fees) (*transaction.Transaction, error)

Token builds and signs a state token transaction for commitment c.

Inputs: the previous token output when prev is not nil (an update spends its predecessor; a create spends none), then the fee input. Outputs: the token at index 0, then change. Change below the fee floor is dropped rather than left as dust.

prev.Unlocker may be nil, in which case w signs the previous token under its own profile derivation. After a rotation it is NOT nil: the next token is locked to the successor but still spends a token locked to the predecessor, so the predecessor's wallet supplies the unlocker.

Types

type Fees

type Fees = bcmint.Fees

Fees is the fee policy: a rate (satoshis per bytes), a floor under it and the guards over it.

type Input

type Input = bcmint.Input

Input is one input the caller funds a transaction with: its source transaction, the output index, and the template that signs it.

Jump to

Keyboard shortcuts

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