wallet

package
v0.0.0-...-7c1506c Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WitnessScaleFactor = 4

Functions

func CountSigOps

func CountSigOps(tx *btcutil.Tx) int

CountSigOps returns the number of signature operations for all transaction input and output scripts in the provided transaction. This uses the quicker, but imprecise, signature operation counting mechanism from txscript.

func DirectWPKHScriptFromPKH

func DirectWPKHScriptFromPKH(pkh [20]byte) []byte

Types

type BalanceResponse

type BalanceResponse struct {
	Spendable uint64 `json:"confirmed"`
	Maturing  uint64 `json:"maturing"`
}

type Utxo

type Utxo struct {
	TxID   string `json:"txid"`
	Vout   uint   `json:"vout"`
	Amount uint64 `json:"satoshis"`
}

type Wallet

type Wallet struct {
	Address   string
	Script    []byte
	Spendable uint64
	Maturing  uint64
	// contains filtered or unexported fields
}

func NewWallet

func NewWallet(addr string, script []byte) (*Wallet, error)

func (*Wallet) CountP2SHSigOps

func (w *Wallet) CountP2SHSigOps(tx *btcutil.Tx, isCoinBaseTx bool) (int, error)

CountP2SHSigOps returns the number of signature operations for all input transactions which are of the pay-to-script-hash type. This uses the precise, signature operation counting mechanism from the script engine which requires access to the input transaction scripts.

func (*Wallet) GetBalance

func (w *Wallet) GetBalance() (bal uint64, balImmature uint64)

GetBalance will scan the utxos in the wallet and return two values: mature and immature balance. Mining outputs need to wait for 101 confirmations before being allowed to spend

func (*Wallet) GetSigOpCost

func (w *Wallet) GetSigOpCost(tx *btcutil.Tx, pkScript []byte, isCoinBaseTx bool, bip16, segWit bool) (int, error)

func (*Wallet) PrepareSweep

func (w *Wallet) PrepareSweep(addr string) ([]*wire.MsgTx, error)

func (*Wallet) Send

func (w *Wallet) Send(tx *wire.MsgTx) (string, error)

func (*Wallet) SignMyInputs

func (w *Wallet) SignMyInputs(tx *wire.MsgTx, password string) error

SignMyInputs finds the inputs in a transaction that came from our own wallet, and signs them with our private keys. Will modify the transaction in place, but will ignore inputs that we can't sign and leave them unsigned.

func (*Wallet) Update

func (w *Wallet) Update()

Update will reload balance from the backend

func (*Wallet) Utxos

func (w *Wallet) Utxos() ([]Utxo, error)

Jump to

Keyboard shortcuts

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