package
0.4.33
Repository: https://github.com/p9c/pod.git
Documentation: pkg.go.dev

# README

waddrmgr

[Build Status] (https://travis-ci.org/btcsuite/btcwallet)

Package waddrmgr provides a secure hierarchical deterministic wallet address manager.

A suite of tests is provided to ensure proper functionality. See test_coverage.txt for the gocov coverage report. Alternatively, if you are running a POSIX OS, you can run the cov_report.sh script for a real-time report. Package waddrmgr is licensed under the liberal ISC license.

Feature Overview

  • BIP0032 hierarchical deterministic keys
  • BIP0043/BIP0044 multi-account hierarchy
  • Strong focus on security:
    • Fully encrypted database including public information such as addresses as well as private information such as private keys and scripts needed to redeem pay-to-script-hash transactions
    • Hardened against memory scraping through the use of actively clearing private material from memory when locked
    • Different crypto keys used for public, private, and script data
    • Ability for different passphrases for public and private data
    • Scrypt-based key derivation
    • NaCl-based secretbox cryptography (XSalsa20 and Poly1305)
  • Scalable design:
    • Multi-tier key design to allow instant password changes regardless of the number of addresses stored
    • Import WIF keys
    • Import pay-to-script-hash scripts for things such as multi-signature transactions
    • Ability to export a watching-only version which does not contain any private key material
    • Programmatically detectable errors, including encapsulation of errors from packages it relies on
    • Address synchronization capabilities
  • Comprehensive test coverage

Documentation

[GoDoc] (http://godoc.org/github.com/p9c/pod/walletmain/waddrmgr)

Full go doc style documentation for the project can be viewed online without installing this package by using the GoDoc site here: http://godoc.org/github.com/p9c/pod/walletmain/waddrmgr

You can also view the documentation locally once the package is installed with the godoc tool by running godoc -http=":6060" and pointing your browser to http://localhost:6060/pkg/github.com/p9c/pod/walletmain/waddrmgr

Installation

$ go get github.com/p9c/pod/walletmain/waddrmgr

Package waddrmgr is licensed under the copyfree ISC License.

# Functions

No description provided by the author
Create creates a new address manager in the given namespace.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
DoUpgrades performs any necessary upgrades to the address manager contained in the wallet database, namespaced by the top level bucket key namespaceKey.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
IsError returns whether the error is a ManagerError with a matching error code.
Open loads an existing address manager from the given namespace.
SetSecretKeyGen replaces the existing secret key generator, and returns the previous generator.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ValidateAccountName validates the given account name and returns an error, if any.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Constants

CKTPrivate specifies the key that is used for encryption of private key material such as derived extended private keys and imported private keys.
CKTPublic specifies the key that is used for encryption of public key material such as dervied extended public keys and imported public keys.
CKTScript specifies the key that is used for encryption of scripts.
DefaultAccountNum is the number of the default account.
ErrAccountNotFound indicates that the requested account is not known to the account manager.
ErrAccountNumTooHigh indicates that the specified account number is higher than the max allowed value as defined by the MaxAccountNum constant.
ErrAddressNotFound indicates that the requested address is not known to the account manager.
ErrAlreadyExists indicates that the specified database already exists.
ErrCallBackBreak is used to break from a callback function passed down to the manager.
ErrCoinTypeTooHigh indicates that the coin type specified in the provided network parameters is higher than the max allowed value as defined by the maxCoinType constant.
ErrCrypto indicates an error with the cryptography related operations such as decrypting or encrypting data, parsing an EC public key, or deriving a secret key from a password.
ErrDatabase indicates an error with the underlying database.
ErrDuplicateAccount indicates an account already exists.
ErrDuplicateAddress indicates an address already exists.
ErrEmptyPassphrase indicates that the private passphrase was refused due to being empty.
ErrInvalidAccount indicates that the requested account is not valid.
ErrInvalidKeyType indicates an error where an invalid crypto key type has been selected.
ErrKeyChain indicates an error with the key chain typically either due to the inability to create an extended key or deriving a child extended key.
ErrLocked indicates that an operation, which requires the account manager to be unlocked, was requested on a locked account manager.
ErrNoExist indicates that the specified database does not exist.
ErrScopeNotFound is returned when a target scope cannot be found within the database.
ErrTooManyAddresses indicates that more than the maximum allowed number of addresses per account have been requested.
ErrUpgrade indicates the manager needs to be upgraded.
ErrWatchingOnly indicates that an operation, which requires the account manager to have access to private data, was requested on a watching-only account manager.
ErrWrongNet indicates that the private key to be imported is not for the the same network the account manager is configured for.
ErrWrongPassphrase indicates that the specified passphrase is incorrect.
ExternalBranch is the child number to use when performing BIP0044 style hierarchical deterministic key derivation for the external branch.
2^31 - 1.
ImportedAddrAccountName is the name of the imported account.
InternalBranch is the child number to use when performing BIP0044 style hierarchical deterministic key derivation for the internal branch.
LatestMgrVersion is the most recent manager version.
2^31 - 2.
MaxAddressesPerAccount is the maximum allowed number of addresses per account number.
NestedWitnessPubKey represents a p2wkh output nested within a p2sh output.
PubKeyHash is a regular p2pkh address.
RawPubKey is just raw public key to be used within scripts, This type indicates that a scoped manager with this address type shouldn't be consulted during historical rescans.
Script reprints a raw script address.
WitnessPubKey represents a p2wkh (pay-to-witness-key-hash) address type.

# Variables

Break is a global err used to signal a break from the callback function by returning an error with the code ErrCallBackBreak.
DefaultKeyScopes is the set of default key scopes that will be created by the root manager upon initial creation.
DefaultScryptOptions is the default options used with scrypt.
KeyScopeBIP0044 is the key scope for BIP0044 derivation.
KeyScopeBIP0049Plus is the key scope of our modified BIP0049 derivation.
KeyScopeBIP0084 is the key scope for BIP0084 derivation.
ScopeAddrMap is a map from the default key scopes to the scope address schema for each scope type.

# Structs

AccountProperties contains properties associated with each account, such as the account name, number, and the nubmer of derived and imported keys.
BlockStamp defines a block (by height and a unique hash) and is used to mark a point in the blockchain that an address manager element is synced to.
DerivationPath represents a derivation path from a particular key manager's scope.
KeyScope represents a restricted key scope from the primary root key within the HD chain.
Manager represents a concurrency safe crypto currency address manager and key store.
ManagerError provides a single type for errors that can happen during address manager operation.
OpenCallbacks houses caller-provided callbacks that may be called when opening an existing manager.
ScopeAddrSchema is the address schema of a particular KeyScope.
ScopedIndex is a tuple of KeyScope and child Index.
ScopedKeyManager is a sub key manager under the main root key manager.
ScryptOptions is used to hold the scrypt parameters needed when deriving new passphrase keys.

# Interfaces

EncryptorDecryptor provides an abstraction on top of snacl.CryptoKey so that our tests can use dependency injection to force the behaviour they need.
ManagedAddress is an interface that provides access to information regarding an address managed by an address manager.
ManagedPubKeyAddress extends ManagedAddress and additionally provides the public and private keys for pubkey-based addresses.
ManagedScriptAddress extends ManagedAddress and represents a pay-to-script-hash style of bitcoin addresses.

# Type aliases

AddressType represents the various address types waddrmgr is currently able to generate, and maintain.
CryptoKeyType is used to differentiate between different kinds of crypto keys.
ErrorCode identifies a kind of error.
ObtainUserInputFunc is a function that reads a user input and returns it as a byte stream.
SecretKeyGenerator is the function signature of a method that can generate secret keys for the address manager.