Documentation
¶
Index ¶
- Variables
- func EntropyFromMnemonic(mnemonic string) (entropy []byte, err error)
- func NewEntropy(bits int) (entropy []byte, err error)
- func NewMnemonic(entropy []byte) (mnemonic string, err error)
- func NewSeed() (b []byte, err error)
- func NewSeedFromMnemonic(mnemonic, password string) ([]byte, error)
- func PaddedAppend(size uint, dst, src []byte) []byte
- type Coin
- type CoinInfo
- type HasParentChain
- type MetadataProvider
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrThisFeatureIsNotSupported = errors.New("this feature is not supported by this coin")
)
View Source
var ParentChainCofnig = map[string]string{
"OMNI": "BTC",
}
Functions ¶
func EntropyFromMnemonic ¶
EntropyFromMnemonic returns the input entropy used to generate the given mnemonic
func NewEntropy ¶
NewEntropy will create random entropy bytes
func NewMnemonic ¶
NewMnemonic returns a randomly generated BIP-39 mnemonic using 128-256 bits of entropy.
func NewSeedFromMnemonic ¶
NewSeedFromMnemonic returns a BIP-39 seed based on a BIP-39 mnemonic.
func PaddedAppend ¶
Types ¶
type Coin ¶
type Coin interface {
// DeriveAddress derives the account address of the derivation path.
DeriveAddress() (address string, err error)
// DerivePublicKey derives the public key of the derivation path.
DerivePublicKey() (publicKey string, err error)
// DerivePrivateKey derives the private key of the derivation path.
DerivePrivateKey() (privateKey string, err error)
// DecodeTx decodes raw tx to human readable format
DecodeTx(msg string) (tx string, err error)
// Sign signs raw tx with privateKey
Sign(msg, privateKey string) (sig string, err error)
// VerifySignature verifies rawTx's signature is intact
VerifySignature(pubKey, msg, signature string) error
// RawKey return raw private key, public key
RawKey() ([]byte, error)
}
Coin 定义了某种货币常用的可以提供的方法
type CoinInfo ¶
type CoinInfo struct {
Symbol string
DerivationPath accounts.DerivationPath
MasterKey *hdkeychain.ExtendedKey
ChainCfg *chaincfg.Params
}
type HasParentChain ¶
type HasParentChain interface {
// GetParentChainName get the symbol name of the parent chain
GetParentChainName() string
}
type MetadataProvider ¶
type MetadataProvider interface {
GetChainID() int //获取链id
GetPath() string //含%d的路径
IsTestNet() bool
GetSeed() []byte //bip39 seed,受助记词和密码影响
GetDerivationPath() []uint32 //推导出的bip44路径,受path, symbol影响
HasFlag(string) bool //是否存在flag
}
MetadataProvider we need a configuration data container per-symbol.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal/helpers
Package helpers provides convenience functions to simplify wallet code.
|
Package helpers provides convenience functions to simplify wallet code. |
|
internal/txauthor
Package txauthor provides transaction creation code for wallets.
|
Package txauthor provides transaction creation code for wallets. |
|
internal/txrules
Package txrules provides transaction rules that should be followed by transaction authors for wide mempool acceptance and quick mining.
|
Package txrules provides transaction rules that should be followed by transaction authors for wide mempool acceptance and quick mining. |
|
internal/txscript
Package txscript implements the bitcoin transaction script language.
|
Package txscript implements the bitcoin transaction script language. |
|
internalized/testtool
Package testtool 测试用辅助函数
|
Package testtool 测试用辅助函数 |
Click to show internal directories.
Click to hide internal directories.