txutils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2025 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ANCHOR_PKSCRIPT = []byte{
		0x51, 0x02, 0x4e, 0x73,
	}
	ANCHOR_VALUE = int64(0)
)
View Source
var (
	COSIGNER_PSBT_KEY_PREFIX     = []byte("cosigner")
	CONDITION_WITNESS_KEY_PREFIX = []byte("condition")
	VTXO_TREE_EXPIRY_PSBT_KEY    = []byte("expiry")
	VTXO_TAPROOT_TREE_KEY        = []byte("taptree")
)

Functions

func AddConditionWitness

func AddConditionWitness(inIndex int, ptx *psbt.Packet, witness wire.TxWitness) error

func AddCosignerKey

func AddCosignerKey(inIndex int, ptx *psbt.Packet, key *btcec.PublicKey) error

func AddTaprootTree

func AddTaprootTree(inIndex int, ptx *psbt.Packet, leaves []string) error

AddTaprootTree adds the whole taproot tree of the VTXO to the given PSBT input. it follows the format of PSBT_OUT_TAP_TREE / BIP-371

func AddVtxoTreeExpiry

func AddVtxoTreeExpiry(
	inIndex int, ptx *psbt.Packet, vtxoTreeExpiry common.RelativeLocktime,
) error

func AnchorOutput

func AnchorOutput() *wire.TxOut

func ExtractWithAnchors

func ExtractWithAnchors(p *psbt.Packet) (*wire.MsgTx, error)

ExtractWithAnchors extracts the final witness and scriptSig from psbt fields and ignores anchor inputs without failing.

func FindAnchorOutpoint

func FindAnchorOutpoint(tx *wire.MsgTx) (*wire.OutPoint, error)

func GetConditionWitness

func GetConditionWitness(in psbt.PInput) (wire.TxWitness, error)

func GetCosignerKeys

func GetCosignerKeys(in psbt.PInput) ([]*btcec.PublicKey, error)

func GetTaprootTree

func GetTaprootTree(in psbt.PInput) ([]string, error)

GetTaprootTree returns the taproot tree of the given PSBT input.

func GetVtxoTreeExpiry

func GetVtxoTreeExpiry(in psbt.PInput) (*common.RelativeLocktime, error)

func ReadTxWitness

func ReadTxWitness(witnessSerialized []byte) (wire.TxWitness, error)

Types

type TapTree

type TapTree []string

TapTree is a wrapper around a list of tapscripts it is used to encode and decode the taproot tree in a way that is compatible with the PSBT_OUT_TAP_TREE field / BIP-371

func DecodeTapTree

func DecodeTapTree(data []byte) (TapTree, error)

func (TapTree) Encode

func (t TapTree) Encode() ([]byte, error)

Jump to

Keyboard shortcuts

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