psbt

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract

func Extract(p *Packet) (*wire.MsgTx, error)

func MaybeFinalize

func MaybeFinalize(p *Packet, inIndex int) (bool, error)

func MaybeFinalizeAll

func MaybeFinalizeAll(p *Packet) error

func SerializeBIP32Derivation added in v0.6.0

func SerializeBIP32Derivation(masterKeyFingerprint uint32,
	bip32Path []uint32) []byte

SerializeBIP32Derivation takes a master key fingerprint as defined in BIP32, along with a path specified as a list of uint32 values, and returns a bytestring specifying the derivation in the format required by BIP174: // master key fingerprint (4) || child index (4) || child index (4) || ....

func SumUtxoInputValues added in v0.5.0

func SumUtxoInputValues(packet *Packet) (int64, error)

SumUtxoInputValues tries to extract the sum of all inputs specified in the UTXO fields of the PSBT. An error is returned if an input is specified that does not contain any UTXO information.

func TxOutsEqual added in v0.5.0

func TxOutsEqual(out1, out2 *wire.TxOut) bool

TxOutsEqual returns true if two transaction outputs are equal.

func VerifyInputPrevOutpointsEqual added in v0.5.0

func VerifyInputPrevOutpointsEqual(ins1, ins2 []*wire.TxIn) error

VerifyInputPrevOutpointsEqual verifies that the previous outpoints of the two slices of transaction inputs are deep equal to each other. We do the length check and manual loop to provide better error messages to the user than just returning "not equal".

func VerifyOutputsEqual added in v0.5.0

func VerifyOutputsEqual(outs1, outs2 []*wire.TxOut) error

VerifyOutputsEqual verifies that the two slices of transaction outputs are deep equal to each other. We do the length check and manual loop to provide better error messages to the user than just returning "not equal".

Types

type Bip32Derivation added in v0.6.0

type Bip32Derivation struct {
	// PubKey is the raw pubkey serialized in compressed format.
	PubKey []byte

	// MasterKeyFingerprint is the finger print of the master pubkey.
	MasterKeyFingerprint uint32

	// Bip32Path is the BIP 32 path with child index as a distinct integer.
	Bip32Path []uint32
}

Bip32Derivation encapsulates the data for the input and output Bip32Derivation key-value fields.

TODO(roasbeef): use hdkeychain here instead?

type Bip32Sorter added in v0.6.0

type Bip32Sorter []*Bip32Derivation

Bip32Sorter implements sort.Interface for the Bip32Derivation struct.

func (Bip32Sorter) Len added in v0.6.0

func (s Bip32Sorter) Len() int

func (Bip32Sorter) Less added in v0.6.0

func (s Bip32Sorter) Less(i, j int) bool

func (Bip32Sorter) Swap added in v0.6.0

func (s Bip32Sorter) Swap(i, j int)

type PInput

type PInput struct {
	WitnessUtxo        *wire.TxOut
	NonWitnessUtxo     *wire.MsgTx
	FinalScriptSig     []byte
	FinalScriptWitness []byte
	Bip32Derivation    []*Bip32Derivation
	SighashType        txscript.SigHashType
	PartialSigs        []*PartialSig
	RedeemScript       []byte
	WitnessScript      []byte
}

type POutput

type POutput struct{}

type Packet

type Packet struct {
	UnsignedTx *wire.MsgTx
	Inputs     []PInput
	Outputs    []POutput
}

func New

func New(inputs []*wire.OutPoint,
	outputs []*wire.TxOut, version int32, nLockTime uint32,
	nSequences []uint32) (*Packet, error)

func NewFromRawBytes

func NewFromRawBytes(r io.Reader, b64 bool) (*Packet, error)

func NewFromUnsignedTx

func NewFromUnsignedTx(tx *wire.MsgTx) (*Packet, error)

func (*Packet) Serialize

func (p *Packet) Serialize(w io.Writer) error

type PartialSig added in v0.6.0

type PartialSig struct {
	PubKey    []byte
	Signature []byte
}

PartialSig encapsulate a (BTC public key, ECDSA signature) pair, note that the fields are stored as byte slices, not btcec.PublicKey or btcec.Signature (because manipulations will be with the former not the latter, here); compliance with consensus serialization is enforced with .checkValid()

type PartialSigSorter added in v0.6.0

type PartialSigSorter []*PartialSig

PartialSigSorter implements sort.Interface for PartialSig.

func (PartialSigSorter) Len added in v0.6.0

func (s PartialSigSorter) Len() int

func (PartialSigSorter) Less added in v0.6.0

func (s PartialSigSorter) Less(i, j int) bool

func (PartialSigSorter) Swap added in v0.6.0

func (s PartialSigSorter) Swap(i, j int)

Jump to

Keyboard shortcuts

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