Documentation
¶
Overview ¶
Package wallet is a library for working with a duo blockchain client wallet
Index ¶
- Constants
- Variables
- type AddressBook
- type KeyMetadata
- type KeyPool
- type MasterKeyMap
- type MasterKeys
- type Orders
- type PoolMap
- type ReserveKey
- type ScanState
- type Transactions
- type ValueMap
- type Wallet
- func (r *Wallet) AddAccount(account *rec.Account) *Wallet
- func (r *Wallet) AddKeyPair(k *key.Priv) *Wallet
- func (r *Wallet) AddScript(script *rec.Script) *Wallet
- func (r *Wallet) AddToWalletIfInvolvingMe(id core.Address, tx *tx.Transaction, block *block.Block, update bool, ...) *Wallet
- func (r *Wallet) AddTx(tx *tx.Transaction) *Wallet
- func (r *Wallet) AvailableCoins([]tx.Output, bool)
- func (r *Wallet) ChangeWalletPassphrase(oldp, newp *buf.Secure) *Wallet
- func (r *Wallet) CommitTransaction(*tx.Transaction, *ReserveKey) *Wallet
- func (r *Wallet) CreateTransaction(*rec.Script, int64, *tx.Transaction, *ReserveKey, int64, string) *Wallet
- func (r *Wallet) CreateTransactions([]map[*rec.Script]int64, *tx.Transaction, *ReserveKey, int64, string) *Wallet
- func (r *Wallet) DelAddressBookName(*tx.Destination) *Wallet
- func (r *Wallet) EmptyKeyPool() *Wallet
- func (r *Wallet) EncryptWallet(string)
- func (r *Wallet) EraseFromWallet(core.Hash) *Wallet
- func (r *Wallet) GenerateNewKey() *key.Pub
- func (r *Wallet) GetAddressBalances() map[*tx.Destination]int64
- func (r *Wallet) GetAddressGroupings() []tx.Destination
- func (r *Wallet) GetAllReserveKeys() []core.Address
- func (r *Wallet) GetBalance() int64
- func (r *Wallet) GetChange(*tx.Out) int64
- func (r *Wallet) GetCredit(*tx.Out) int64
- func (r *Wallet) GetDebit(*tx.In) int64
- func (r *Wallet) GetImmatureBalance() int64
- func (r *Wallet) GetKeyBirthTimes(map[*core.Address]int64)
- func (r *Wallet) GetKeyFromPool(allowReuse bool) (out *key.Priv)
- func (r *Wallet) GetKeyPoolSize() int
- func (r *Wallet) GetOldestKeyPoolTime() int64
- func (r *Wallet) GetTransaction(*core.Hash, *tx.Transaction) *Wallet
- func (r *Wallet) GetTxChange(*tx.Transaction) int64
- func (r *Wallet) GetTxCredit(*tx.Transaction) int64
- func (r *Wallet) GetTxDebit(*tx.Transaction) int64
- func (r *Wallet) GetUnconfirmedBalance() int64
- func (r *Wallet) GetVersion() int
- func (r *Wallet) IncOrderPosNext(*db.DB) int64
- func (r *Wallet) Inventory(*core.Hash)
- func (r *Wallet) IsChange(*tx.Out) *Wallet
- func (r *Wallet) IsFromMe(*tx.Transaction) *Wallet
- func (r *Wallet) IsLockedCoin(*core.Hash, uint) *Wallet
- func (r *Wallet) IsMyTX(*tx.Transaction) *Wallet
- func (r *Wallet) IsMyTxIn(*tx.In) *Wallet
- func (r *Wallet) IsMyTxOut(*tx.Out) *Wallet
- func (r *Wallet) KeepKey(int64)
- func (r *Wallet) ListLockedCoins([]tx.OutPoint)
- func (r *Wallet) LoadCryptedKey(*key.Pub, []byte) *Wallet
- func (r *Wallet) LoadKey(*key.Priv, *key.Pub) *Wallet
- func (r *Wallet) LoadKeyMetadata(*key.Pub, *KeyMetadata) *Wallet
- func (r *Wallet) LoadKeyPool() *Wallet
- func (r *Wallet) LoadMinVersion(int) *Wallet
- func (r *Wallet) LoadScript(*rec.Script) *Wallet
- func (r *Wallet) LoadWallet(bool) error
- func (r *Wallet) LockCoin(*tx.OutPoint) *Wallet
- func (r *Wallet) MarkDirty() *Wallet
- func (r *Wallet) NewKeyPool() *Wallet
- func (r *Wallet) NotifyAddressBookChanged(*Wallet, *tx.Destination, string, bool, int)
- func (r *Wallet) NotifyTransactionChanged(*Wallet, *core.Hash, int)
- func (r *Wallet) OrderedTxItems([]rec.Accounting, string) *tx.Items
- func (r *Wallet) PrintWallet(*block.Block)
- func (r *Wallet) ReacceptWalletTransactions()
- func (r *Wallet) ResendWalletTransactions()
- func (r *Wallet) ReturnKey(int64)
- func (r *Wallet) ScanForWalletTransactions(*block.Index, bool) int
- func (r *Wallet) SelectCoinsMinConf(int64, int, int, []tx.Output) (err error)
- func (r *Wallet) SendMoney(*rec.Script, int64, *tx.Transaction, bool) string
- func (r *Wallet) SendMoneyToDestination(*tx.Destination) string
- func (r *Wallet) SetAddressBookName(*tx.Destination, string) *Wallet
- func (r *Wallet) SetBestChain(*block.Locator)
- func (r *Wallet) SetDefaultKey(*key.Pub) *Wallet
- func (r *Wallet) SetMaxVersion(int) *Wallet
- func (r *Wallet) SetMinVersion(int, *db.DB, bool) *Wallet
- func (r *Wallet) TopUpKeyPool() *Wallet
- func (r *Wallet) Unlock(string) *Wallet
- func (r *Wallet) UnlockAllCoins()
- func (r *Wallet) UnlockCoin(*tx.OutPoint)
- func (r *Wallet) UpdatedTransaction(*core.Hash)
- func (r *Wallet) WalletUpdateSpent(*tx.Transaction)
Constants ¶
const ( // CurrentVersion is the version number from this source repository CurrentVersion = 1 // FeatureBase is the base version number for a wallet FeatureBase = 10500 // FeatureWalletCrypt indicates if the wallet enables encrypted keys FeatureWalletCrypt = 40000 // FeatureCompressedPubKey indicates if the wallet enables compressed public keys FeatureCompressedPubKey = 60000 // FeatureLatest is the newest version of the wallet FeatureLatest = 60000 )
Variables ¶
var (
// AccountingEntryNumber is
AccountingEntryNumber = 0
)
Functions ¶
This section is empty.
Types ¶
type AddressBook ¶
AddressBook is a collection of correspondent addresses
type KeyMetadata ¶
KeyMetadata is a structure for storing metadata related to a key pair
func NewKeyMetadata ¶
func NewKeyMetadata(createTime int64) (M *KeyMetadata)
NewKeyMetadata makes a new KeyMetadata structure
type MasterKeyMap ¶
type MasterKeyMap map[uint64]*KeyMetadata
MasterKeyMap is the collection of masterkeys in the wallet
type ReserveKey ¶
ReserveKey is
type ScanState ¶
type ScanState struct {
Keys, CKeys, KeyMeta uint
IsEncrypted, AnyUnordered bool
FileVersion int
WalletUpgrade []*core.Hash
}
ScanState is
type Transactions ¶
Transactions is a map of transactions in the wallet
type Wallet ¶
type Wallet struct { KeyStore key.Store DB *db.DB FileBacked bool File string KeyPool *KeyPool KeyMetadata map[core.Address]*KeyMetadata MasterKeys MasterKeys Transactions Transactions OrderPosNext int RequestCountMap map[core.Hash]int AddressBook AddressBook DefaultKey *key.Pub LockedCoinsSet []*tx.OutPoint TimeFirstKey int64 core.State // contains filtered or unexported fields }
Wallet controls access to a wallet.db file containing keys and data relating to accounts and addresses
func (*Wallet) AddAccount ¶
AddAccount adds a new account (correspondent address and optionally public key)
func (*Wallet) AddToWalletIfInvolvingMe ¶
func (r *Wallet) AddToWalletIfInvolvingMe(id core.Address, tx *tx.Transaction, block *block.Block, update bool, findblock bool) *Wallet
AddToWalletIfInvolvingMe -
func (*Wallet) ChangeWalletPassphrase ¶
ChangeWalletPassphrase removes any old master keys and creates a new one based on a given password. If the crypt is not locked the old password is required to change it, and if it's not encrypted we just return an error
func (*Wallet) CommitTransaction ¶
func (r *Wallet) CommitTransaction(*tx.Transaction, *ReserveKey) *Wallet
CommitTransaction -
func (*Wallet) CreateTransaction ¶
func (r *Wallet) CreateTransaction(*rec.Script, int64, *tx.Transaction, *ReserveKey, int64, string) *Wallet
CreateTransaction -
func (*Wallet) CreateTransactions ¶
func (r *Wallet) CreateTransactions([]map[*rec.Script]int64, *tx.Transaction, *ReserveKey, int64, string) *Wallet
CreateTransactions -
func (*Wallet) DelAddressBookName ¶
func (r *Wallet) DelAddressBookName(*tx.Destination) *Wallet
DelAddressBookName -
func (*Wallet) EmptyKeyPool ¶
EmptyKeyPool deletes an entire keypool
func (*Wallet) EraseFromWallet ¶
EraseFromWallet -
func (*Wallet) GetAddressBalances ¶
func (r *Wallet) GetAddressBalances() map[*tx.Destination]int64
GetAddressBalances -
func (*Wallet) GetAddressGroupings ¶
func (r *Wallet) GetAddressGroupings() []tx.Destination
GetAddressGroupings -
func (*Wallet) GetAllReserveKeys ¶
GetAllReserveKeys -
func (*Wallet) GetImmatureBalance ¶
GetImmatureBalance -
func (*Wallet) GetKeyBirthTimes ¶
GetKeyBirthTimes -
func (*Wallet) GetKeyFromPool ¶
GetKeyFromPool gets the oldest key form the keypool, if it is not allowed to be reused it is taken out of the pool and stored as a main wallet private/public key pair
func (*Wallet) GetKeyPoolSize ¶
GetKeyPoolSize returns the number of keys in the keypool
func (*Wallet) GetOldestKeyPoolTime ¶
GetOldestKeyPoolTime -
func (*Wallet) GetTransaction ¶
GetTransaction -
func (*Wallet) GetUnconfirmedBalance ¶
GetUnconfirmedBalance -
func (*Wallet) IsLockedCoin ¶
IsLockedCoin -
func (*Wallet) LoadCryptedKey ¶
LoadCryptedKey -
func (*Wallet) LoadKeyMetadata ¶
func (r *Wallet) LoadKeyMetadata(*key.Pub, *KeyMetadata) *Wallet
LoadKeyMetadata -
func (*Wallet) LoadKeyPool ¶
LoadKeyPool loads the keypool into memory from the database. Note that this does not load the public and private keys, the keys of pool entries contain everything needed to decide which one to use
func (*Wallet) NewKeyPool ¶
NewKeyPool creates a new pool of keys in reserve for generating transactions
func (*Wallet) NotifyAddressBookChanged ¶
NotifyAddressBookChanged -
func (*Wallet) NotifyTransactionChanged ¶
NotifyTransactionChanged -
func (*Wallet) OrderedTxItems ¶
OrderedTxItems -
func (*Wallet) ReacceptWalletTransactions ¶
func (r *Wallet) ReacceptWalletTransactions()
ReacceptWalletTransactions -
func (*Wallet) ResendWalletTransactions ¶
func (r *Wallet) ResendWalletTransactions()
ResendWalletTransactions -
func (*Wallet) ScanForWalletTransactions ¶
ScanForWalletTransactions -
func (*Wallet) SelectCoinsMinConf ¶
SelectCoinsMinConf -
func (*Wallet) SendMoneyToDestination ¶
func (r *Wallet) SendMoneyToDestination(*tx.Destination) string
SendMoneyToDestination -
func (*Wallet) SetAddressBookName ¶
func (r *Wallet) SetAddressBookName(*tx.Destination, string) *Wallet
SetAddressBookName -
func (*Wallet) SetMinVersion ¶
SetMinVersion -
func (*Wallet) UpdatedTransaction ¶
UpdatedTransaction -
func (*Wallet) WalletUpdateSpent ¶
func (r *Wallet) WalletUpdateSpent(*tx.Transaction)
WalletUpdateSpent -
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package db is the collection of types required to run a wallet service and store the data securely on disk in a Badger database.
|
Package db is the collection of types required to run a wallet service and store the data securely on disk in a Badger database. |
rec
Package rec is a maybe unnecessary collection of specifications of the data formats used in the walletdb.
|
Package rec is a maybe unnecessary collection of specifications of the data formats used in the walletdb. |