Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateDecoys(numMixins int) []mlsag.PubKeys
- func GenerateInputs(_ byte, db *database.DB, totalAmount int64, key *key.Key) ([]*transactions.Input, int64, error)
- type FetchInputs
- type SignableTx
- type TxInChecker
- type Wallet
- func LoadFromFile(netPrefix byte, db *database.DB, fDecoys transactions.FetchDecoys, ...) (*Wallet, error)
- func LoadFromSeed(seed []byte, netPrefix byte, db *database.DB, fDecoys transactions.FetchDecoys, ...) (*Wallet, error)
- func New(Read func(buf []byte) (n int, err error), netPrefix byte, db *database.DB, ...) (*Wallet, error)
- func (w *Wallet) AddInputs(tx *transactions.Standard) error
- func (w *Wallet) Balance() (uint64, uint64, error)
- func (w *Wallet) CheckUnconfirmedBalance(txs []transactions.Transaction) (uint64, error)
- func (w *Wallet) CheckWireBlock(blk block.Block) (uint64, uint64, error)
- func (w *Wallet) CheckWireBlockReceived(blk block.Block) (uint64, error)
- func (w *Wallet) CheckWireBlockSpent(blk block.Block) (uint64, error)
- func (w *Wallet) ClearDatabase() error
- func (w *Wallet) FetchTxHistory() ([]txrecords.TxRecord, error)
- func (w *Wallet) GetSavedHeight() (uint64, error)
- func (w *Wallet) Keys() consensuskey.Keys
- func (w *Wallet) NewBidTx(fee int64, lockTime uint64, amount ristretto.Scalar) (*transactions.Bid, error)
- func (w *Wallet) NewStakeTx(fee int64, lockTime uint64, amount ristretto.Scalar) (*transactions.Stake, error)
- func (w *Wallet) NewStandardTx(fee int64) (*transactions.Standard, error)
- func (w *Wallet) PrivateSpend() ([]byte, error)
- func (w *Wallet) PublicAddress() (string, error)
- func (w *Wallet) PublicKey() key.PublicKey
- func (w *Wallet) ReconstructK() (ristretto.Scalar, error)
- func (w *Wallet) Sign(tx SignableTx) error
- func (w *Wallet) UpdateWalletHeight(newHeight uint64) error
Constants ¶
const DUSK = uint64(100000000)
DUSK is one whole unit of DUSK.
Variables ¶
var ErrSeedFileExists = fmt.Errorf("wallet seed file already exists")
ErrSeedFileExists is returned if the seed file already exists
Functions ¶
func GenerateDecoys ¶
GenerateDecoys creates the ring signature
Types ¶
type FetchInputs ¶
type FetchInputs func(netPrefix byte, db *database.DB, totalAmount int64, key *key.Key) ([]*transactions.Input, int64, error)
FetchInputs returns a slice of inputs such that Sum(Inputs)- Sum(Outputs) >= 0 If > 0, then a change address is created for the remaining amount
type SignableTx ¶
type SignableTx interface {
AddDecoys(numMixins int, f transactions.FetchDecoys) error
Prove() error
StandardTx() *transactions.Standard
}
SignableTx is a signable transaction
type TxInChecker ¶
type TxInChecker struct {
// contains filtered or unexported fields
}
TxInChecker contains the necessary information to deduce whether a user has spent a tx. This is just the keyImage.
func NewTxInChecker ¶
func NewTxInChecker(txs []transactions.Transaction) []TxInChecker
NewTxInChecker creates a slice of TXInChecker
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
Wallet encapsulates the wallet Deprecated: use the phoenix wallet
func LoadFromFile ¶
func LoadFromFile(netPrefix byte, db *database.DB, fDecoys transactions.FetchDecoys, fInputs FetchInputs, password string, file string) (*Wallet, error)
LoadFromFile loads a wallet from a .dat file
func LoadFromSeed ¶
func LoadFromSeed(seed []byte, netPrefix byte, db *database.DB, fDecoys transactions.FetchDecoys, fInputs FetchInputs, password string, file string) (*Wallet, error)
LoadFromSeed loads a wallet from the seed
func New ¶
func New(Read func(buf []byte) (n int, err error), netPrefix byte, db *database.DB, fDecoys transactions.FetchDecoys, fInputs FetchInputs, password string, file string) (*Wallet, error)
New creates a wallet instance
func (*Wallet) AddInputs ¶
func (w *Wallet) AddInputs(tx *transactions.Standard) error
AddInputs adds up the total outputs and fee then fetches inputs to consolidate this
func (*Wallet) Balance ¶
Balance calculates and returns the wallet balance for confirmed transactions
func (*Wallet) CheckUnconfirmedBalance ¶
func (w *Wallet) CheckUnconfirmedBalance(txs []transactions.Transaction) (uint64, error)
CheckUnconfirmedBalance calculates balance including the unconfirmed transactions from a slice of transactions
func (*Wallet) CheckWireBlock ¶
CheckWireBlock check a block
func (*Wallet) CheckWireBlockReceived ¶
CheckWireBlockReceived checks if the wire block has transactions for this wallet Returns the number of tx's that the receiver received funds in
func (*Wallet) CheckWireBlockSpent ¶
CheckWireBlockSpent checks if the block has any outputs spent by this wallet Returns the number of txs that the sender spent funds in
func (*Wallet) ClearDatabase ¶
ClearDatabase will remove all info from the database.
func (*Wallet) FetchTxHistory ¶
FetchTxHistory will return a slice containing information about all transactions made and received with this wallet.
func (*Wallet) GetSavedHeight ¶
GetSavedHeight returns the saved height
func (*Wallet) NewBidTx ¶
func (w *Wallet) NewBidTx(fee int64, lockTime uint64, amount ristretto.Scalar) (*transactions.Bid, error)
NewBidTx creates a new bid transaction
func (*Wallet) NewStakeTx ¶
func (w *Wallet) NewStakeTx(fee int64, lockTime uint64, amount ristretto.Scalar) (*transactions.Stake, error)
NewStakeTx creates a new Stake transaction
func (*Wallet) NewStandardTx ¶
func (w *Wallet) NewStandardTx(fee int64) (*transactions.Standard, error)
NewStandardTx creates a new standard transaction
func (*Wallet) PrivateSpend ¶
PrivateSpend calls the PrivateSpend method on the keypair
func (*Wallet) PublicAddress ¶
PublicAddress returns the wallet public address
func (*Wallet) ReconstructK ¶
ReconstructK reconstructs the secret K from a scalar Deprecated: we are not using ristretto anymore as we moved to PLONK on jubjub
func (*Wallet) UpdateWalletHeight ¶
UpdateWalletHeight update the wallet to the new height