account

package
v0.0.0-...-821963a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DerivePrivateKey

func DerivePrivateKey(seed []byte, chainParams *chaincfg.Params, path string) (*hdkeychain.ExtendedKey, error)

@title 派生子私钥 @param seed []byte 种子 @param chainParams *chaincfg.Params 链参数 @param path string 派生路径 @return _ *hdkeychain.ExtendedKey 子私钥 @return _ error 异常信息

func GetPrivateKeyFromHex

func GetPrivateKeyFromHex(privateKeyHex string) (*secp256k1.PrivateKey, error)

@title 十六进制格式私钥 @param privateKey string 十六进制私钥 @return _ *secp256k1.PrivateKey 私钥 @return _ error 异常信息

func GetPrivateKeyFromMnemonic

func GetPrivateKeyFromMnemonic(mnemonic string, password string, chainParams *chaincfg.Params, path string, index int64) (*secp256k1.PrivateKey, error)

@title 通过助记词获取私钥 @param seed []byte 种子 @param chainParams *chaincfg.Params 链参数 @param path string 派生路径 @param index int64 账户索引 @return _ *secp256k1.PrivateKey 私钥 @return _ error 异常信息

func GetPrivateKeyFromSeed

func GetPrivateKeyFromSeed(seed []byte, chainParams *chaincfg.Params, path string, index int64) (*secp256k1.PrivateKey, error)

@title 通过种子获取私钥 @param seed []byte 种子 @param chainParams *chaincfg.Params 链参数 @param path string 派生路径 @param index int64 账户索引 @return _ *secp256k1.PrivateKey 私钥 @return _ error 异常信息

func GetSeedFromMnemonic

func GetSeedFromMnemonic(mnemonic string, password string) ([]byte, error)

@title 从助记词获取种子 @param mnemonic string 助记词 @param password string 密码 @return _ []byte 种子 @return _ error 异常信息

func PrivateKeyToHex

func PrivateKeyToHex(privateKey *secp256k1.PrivateKey) (string, error)

@title 十六进制格式私钥 @param privateKey *secp256k1.PrivateKey 私钥 @return _ string 十六进制私钥 @return _ error 异常信息

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

func NewAccountFromMnemonic

func NewAccountFromMnemonic(mnemonic string, password string, index int64) (*Account, error)

@title 创建账户 @param mnemonic string 助记词 @param password string 密码 @param index int64 账户索引 @return _ *Account 账户 @return _ error 异常信息

func NewAccountFromSeed

func NewAccountFromSeed(seed []byte, index int64) (*Account, error)

@title 创建账户 @param seed []byte 种子 @param index int64 账户索引 @return _ *Account 账户 @return _ error 异常信息

func (*Account) Index

func (Self *Account) Index() int64

@title 账户索引 @param Self *Account @return _ int64 账户索引

func (*Account) Seed

func (Self *Account) Seed() []byte

@title 种子 @param Self *Account @return _ []byte 种子

type IAccount

type IAccount interface {
	Chain() common.Chain
	GetPrivateKey() (*secp256k1.PrivateKey, error)
	GetAddress() (string, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL