mweb

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: ISC Imports: 18 Imported by: 7

Documentation

Index

Constants

View Source
const (
	BaseMwebFee = 100

	BaseKernelWeight        = 2
	StealthExcessWeight     = 1
	KernelWithStealthWeight = BaseKernelWeight + StealthExcessWeight

	BaseOutputWeight           = 17
	StandardOutputFieldsWeight = 1
	StandardOutputWeight       = BaseOutputWeight + StandardOutputFieldsWeight

	// For any extra data added to inputs, outputs or kernels
	BytesPerWeight = 42
)

Variables

This section is empty.

Functions

func EstimateFee

func EstimateFee(outputs []*wire.TxOut,
	feeRatePerKb ltcutil.Amount, includeChange bool) uint64

func NewPegin

func NewPegin(value uint64, kernel *wire.MwebKernel) *wire.TxOut

func VerifyHeader

func VerifyHeader(mwebHeader *wire.MsgMwebHeader) error

func VerifyLeafset

func VerifyLeafset(mwebHeader *wire.MsgMwebHeader,
	mwebLeafset *wire.MsgMwebLeafset) error

func VerifyUtxos

func VerifyUtxos(mwebHeader *wire.MwebHeader,
	leafset *Leafset, mwebUtxos *wire.MsgMwebUtxos) bool

Types

type Coin

type Coin struct {
	// The private key needed in order to spend the coin.
	// Will be nil for watch-only wallets.
	// May be nil for locked wallets. Upon unlock, SpendKey will get populated.
	SpendKey *mw.SecretKey

	// The blinding factor of the coin's output.
	// May be nil for watch-only wallets.
	Blind *mw.BlindingFactor

	// The output amount in litoshis.
	// Typically positive, but could be 0 in the future
	// when we start using decoys to improve privacy.
	Value uint64

	// The output's ID (hash).
	OutputId *chainhash.Hash

	// The ephemeral private key used by the sender to create the output.
	// This will only be populated when the coin has flag HAS_SENDER_INFO.
	SenderKey *mw.SecretKey

	// The StealthAddress the coin was sent to.
	// This will only be populated when the coin has flag HAS_SENDER_INFO.
	Address *mw.StealthAddress

	// The shared secret used to generate the output key.
	// By storing this, we are able to postpone calculation of the spend key.
	// This allows us to scan for outputs while wallet is locked, and recalculate
	// the output key once the wallet becomes unlocked.
	SharedSecret *mw.SecretKey
}

Represents an output owned by the wallet, or one sent by the wallet.

func NewTransaction

func NewTransaction(coins []*Coin, recipients []*Recipient,
	fee, pegin uint64, pegouts []*wire.TxOut) (
	tx *wire.MwebTx, newCoins []*Coin, err error)

func RewindOutput

func RewindOutput(output *wire.MwebOutput,
	scanSecret *mw.SecretKey) (coin *Coin, err error)

func (*Coin) CalculateOutputKey

func (coin *Coin) CalculateOutputKey(spendKey *mw.SecretKey)

type Keychain

type Keychain struct {
	Scan, Spend *mw.SecretKey
	SpendPubKey *mw.PublicKey
}

func (*Keychain) Address

func (k *Keychain) Address(index uint32) *mw.StealthAddress

func (*Keychain) SpendKey

func (k *Keychain) SpendKey(index uint32) *mw.SecretKey

type Leafset

type Leafset struct {
	Bits   []byte
	Size   uint64
	Height uint32
	Block  *wire.BlockHeader
}

func (*Leafset) Contains

func (l *Leafset) Contains(i uint64) bool

func (*Leafset) Deserialize

func (l *Leafset) Deserialize(r io.Reader) error

func (*Leafset) Serialize

func (l *Leafset) Serialize(w io.Writer) error

type Recipient

type Recipient struct {
	Value   uint64
	Address *mw.StealthAddress
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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