Documentation
¶
Index ¶
- Constants
- Variables
- func InputFromUTXO(utxo *UTXO) *Input
- func ToUTXO(txId Uint256, height uint32, index int, value Fixed64, lockTime uint32) *db.UTXO
- type Database
- type DatabaseImpl
- func (db *DatabaseImpl) AddAddress(address *Uint168, script []byte, addrType int) error
- func (db *DatabaseImpl) ChainHeight() uint32
- func (db *DatabaseImpl) DeleteAddress(address *Uint168) error
- func (db *DatabaseImpl) GetAddress(address *Uint168) (*Addr, error)
- func (db *DatabaseImpl) GetAddressSTXOs(address *Uint168) ([]*STXO, error)
- func (db *DatabaseImpl) GetAddressUTXOs(address *Uint168) ([]*UTXO, error)
- func (db *DatabaseImpl) GetAddrs() ([]*Addr, error)
- func (db *DatabaseImpl) Reset() error
- type Keystore
- type KeystoreFile
- func (store *KeystoreFile) FromJson(str string) error
- func (store *KeystoreFile) GetIV() ([]byte, error)
- func (store *KeystoreFile) GetMasterKeyEncrypted() ([]byte, error)
- func (store *KeystoreFile) GetPasswordHash() ([]byte, error)
- func (store *KeystoreFile) GetPrivetKeyEncrypted() ([]byte, error)
- func (store *KeystoreFile) Json() (string, error)
- func (store *KeystoreFile) LoadFromFile() error
- func (store *KeystoreFile) SaveToFile() error
- func (store *KeystoreFile) SetIV(iv []byte)
- func (store *KeystoreFile) SetMasterKeyEncrypted(masterKeyEncrypted []byte)
- func (store *KeystoreFile) SetPasswordHash(passwordHash []byte)
- func (store *KeystoreFile) SetPrivateKeyEncrypted(privateKeyEncrypted []byte)
- type KeystoreImpl
- func (store *KeystoreImpl) ChangePassword(oldPassword, newPassword []byte) error
- func (store *KeystoreImpl) FromJson(str string, password string) error
- func (store *KeystoreImpl) GetAccountByIndex(index int) *Account
- func (store *KeystoreImpl) GetAccountByProgramHash(programHash *Uint168) *Account
- func (store *KeystoreImpl) GetAccounts() []*Account
- func (store *KeystoreImpl) Json() (string, error)
- func (store *KeystoreImpl) MainAccount() *Account
- func (store *KeystoreImpl) NewAccount() *Account
- type SPVWallet
- func (wallet *SPVWallet) Close()
- func (wallet *SPVWallet) CommitTx(storeTx *StoreTx) (bool, error)
- func (wallet *SPVWallet) DataStore() db.DataStore
- func (wallet *SPVWallet) GetChainHeight() uint32
- func (wallet *SPVWallet) GetChainTip() (*StoreHeader, error)
- func (wallet *SPVWallet) GetHeader(hash Uint256) (*StoreHeader, error)
- func (wallet *SPVWallet) GetPrevious(header *StoreHeader) (*StoreHeader, error)
- func (wallet *SPVWallet) Headers() db.Headers
- func (wallet *SPVWallet) NotifyNewAddress(hash []byte) error
- func (wallet *SPVWallet) PutChainHeight(height uint32)
- func (wallet *SPVWallet) PutHeader(header *StoreHeader, newTip bool) error
- func (wallet *SPVWallet) Reset() error
- func (wallet *SPVWallet) Rollback(height uint32) error
- func (wallet *SPVWallet) SendTransaction(tx Transaction) error
- func (wallet *SPVWallet) Start()
- func (wallet *SPVWallet) Stop()
- type Transfer
- type Wallet
- type WalletImpl
- func (wallet *WalletImpl) AddMultiSignAccount(M uint, publicKeys ...*crypto.PublicKey) (*Uint168, error)
- func (wallet *WalletImpl) CreateLockedMultiOutputTransaction(fromAddress string, fee *Fixed64, lockedUntil uint32, outputs ...*Transfer) (*Transaction, error)
- func (wallet *WalletImpl) CreateLockedTransaction(fromAddress, toAddress string, amount, fee *Fixed64, lockedUntil uint32) (*Transaction, error)
- func (wallet *WalletImpl) CreateMultiOutputTransaction(fromAddress string, fee *Fixed64, outputs ...*Transfer) (*Transaction, error)
- func (wallet *WalletImpl) CreateTransaction(fromAddress, toAddress string, amount, fee *Fixed64) (*Transaction, error)
- func (wallet *WalletImpl) NewSubAccount(password []byte) (*Uint168, error)
- func (wallet *WalletImpl) SendTransaction(txn *Transaction) error
- func (wallet *WalletImpl) Sign(password []byte, txn *Transaction) (*Transaction, error)
- func (wallet *WalletImpl) VerifyPassword(password []byte) error
Constants ¶
View Source
const (
KeystoreFilename = "keystore.dat"
)
View Source
const (
KeystoreVersion = "1.0"
)
Variables ¶
View Source
var SystemAssetId = getSystemAssetId()
Functions ¶
func InputFromUTXO ¶
func InputFromUTXO(utxo *UTXO) *Input
Types ¶
type Database ¶
type Database interface {
AddAddress(address *Uint168, script []byte, addrType int) error
GetAddress(address *Uint168) (*Addr, error)
GetAddrs() ([]*Addr, error)
DeleteAddress(address *Uint168) error
GetAddressUTXOs(address *Uint168) ([]*UTXO, error)
GetAddressSTXOs(address *Uint168) ([]*STXO, error)
ChainHeight() uint32
Reset() error
}
func GetDatabase ¶
type DatabaseImpl ¶
type DatabaseImpl struct {
DataStore
// contains filtered or unexported fields
}
func (*DatabaseImpl) AddAddress ¶
func (db *DatabaseImpl) AddAddress(address *Uint168, script []byte, addrType int) error
func (*DatabaseImpl) ChainHeight ¶
func (db *DatabaseImpl) ChainHeight() uint32
func (*DatabaseImpl) DeleteAddress ¶
func (db *DatabaseImpl) DeleteAddress(address *Uint168) error
func (*DatabaseImpl) GetAddress ¶
func (db *DatabaseImpl) GetAddress(address *Uint168) (*Addr, error)
func (*DatabaseImpl) GetAddressSTXOs ¶
func (db *DatabaseImpl) GetAddressSTXOs(address *Uint168) ([]*STXO, error)
func (*DatabaseImpl) GetAddressUTXOs ¶
func (db *DatabaseImpl) GetAddressUTXOs(address *Uint168) ([]*UTXO, error)
func (*DatabaseImpl) GetAddrs ¶
func (db *DatabaseImpl) GetAddrs() ([]*Addr, error)
func (*DatabaseImpl) Reset ¶
func (db *DatabaseImpl) Reset() error
type Keystore ¶
type Keystore interface {
ChangePassword(old, new []byte) error
MainAccount() *Account
NewAccount() *Account
GetAccounts() []*Account
GetAccountByIndex(index int) *Account
GetAccountByProgramHash(programHash *Uint168) *Account
Json() (string, error)
FromJson(json string, password string) error
}
func CreateKeystore ¶
func OpenKeystore ¶
type KeystoreFile ¶
type KeystoreFile struct {
sync.Mutex
Version string
IV string
PasswordHash string
MasterKeyEncrypted string
PrivateKeyEncrypted string
SubAccountsCount int
}
func CreateKeystoreFile ¶
func CreateKeystoreFile() (*KeystoreFile, error)
func OpenKeystoreFile ¶
func OpenKeystoreFile() (*KeystoreFile, error)
func (*KeystoreFile) FromJson ¶
func (store *KeystoreFile) FromJson(str string) error
func (*KeystoreFile) GetIV ¶
func (store *KeystoreFile) GetIV() ([]byte, error)
func (*KeystoreFile) GetMasterKeyEncrypted ¶
func (store *KeystoreFile) GetMasterKeyEncrypted() ([]byte, error)
func (*KeystoreFile) GetPasswordHash ¶
func (store *KeystoreFile) GetPasswordHash() ([]byte, error)
func (*KeystoreFile) GetPrivetKeyEncrypted ¶
func (store *KeystoreFile) GetPrivetKeyEncrypted() ([]byte, error)
func (*KeystoreFile) Json ¶
func (store *KeystoreFile) Json() (string, error)
func (*KeystoreFile) LoadFromFile ¶
func (store *KeystoreFile) LoadFromFile() error
func (*KeystoreFile) SaveToFile ¶
func (store *KeystoreFile) SaveToFile() error
func (*KeystoreFile) SetIV ¶
func (store *KeystoreFile) SetIV(iv []byte)
func (*KeystoreFile) SetMasterKeyEncrypted ¶
func (store *KeystoreFile) SetMasterKeyEncrypted(masterKeyEncrypted []byte)
func (*KeystoreFile) SetPasswordHash ¶
func (store *KeystoreFile) SetPasswordHash(passwordHash []byte)
func (*KeystoreFile) SetPrivateKeyEncrypted ¶
func (store *KeystoreFile) SetPrivateKeyEncrypted(privateKeyEncrypted []byte)
type KeystoreImpl ¶
type KeystoreImpl struct {
sync.Mutex
*KeystoreFile
// contains filtered or unexported fields
}
func (*KeystoreImpl) ChangePassword ¶
func (store *KeystoreImpl) ChangePassword(oldPassword, newPassword []byte) error
func (*KeystoreImpl) FromJson ¶
func (store *KeystoreImpl) FromJson(str string, password string) error
func (*KeystoreImpl) GetAccountByIndex ¶
func (store *KeystoreImpl) GetAccountByIndex(index int) *Account
func (*KeystoreImpl) GetAccountByProgramHash ¶
func (store *KeystoreImpl) GetAccountByProgramHash(programHash *Uint168) *Account
func (*KeystoreImpl) GetAccounts ¶
func (store *KeystoreImpl) GetAccounts() []*Account
func (*KeystoreImpl) Json ¶
func (store *KeystoreImpl) Json() (string, error)
func (*KeystoreImpl) MainAccount ¶
func (store *KeystoreImpl) MainAccount() *Account
func (*KeystoreImpl) NewAccount ¶
func (store *KeystoreImpl) NewAccount() *Account
type SPVWallet ¶
type SPVWallet struct {
sync.Mutex
sdk.SPVService
// contains filtered or unexported fields
}
func (*SPVWallet) GetChainHeight ¶
Get chain height from database
func (*SPVWallet) GetChainTip ¶
Get the header on chain tip
func (*SPVWallet) GetPrevious ¶
Get previous block of the given header
func (*SPVWallet) NotifyNewAddress ¶
func (*SPVWallet) PutChainHeight ¶
Save chain height to database
func (*SPVWallet) SendTransaction ¶
type Wallet ¶
type Wallet interface {
Database
VerifyPassword(password []byte) error
ChangePassword(oldPassword, newPassword []byte) error
NewSubAccount(password []byte) (*Uint168, error)
AddMultiSignAccount(M uint, publicKey ...*crypto.PublicKey) (*Uint168, error)
CreateTransaction(fromAddress, toAddress string, amount, fee *Fixed64) (*Transaction, error)
CreateLockedTransaction(fromAddress, toAddress string, amount, fee *Fixed64, lockedUntil uint32) (*Transaction, error)
CreateMultiOutputTransaction(fromAddress string, fee *Fixed64, output ...*Transfer) (*Transaction, error)
CreateLockedMultiOutputTransaction(fromAddress string, fee *Fixed64, lockedUntil uint32, output ...*Transfer) (*Transaction, error)
Sign(password []byte, transaction *Transaction) (*Transaction, error)
SendTransaction(txn *Transaction) error
}
type WalletImpl ¶
func (*WalletImpl) AddMultiSignAccount ¶
func (wallet *WalletImpl) AddMultiSignAccount(M uint, publicKeys ...*crypto.PublicKey) (*Uint168, error)
func (*WalletImpl) CreateLockedMultiOutputTransaction ¶
func (wallet *WalletImpl) CreateLockedMultiOutputTransaction(fromAddress string, fee *Fixed64, lockedUntil uint32, outputs ...*Transfer) (*Transaction, error)
func (*WalletImpl) CreateLockedTransaction ¶
func (wallet *WalletImpl) CreateLockedTransaction(fromAddress, toAddress string, amount, fee *Fixed64, lockedUntil uint32) (*Transaction, error)
func (*WalletImpl) CreateMultiOutputTransaction ¶
func (wallet *WalletImpl) CreateMultiOutputTransaction(fromAddress string, fee *Fixed64, outputs ...*Transfer) (*Transaction, error)
func (*WalletImpl) CreateTransaction ¶
func (wallet *WalletImpl) CreateTransaction(fromAddress, toAddress string, amount, fee *Fixed64) (*Transaction, error)
func (*WalletImpl) NewSubAccount ¶
func (wallet *WalletImpl) NewSubAccount(password []byte) (*Uint168, error)
func (*WalletImpl) SendTransaction ¶
func (wallet *WalletImpl) SendTransaction(txn *Transaction) error
func (*WalletImpl) Sign ¶
func (wallet *WalletImpl) Sign(password []byte, txn *Transaction) (*Transaction, error)
func (*WalletImpl) VerifyPassword ¶
func (wallet *WalletImpl) VerifyPassword(password []byte) error
Click to show internal directories.
Click to hide internal directories.