Versions in this module Expand all Collapse all v0 v0.0.4 Aug 2, 2023 v0.0.3 Aug 1, 2023 Changes in this version + const MaxPsbtKeyLength + const MaxPsbtValueLength + const MinTxVersion + const SignFinalized + const SignInvalid + const SignSuccesful + var ErrDuplicateKey = errors.New("Invalid Psbt due to duplicate key") + var ErrIncompletePSBT = errors.New(...) + var ErrInputAlreadyFinalized = errors.New(...) + var ErrInvalidKeyData = errors.New("Invalid key data") + var ErrInvalidMagicBytes = errors.New(...) + var ErrInvalidPrevOutNonWitnessTransaction = errors.New(...) + var ErrInvalidPsbtFormat = errors.New("Invalid PSBT serialization format") + var ErrInvalidRawTxSigned = errors.New(...) + var ErrInvalidSigHashFlags = errors.New("Invalid Sighash Flags") + var ErrInvalidSignatureForInput = errors.New(...) + var ErrNotFinalizable = errors.New("PSBT is not finalizable") + var ErrUnsupportedScriptType = errors.New("Unsupported script type") + func Extract(p *Packet) (*wire.MsgTx, error) + func Finalize(p *Packet, inIndex int) error + func InPlaceSort(packet *Packet) error + func InputsReadyToSign(packet *Packet) error + func MaybeFinalize(p *Packet, inIndex int) (bool, error) + func MaybeFinalizeAll(p *Packet) error + func ReadBip32Derivation(path []byte) (uint32, []uint32, error) + func SerializeBIP32Derivation(masterKeyFingerprint uint32, bip32Path []uint32) []byte + func SerializeTaprootBip32Derivation(d *TaprootBip32Derivation) ([]byte, error) + func SumUtxoInputValues(packet *Packet) (int64, error) + func TxOutsEqual(out1, out2 *wire.TxOut) bool + func VerifyInputOutputLen(packet *Packet, needInputs, needOutputs bool) error + func VerifyInputPrevOutpointsEqual(ins1, ins2 []*wire.TxIn) error + func VerifyOutputsEqual(outs1, outs2 []*wire.TxOut) error + func WriteTxWitness(w io.Writer, wit [][]byte) error + type Bip32Derivation struct + Bip32Path []uint32 + MasterKeyFingerprint uint32 + PubKey []byte + type Bip32Sorter []*Bip32Derivation + func (s Bip32Sorter) Len() int + func (s Bip32Sorter) Less(i, j int) bool + func (s Bip32Sorter) Swap(i, j int) + type GlobalType uint8 + const ProprietaryGlobalType + const UnsignedTxType + const VersionType + const XpubType + type InputType uint32 + const Bip32DerivationInputType + const FinalScriptSigType + const FinalScriptWitnessType + const NonWitnessUtxoType + const PartialSigType + const ProprietaryInputType + const RedeemScriptInputType + const SighashType + const TaprootBip32DerivationInputType + const TaprootInternalKeyInputType + const TaprootKeySpendSignatureType + const TaprootLeafScriptType + const TaprootMerkleRootType + const TaprootScriptSpendSignatureType + const WitnessScriptInputType + const WitnessUtxoType + type OutputType uint32 + const Bip32DerivationOutputType + const RedeemScriptOutputType + const TaprootBip32DerivationOutputType + const TaprootInternalKeyOutputType + const TaprootTapTreeType + const WitnessScriptOutputType + type PInput struct + Bip32Derivation []*Bip32Derivation + FinalScriptSig []byte + FinalScriptWitness []byte + NonWitnessUtxo *wire.MsgTx + PartialSigs []*PartialSig + RedeemScript []byte + SighashType txscript.SigHashType + TaprootBip32Derivation []*TaprootBip32Derivation + TaprootInternalKey []byte + TaprootKeySpendSig []byte + TaprootLeafScript []*TaprootTapLeafScript + TaprootMerkleRoot []byte + TaprootScriptSpendSig []*TaprootScriptSpendSig + Unknowns []*Unknown + WitnessScript []byte + WitnessUtxo *wire.TxOut + func NewPsbtInput(nonWitnessUtxo *wire.MsgTx, witnessUtxo *wire.TxOut) *PInput + func (pi *PInput) IsSane() bool + type POutput struct + Bip32Derivation []*Bip32Derivation + RedeemScript []byte + TaprootBip32Derivation []*TaprootBip32Derivation + TaprootInternalKey []byte + TaprootTapTree []byte + Unknowns []*Unknown + WitnessScript []byte + func NewPsbtOutput(redeemScript []byte, witnessScript []byte, bip32Derivation []*Bip32Derivation) *POutput + type Packet struct + Inputs []PInput + Outputs []POutput + Unknowns []*Unknown + UnsignedTx *wire.MsgTx + func New(inputs []*wire.OutPoint, outputs []*wire.TxOut, version int32, ...) (*Packet, error) + func NewFromRawBytes(r io.Reader, b64 bool) (*Packet, error) + func NewFromSignedTx(tx *wire.MsgTx) (*Packet, [][]byte, []wire.TxWitness, error) + func NewFromUnsignedTx(tx *wire.MsgTx) (*Packet, error) + func (p *Packet) B64Encode() (string, error) + func (p *Packet) GetTxFee() (btcutil.Amount, error) + func (p *Packet) IsComplete() bool + func (p *Packet) SanityCheck() error + func (p *Packet) Serialize(w io.Writer) error + type PartialSig struct + PubKey []byte + Signature []byte + type PartialSigSorter []*PartialSig + func (s PartialSigSorter) Len() int + func (s PartialSigSorter) Less(i, j int) bool + func (s PartialSigSorter) Swap(i, j int) + type SignOutcome int + type TaprootBip32Derivation struct + Bip32Path []uint32 + LeafHashes [][]byte + MasterKeyFingerprint uint32 + XOnlyPubKey []byte + func ReadTaprootBip32Derivation(xOnlyPubKey, value []byte) (*TaprootBip32Derivation, error) + func (s *TaprootBip32Derivation) SortBefore(other *TaprootBip32Derivation) bool + type TaprootScriptSpendSig struct + LeafHash []byte + SigHash txscript.SigHashType + Signature []byte + XOnlyPubKey []byte + func (s *TaprootScriptSpendSig) EqualKey(other *TaprootScriptSpendSig) bool + func (s *TaprootScriptSpendSig) SortBefore(other *TaprootScriptSpendSig) bool + type TaprootTapLeafScript struct + ControlBlock []byte + LeafVersion txscript.TapscriptLeafVersion + Script []byte + func FindLeafScript(pInput *PInput, targetLeafHash []byte) (*TaprootTapLeafScript, error) + func (s *TaprootTapLeafScript) SortBefore(other *TaprootTapLeafScript) bool + type Unknown struct + Key []byte + Value []byte + type Updater struct + Upsbt *Packet + func NewUpdater(p *Packet) (*Updater, error) + func (u *Updater) AddInBip32Derivation(masterKeyFingerprint uint32, bip32Path []uint32, pubKeyData []byte, ...) error + func (u *Updater) AddInNonWitnessUtxo(tx *wire.MsgTx, inIndex int) error + func (u *Updater) AddInRedeemScript(redeemScript []byte, inIndex int) error + func (u *Updater) AddInSighashType(sighashType txscript.SigHashType, inIndex int) error + func (u *Updater) AddInWitnessScript(witnessScript []byte, inIndex int) error + func (u *Updater) AddInWitnessUtxo(txout *wire.TxOut, inIndex int) error + func (u *Updater) AddOutBip32Derivation(masterKeyFingerprint uint32, bip32Path []uint32, pubKeyData []byte, ...) error + func (u *Updater) AddOutRedeemScript(redeemScript []byte, outIndex int) error + func (u *Updater) AddOutWitnessScript(witnessScript []byte, outIndex int) error + func (u *Updater) Sign(inIndex int, sig []byte, pubKey []byte, redeemScript []byte, ...) (SignOutcome, error)