codec

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeAltLeaves

func DecodeAltLeaves(encoded []byte) ([][]byte, error)

DecodeAltLeaves decodes a set of alt leaves from the minimal format used by tapd: varint leaf count followed by length-prefixed raw leaf bytes.

func DeriveBurnKey

func DeriveBurnKey(prevID PrevID) ([33]byte, error)

DeriveBurnKey derives a provably unspendable but unique key by tweaking the public NUMS key with a tap tweak:

burnTweak = h_tapTweak(NUMSKey || outPoint || assetID || scriptKeyXOnly)
burnKey = NUMSKey + burnTweak*G

func DeriveSTXOAltLeaves

func DeriveSTXOAltLeaves(prevIDs []PrevID) ([][]byte, error)

DeriveSTXOAltLeaves returns the raw alt-leaf TLV blobs for the STXO set implied by the given prev IDs. Each leaf is encoded with script version 0 and a burn-key derived from the prev ID.

func EncodeAltLeaf

func EncodeAltLeaf(scriptVersion uint16,
	scriptKey [33]byte) ([]byte, error)

EncodeAltLeaf encodes a single alt leaf as a TLV stream. The returned bytes are the per-leaf payloads carried inside the alt-leaves container format used by tapd.

func EncodeAltLeaves

func EncodeAltLeaves(leaves [][]byte) ([]byte, error)

EncodeAltLeaves serializes a list of alt leaves using the minimal format expected by tapd: varint leaf count followed by length-prefixed raw leaf bytes.

func ReadVarInt

func ReadVarInt(r io.Reader, scratch []byte) (uint64, error)

ReadVarInt reads a compactly encoded integer as defined by BIP-0174/LND TLV helpers.

func WriteVarInt

func WriteVarInt(w io.Writer, val uint64, scratch []byte) error

WriteVarInt writes val using the compact encoding defined by BIP-0174/LND TLV helpers.

Types

type Outpoint

type Outpoint struct {
	Txid  [32]byte
	Index uint32
}

Outpoint identifies the anchor outpoint for a previous asset input.

type PrevID

type PrevID struct {
	Outpoint   Outpoint
	IssuanceID [32]byte
	ScriptKey  [33]byte
}

PrevID contains the protocol fields needed for STXO burn key derivation.

Jump to

Keyboard shortcuts

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