Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateMnemonic(bitSize int) (string, error)
- func GenerateSeed(mnemonic, password string) ([]byte, error)
- func GetCoinType(network string) uint32
- func GetParamsFromNetwork(network string) (*chaincfg.Params, error)
- type Account
- type ChildWallet
- type HDWallet
- type Message
- type RPC
- type ZMQ
Constants ¶
const ( Mainnet = "mainnet" Testnet = "testnet" Regtest = "regtest" Simnet = "simnet" )
bitcoin blockchain network type
const ( CoinTypeBitcoin uint32 = 0 CoinTypeBitcoinTestnet uint32 = 1 )
BIP44 CoinType
const ( ChangeTypeExternal uint32 = 0 ChangeTypeInternal uint32 = 1 )
BIP44 change type
const ( AddressP2KH string = "p2kh" AddressP2SH string = "p2sh" AddressBech32 string = "bech32" )
const ( Hash = "hash" HashBlock = "hashblock" HashTx = "hashtx" RawBlock = "rawblock" RawTx = "rawtx" )
ZMQ topics
const HardenedKey = 0x80000000
HardenedKey BIP44 hardened key
const Purpose = 44
Purpose is BIP44 purpose
Variables ¶
var MaxTries int64 = 10
MaxTries is RPC max tries count
Functions ¶
func GenerateMnemonic ¶
GenerateMnemonic return mnemonic (bitSize must be [128, 256] and a multiple of 32)
func GenerateSeed ¶
GenerateSeed return seed from mnemonic and password
func GetCoinType ¶
GetCoinType return BIP44 cointype by network
Types ¶
type Account ¶
type Account struct { ExtendedKey *hdkeychain.ExtendedKey ChainParams *chaincfg.Params }
Account is HDWallet account
func (*Account) DeriveAddress ¶
func (a *Account) DeriveAddress(change, addressIndex uint32, addressType string) (*ChildWallet, error)
DeriveAddress return ChildWallet by change type and addressIndex
type ChildWallet ¶
ChildWallet is created from HDWallet by index
type HDWallet ¶
type HDWallet struct { Mnemonic string ExtendedKey *hdkeychain.ExtendedKey ChainParams *chaincfg.Params }
HDWallet is BIP44 HD Wallet format. Apostrophe is a hardend key to enhance security m / purpose' / coin_type' / account' / change / address_index
func NewHDWallet ¶
NewHDWallet return mnemonic and HDWallet ExtendedKey and network Params
type ZMQ ¶
type ZMQ struct {
// contains filtered or unexported fields
}
ZMQ zero mq settings https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md
func NewZmqClient ¶
NewZmqClient zero mq client