singlesig

package
v0.2.2-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingNetwork           = fmt.Errorf("missing network")
	ErrMissingMnemonic          = fmt.Errorf("missing mnemonic")
	ErrMissingSigningMasterKey  = fmt.Errorf("missing signing master key")
	ErrMissingBlindingMasterKey = fmt.Errorf("missing blinding master key")
	ErrMissingDerivationPath    = fmt.Errorf("missing derivation path")
	ErrMissingOutputScript      = fmt.Errorf("missing output script")
	ErrMissingPset              = fmt.Errorf("missing pset base64")
	ErrMissingDerivationPaths   = fmt.Errorf("missing derivation path map")

	ErrInvalidMnemonic                = fmt.Errorf("blinding mnemonic is invalid")
	ErrInvalidRootPathLen             = fmt.Errorf("invalid root path length, must be in the form \"m/purpose'/coin_type'\"")
	ErrInvalidRootPath                = fmt.Errorf("root path must contain only hardended values")
	ErrRequiredAbsoluteDerivationPath = fmt.Errorf("path must be an absolute derivation starting with 'm/'")
	ErrInvalidDerivationPathLength    = fmt.Errorf("derivation path must be a relative path in the form \"account'/branch/index\"")
	ErrInvalidDerivationPathAccount   = fmt.Errorf("derivation path's account (first elem) must be hardened (suffix ')")
	ErrInvalidSignatures              = fmt.Errorf("transaction contains invalid signature(s)")

	ErrMalformedDerivationPath         = fmt.Errorf("path must not start or end with a '/'")
	ErrOutOfRangeDerivationPathAccount = fmt.Errorf("account index must be in hardened range [0', %d']", hdkeychain.HardenedKeyStart-1)

	ErrMissingPrevOuts        = fmt.Errorf("missing prevouts")
	ErrMissingInputs          = fmt.Errorf("at least one input is mandatory to create a partial transaction with one or more confidential outputs")
	ErrMissingOwnedInputs     = fmt.Errorf("missing list of owned inputs")
	ErrBlindInvalidInputIndex = fmt.Errorf("input index to blind is out of range")
	ErrMissingRootPath        = fmt.Errorf("missing root derivation path")
)

Functions

This section is empty.

Types

type DeriveAddressArgs added in v0.1.18

type DeriveAddressArgs struct {
	DerivationPath string
	Network        *network.Network
	Unconf         bool
}

type DeriveBlindingKeyPairArgs

type DeriveBlindingKeyPairArgs struct {
	Script []byte
}

type DeriveSigningKeyPairArgs

type DeriveSigningKeyPairArgs struct {
	DerivationPath string
}

type ExtendedKeyArgs

type ExtendedKeyArgs struct {
	Account uint32
}

type NewWalletArgs

type NewWalletArgs struct {
	RootPath string
}

type NewWalletFromMnemonicArgs

type NewWalletFromMnemonicArgs struct {
	RootPath string
	Mnemonic []string
}

type SignPsetArgs

type SignPsetArgs struct {
	PsetBase64        string
	DerivationPathMap map[string]string
	SigHashType       txscript.SigHashType
}

type SignTaprootArgs added in v0.2.2

type SignTaprootArgs struct {
	PsetBase64        string
	DerivationPathMap map[string]string
	GenesisBlockHash  string
	SighashType       txscript.SigHashType
}

type SignTransactionArgs

type SignTransactionArgs struct {
	TxHex        string
	InputsToSign map[uint32]wallet.Input
	SigHashType  txscript.SigHashType
}

type Wallet

type Wallet struct {
	// contains filtered or unexported fields
}

Wallet is the data structure representing an HD wallet of an Elements based network.

func NewWallet

func NewWallet(args NewWalletArgs) (*Wallet, error)

NewWallet creates a new HD wallet with a random mnemonic

func NewWalletFromMnemonic

func NewWalletFromMnemonic(args NewWalletFromMnemonicArgs) (*Wallet, error)

NewWalletFromMnemonic creates a new HD wallet with the given mnemonic seed and root path

func (*Wallet) AccountExtendedPrivateKey

func (w *Wallet) AccountExtendedPrivateKey(args ExtendedKeyArgs) (string, error)

AccountExtendedPrivateKey returns the extended private key in base58 format for the given account index.

func (*Wallet) AccountExtendedPublicKey

func (w *Wallet) AccountExtendedPublicKey(args ExtendedKeyArgs) (string, error)

AccountExtendedPublicKey returns the extended public key in base58 format for the given account index.

func (*Wallet) DeriveAddress added in v0.1.18

func (w *Wallet) DeriveAddress(
	args DeriveAddressArgs,
) (string, []byte, error)

DeriveAddress derives either a confidential or unconfidential address for the given derivation path.

func (*Wallet) DeriveBlindingKeyPair

func (w *Wallet) DeriveBlindingKeyPair(
	args DeriveBlindingKeyPairArgs,
) (*btcec.PrivateKey, *btcec.PublicKey, error)

DeriveBlindingKeyPair derives the SLIP77 blinding key pair from the given output script.

func (*Wallet) DeriveSigningKeyPair

func (w *Wallet) DeriveSigningKeyPair(args DeriveSigningKeyPairArgs) (
	*btcec.PrivateKey, *btcec.PublicKey, error,
)

DeriveSigningKeyPair derives the key pair from the given derivation path.

func (*Wallet) MasterBlindingKey

func (w *Wallet) MasterBlindingKey() (string, error)

MasterBlindingKey returns the SLIP-77 master blinding key of the wallet in hex format.

func (*Wallet) Mnemonic

func (w *Wallet) Mnemonic() ([]string, error)

Mnemonic returns the mnemonic of the wallet.

func (*Wallet) SignPset

func (w *Wallet) SignPset(args SignPsetArgs) (string, error)

SignPset signs all inputs of a partial transaction matching the given scripts of the derivation path map.

func (*Wallet) SignTaproot added in v0.2.2

func (w *Wallet) SignTaproot(args SignTaprootArgs) (string, error)

func (*Wallet) SignTransaction

func (w *Wallet) SignTransaction(args SignTransactionArgs) (string, error)

SignTransaction signs all requested inputs of the given raw transaction.

Jump to

Keyboard shortcuts

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