Documentation ¶
Index ¶
- Constants
- Variables
- func CreateEncryptedBoltDB(boltPath string) error
- func ExportEncryptedWallet(path, password string) (string, []*factom.FactoidAddress, []*factom.ECAddress, error)
- func ExportLDBWallet(path string) (string, []*factom.FactoidAddress, []*factom.ECAddress, error)
- func ExportWallet(path string) (string, []*factom.FactoidAddress, []*factom.ECAddress, error)
- func SeedString(seed []byte) string
- type DBSeed
- func (e *DBSeed) JSONBuffer(b *bytes.Buffer) error
- func (e *DBSeed) JSONByte() ([]byte, error)
- func (e *DBSeed) JSONString() (string, error)
- func (e *DBSeed) MarshalBinary() ([]byte, error)
- func (e *DBSeed) NextECAddress() (*factom.ECAddress, error)
- func (e *DBSeed) NextFCTAddress() (*factom.FactoidAddress, error)
- func (e *DBSeed) NextIdentityKey() (*factom.IdentityKey, error)
- func (e *DBSeed) String() string
- func (e *DBSeed) UnmarshalBinary(data []byte) (err error)
- func (e *DBSeed) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type DBSeedBase
- type ECA
- type FA
- type ID
- type TXDatabaseOverlay
- func (db *TXDatabaseOverlay) Close() error
- func (db *TXDatabaseOverlay) FetchNextFBlockHeight() (uint32, error)
- func (db *TXDatabaseOverlay) GetAllTXs() ([]interfaces.ITransaction, error)
- func (db *TXDatabaseOverlay) GetFBlock(keymr string) (interfaces.IFBlock, error)
- func (db *TXDatabaseOverlay) GetTX(txid string) (interfaces.ITransaction, error)
- func (db *TXDatabaseOverlay) GetTXAddress(adr string) ([]interfaces.ITransaction, error)
- func (db *TXDatabaseOverlay) GetTXRange(start, end int) ([]interfaces.ITransaction, error)
- func (db *TXDatabaseOverlay) InsertFBlockHead(fblock interfaces.IFBlock) error
- func (db *TXDatabaseOverlay) Update() (string, error)
- type Wallet
- func ImportEncryptedWalletFromMnemonic(mnemonic, path, password string) (*Wallet, error)
- func ImportLDBWalletFromMnemonic(mnemonic, path string) (*Wallet, error)
- func ImportV1Wallet(v1path, v2path string) (*Wallet, error)
- func ImportV1WalletToEncryptedDB(v1path, v2path, password string) (*Wallet, error)
- func ImportV1WalletToLDB(v1path, v2path string) (*Wallet, error)
- func ImportWalletFromMnemonic(mnemonic, path string) (*Wallet, error)
- func NewEncryptedBoltDBWallet(path, password string) (*Wallet, error)
- func NewEncryptedBoltDBWalletAwaitingPassphrase(path string) (*Wallet, error)
- func NewMapDBWallet() (*Wallet, error)
- func NewOrOpenBoltDBWallet(path string) (*Wallet, error)
- func NewOrOpenLevelDBWallet(path string) (*Wallet, error)
- func (w *Wallet) AddECOutput(name, address string, amount uint64) error
- func (w *Wallet) AddFee(name, address string, rate uint64) error
- func (w *Wallet) AddInput(name, address string, amount uint64) error
- func (w *Wallet) AddOutput(name, address string, amount uint64) error
- func (w *Wallet) AddTXDB(t *TXDatabaseOverlay)
- func (w *Wallet) Close() error
- func (w *Wallet) ComposeTransaction(name string) (*factom.JSON2Request, error)
- func (w *Wallet) DeleteTransaction(name string) error
- func (w *Wallet) GenerateECAddress() (*factom.ECAddress, error)
- func (w *Wallet) GenerateFCTAddress() (*factom.FactoidAddress, error)
- func (w *Wallet) GenerateIdentityKey() (*factom.IdentityKey, error)
- func (w *Wallet) GetAllAddresses() ([]*factom.FactoidAddress, []*factom.ECAddress, error)
- func (w *Wallet) GetApiVersion() string
- func (w *Wallet) GetSeed() (string, error)
- func (w *Wallet) GetTransaction(name string) (*factoid.Transaction, error)
- func (w *Wallet) GetTransactions() map[string]*factoid.Transaction
- func (w *Wallet) GetVersion() string
- func (w *Wallet) ImportComposedTransaction(name string, hexEncoded string) error
- func (w *Wallet) InitWallet() error
- func (w *Wallet) NewTransaction(name string) error
- func (w *Wallet) SignData(signer string, data []byte) ([]byte, []byte, error)
- func (w *Wallet) SignTransaction(name string, force bool) error
- func (w *Wallet) SubFee(name, address string, rate uint64) error
- func (w *Wallet) TXDB() *TXDatabaseOverlay
- func (w *Wallet) TransactionExists(name string) bool
- type WalletDatabaseOverlay
- func NewBoltDB(boltPath string) (*WalletDatabaseOverlay, error)
- func NewEncryptedBoltDB(boltPath, password string) (*WalletDatabaseOverlay, error)
- func NewLevelDB(ldbpath string) (*WalletDatabaseOverlay, error)
- func NewMapDB() *WalletDatabaseOverlay
- func NewWalletOverlay(db interfaces.IDatabase) *WalletDatabaseOverlay
- func OpenEncryptedBoltDB(boltPath, password string) (*WalletDatabaseOverlay, error)
- func (db *WalletDatabaseOverlay) GetAllECAddresses() ([]*factom.ECAddress, error)
- func (db *WalletDatabaseOverlay) GetAllFCTAddresses() ([]*factom.FactoidAddress, error)
- func (db *WalletDatabaseOverlay) GetAllIdentityKeys() ([]*factom.IdentityKey, error)
- func (db *WalletDatabaseOverlay) GetDBSeed() (*DBSeed, error)
- func (db *WalletDatabaseOverlay) GetECAddress(pubString string) (*factom.ECAddress, error)
- func (db *WalletDatabaseOverlay) GetFCTAddress(str string) (*factom.FactoidAddress, error)
- func (db *WalletDatabaseOverlay) GetIdentityKey(str string) (*factom.IdentityKey, error)
- func (db *WalletDatabaseOverlay) GetNextECAddress() (*factom.ECAddress, error)
- func (db *WalletDatabaseOverlay) GetNextFCTAddress() (*factom.FactoidAddress, error)
- func (db *WalletDatabaseOverlay) GetNextIdentityKey() (*factom.IdentityKey, error)
- func (db *WalletDatabaseOverlay) GetOrCreateDBSeed() (*DBSeed, error)
- func (db *WalletDatabaseOverlay) InsertDBSeed(seed *DBSeed) error
- func (db *WalletDatabaseOverlay) InsertECAddress(e *factom.ECAddress) error
- func (db *WalletDatabaseOverlay) InsertFCTAddress(e *factom.FactoidAddress) error
- func (db *WalletDatabaseOverlay) InsertIdentityKey(e *factom.IdentityKey) error
- func (db *WalletDatabaseOverlay) RemoveAddress(pubString string) error
- func (db *WalletDatabaseOverlay) RemoveIdentityKey(pubString string) error
Constants ¶
const ( SeedLength = 64 ApiVersion = "2.0" )
Variables ¶
var ( ErrFeeTooLow = errors.New("wallet: Insufficient Fee") ErrNoSuchAddress = errors.New("wallet: No such address") ErrNoSuchIdentityKey = errors.New("wallet: No such identity key") ErrTXExists = errors.New("wallet: Transaction name already exists") ErrTXNotExists = errors.New("wallet: Transaction name was not found") ErrTXNoInputs = errors.New("wallet: Transaction has no inputs") ErrTXInvalidName = errors.New("wallet: Transaction name is not valid") )
var APICounter = newCounter()
var WalletVersion string = "BuiltWithoutVersion"
Functions ¶
func CreateEncryptedBoltDB ¶
func ExportEncryptedWallet ¶
func ExportEncryptedWallet(path, password string) (string, []*factom.FactoidAddress, []*factom.ECAddress, error)
ExportEncryptedWallet writes all the secret/publilc key pairs from a wallet and the wallet seed in a pritable format.
func ExportLDBWallet ¶
ExportLDBWallet writes all the secret/publilc key pairs from a wallet and the wallet seed in a pritable format.
func ExportWallet ¶
ExportWallet writes all the secret/publilc key pairs from a wallet and the wallet seed in a pritable format.
func SeedString ¶
SeedString returnes the string representation of a raw Wallet Seed or Next Wallet Seed.
Types ¶
type DBSeed ¶
type DBSeed struct {
DBSeedBase
}
func NewRandomSeed ¶
func (*DBSeed) JSONString ¶
func (*DBSeed) MarshalBinary ¶
func (*DBSeed) NextFCTAddress ¶
func (e *DBSeed) NextFCTAddress() (*factom.FactoidAddress, error)
func (*DBSeed) NextIdentityKey ¶
func (e *DBSeed) NextIdentityKey() (*factom.IdentityKey, error)
func (*DBSeed) UnmarshalBinary ¶
type DBSeedBase ¶
type ECA ¶
func (*ECA) New ¶
func (t *ECA) New() interfaces.BinaryMarshallableAndCopyable
type FA ¶
type FA struct {
*factom.FactoidAddress
}
func (*FA) New ¶
func (t *FA) New() interfaces.BinaryMarshallableAndCopyable
type ID ¶
type ID struct {
*factom.IdentityKey
}
func (*ID) New ¶
func (t *ID) New() interfaces.BinaryMarshallableAndCopyable
type TXDatabaseOverlay ¶
type TXDatabaseOverlay struct { DBO databaseOverlay.Overlay // contains filtered or unexported fields }
func NewTXBoltDB ¶
func NewTXBoltDB(boltPath string) (*TXDatabaseOverlay, error)
func NewTXLevelDB ¶
func NewTXLevelDB(ldbpath string) (*TXDatabaseOverlay, error)
func NewTXMapDB ¶
func NewTXMapDB() *TXDatabaseOverlay
func NewTXOverlay ¶
func NewTXOverlay(db interfaces.IDatabase) *TXDatabaseOverlay
func (*TXDatabaseOverlay) Close ¶
func (db *TXDatabaseOverlay) Close() error
func (*TXDatabaseOverlay) FetchNextFBlockHeight ¶
func (db *TXDatabaseOverlay) FetchNextFBlockHeight() (uint32, error)
func (*TXDatabaseOverlay) GetAllTXs ¶
func (db *TXDatabaseOverlay) GetAllTXs() ([]interfaces.ITransaction, error)
GetAllTXs returns a list of all transactions in the history of Factom. A local database is used to cache the factoid blocks.
func (*TXDatabaseOverlay) GetFBlock ¶
func (db *TXDatabaseOverlay) GetFBlock(keymr string) (interfaces.IFBlock, error)
GetFBlock retrives a Factoid Block from Factom
func (*TXDatabaseOverlay) GetTX ¶
func (db *TXDatabaseOverlay) GetTX(txid string) (interfaces.ITransaction, error)
GetTX gets a transaction by the transaction id
func (*TXDatabaseOverlay) GetTXAddress ¶
func (db *TXDatabaseOverlay) GetTXAddress(adr string) ( []interfaces.ITransaction, error)
GetTXAddress returns a list of all transactions in the history of Factom that include a specific address.
func (*TXDatabaseOverlay) GetTXRange ¶
func (db *TXDatabaseOverlay) GetTXRange(start, end int) ( []interfaces.ITransaction, error)
func (*TXDatabaseOverlay) InsertFBlockHead ¶
func (db *TXDatabaseOverlay) InsertFBlockHead(fblock interfaces.IFBlock) error
func (*TXDatabaseOverlay) Update ¶
func (db *TXDatabaseOverlay) Update() (string, error)
Update gets all fblocks written since the database was last updated, and returns the most recent fblock keymr.
type Wallet ¶
type Wallet struct { *WalletDatabaseOverlay Encrypted bool DBPath string // contains filtered or unexported fields }
Wallet is a connection to a Factom Wallet Database
func ImportEncryptedWalletFromMnemonic ¶
ImportEncryptedWalletFromMnemonic creates a new wallet with a provided Mnemonic seed defined in bip-0039.
func ImportLDBWalletFromMnemonic ¶
ImportWalletFromMnemonic creates a new wallet with a provided Mnemonic seed defined in bip-0039.
func ImportV1Wallet ¶
ImportV1Wallet takes a version 1 wallet bolt.db file and imports all of its addresses into a factom wallet.
func ImportV1WalletToEncryptedDB ¶
ImportV1WalletToEncryptedDB takes a version 1 wallet bolt.db file and imports all of its addresses into a factom wallet.
func ImportV1WalletToLDB ¶
ImportV1WalletToLDB takes a version 1 wallet bolt.db file and imports all of its addresses into a factom wallet.
func ImportWalletFromMnemonic ¶
ImportWalletFromMnemonic creates a new wallet with a provided Mnemonic seed defined in bip-0039.
func NewMapDBWallet ¶
func NewOrOpenBoltDBWallet ¶
func NewOrOpenLevelDBWallet ¶
func (*Wallet) AddECOutput ¶
func (*Wallet) AddTXDB ¶
func (w *Wallet) AddTXDB(t *TXDatabaseOverlay)
AddTXDB allows the wallet api to read from a local transaction cashe.
func (*Wallet) ComposeTransaction ¶
func (w *Wallet) ComposeTransaction(name string) (*factom.JSON2Request, error)
func (*Wallet) DeleteTransaction ¶
func (*Wallet) GenerateECAddress ¶
GenerateECAddress creates and stores a new Entry Credit Address in the Wallet. The address can be reproduced in the future using the Wallet Seed.
func (*Wallet) GenerateFCTAddress ¶
func (w *Wallet) GenerateFCTAddress() (*factom.FactoidAddress, error)
GenerateFCTAddress creates and stores a new Factoid Address in the Wallet. The address can be reproduced in the future using the Wallet Seed.
func (*Wallet) GenerateIdentityKey ¶
func (w *Wallet) GenerateIdentityKey() (*factom.IdentityKey, error)
GenerateIdentityKey creates and stores a new Identity Key in the Wallet.
func (*Wallet) GetAllAddresses ¶
GetAllAddresses retrieves all Entry Credit and Factoid Addresses from the Wallet Database.
func (*Wallet) GetApiVersion ¶
func (*Wallet) GetSeed ¶
GetSeed returns the string representaion of the Wallet Seed. The Wallet Seed can be used to regenerate the Factoid and Entry Credit Addresses previously generated by the wallet. Note that Addresses that are imported into the Wallet cannot be regenerated using the Wallet Seed.
func (*Wallet) GetTransaction ¶
func (w *Wallet) GetTransaction(name string) (*factoid.Transaction, error)
func (*Wallet) GetTransactions ¶
func (w *Wallet) GetTransactions() map[string]*factoid.Transaction
func (*Wallet) GetVersion ¶
func (*Wallet) ImportComposedTransaction ¶
Hexencoded transaction
func (*Wallet) InitWallet ¶
func (*Wallet) NewTransaction ¶
func (*Wallet) SignTransaction ¶
SignTransaction signs a tmp transaction in the wallet with the appropriate keys from the wallet db force=true ignores the existing balance and fee overpayment checks.
func (*Wallet) TXDB ¶
func (w *Wallet) TXDB() *TXDatabaseOverlay
TXDB returns a handle for the Transaction Database.
func (*Wallet) TransactionExists ¶
type WalletDatabaseOverlay ¶
type WalletDatabaseOverlay struct {
DBO databaseOverlay.Overlay
}
func NewBoltDB ¶
func NewBoltDB(boltPath string) (*WalletDatabaseOverlay, error)
func NewEncryptedBoltDB ¶
func NewEncryptedBoltDB(boltPath, password string) (*WalletDatabaseOverlay, error)
func NewLevelDB ¶
func NewLevelDB(ldbpath string) (*WalletDatabaseOverlay, error)
func NewMapDB ¶
func NewMapDB() *WalletDatabaseOverlay
func NewWalletOverlay ¶
func NewWalletOverlay(db interfaces.IDatabase) *WalletDatabaseOverlay
func OpenEncryptedBoltDB ¶
func OpenEncryptedBoltDB(boltPath, password string) (*WalletDatabaseOverlay, error)
func (*WalletDatabaseOverlay) GetAllECAddresses ¶
func (db *WalletDatabaseOverlay) GetAllECAddresses() ([]*factom.ECAddress, error)
func (*WalletDatabaseOverlay) GetAllFCTAddresses ¶
func (db *WalletDatabaseOverlay) GetAllFCTAddresses() ([]*factom.FactoidAddress, error)
func (*WalletDatabaseOverlay) GetAllIdentityKeys ¶
func (db *WalletDatabaseOverlay) GetAllIdentityKeys() ([]*factom.IdentityKey, error)
func (*WalletDatabaseOverlay) GetDBSeed ¶
func (db *WalletDatabaseOverlay) GetDBSeed() (*DBSeed, error)
func (*WalletDatabaseOverlay) GetECAddress ¶
func (db *WalletDatabaseOverlay) GetECAddress(pubString string) (*factom.ECAddress, error)
func (*WalletDatabaseOverlay) GetFCTAddress ¶
func (db *WalletDatabaseOverlay) GetFCTAddress(str string) (*factom.FactoidAddress, error)
func (*WalletDatabaseOverlay) GetIdentityKey ¶
func (db *WalletDatabaseOverlay) GetIdentityKey(str string) (*factom.IdentityKey, error)
func (*WalletDatabaseOverlay) GetNextECAddress ¶
func (db *WalletDatabaseOverlay) GetNextECAddress() (*factom.ECAddress, error)
func (*WalletDatabaseOverlay) GetNextFCTAddress ¶
func (db *WalletDatabaseOverlay) GetNextFCTAddress() (*factom.FactoidAddress, error)
func (*WalletDatabaseOverlay) GetNextIdentityKey ¶
func (db *WalletDatabaseOverlay) GetNextIdentityKey() (*factom.IdentityKey, error)
func (*WalletDatabaseOverlay) GetOrCreateDBSeed ¶
func (db *WalletDatabaseOverlay) GetOrCreateDBSeed() (*DBSeed, error)
func (*WalletDatabaseOverlay) InsertDBSeed ¶
func (db *WalletDatabaseOverlay) InsertDBSeed(seed *DBSeed) error
func (*WalletDatabaseOverlay) InsertECAddress ¶
func (db *WalletDatabaseOverlay) InsertECAddress(e *factom.ECAddress) error
func (*WalletDatabaseOverlay) InsertFCTAddress ¶
func (db *WalletDatabaseOverlay) InsertFCTAddress(e *factom.FactoidAddress) error
func (*WalletDatabaseOverlay) InsertIdentityKey ¶
func (db *WalletDatabaseOverlay) InsertIdentityKey(e *factom.IdentityKey) error
func (*WalletDatabaseOverlay) RemoveAddress ¶
func (db *WalletDatabaseOverlay) RemoveAddress(pubString string) error
func (*WalletDatabaseOverlay) RemoveIdentityKey ¶
func (db *WalletDatabaseOverlay) RemoveIdentityKey(pubString string) error