bipwallet

package
v1.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package bipwallet 比特币改进协议钱包相关定义

Index

Constants

View Source
const (
	TypeBitcoin            uint32 = 0x80000000
	TypeLitecoin           uint32 = 0x80000002
	TypeEther              uint32 = 0x8000003c
	TypeEtherClassic       uint32 = 0x8000003d
	TypeFactomFactoids     uint32 = 0x80000083
	TypeFactomEntryCredits uint32 = 0x80000084
	TypeZcash              uint32 = 0x80000085
	TypeTrc                uint32 = 0x80003333
	TypeYcc                uint32 = 0x80003334
)

https://github.com/satoshilabs/slips/blob/master/slip-0044.md

Variables

View Source
var CoinName = map[uint32]string{
	TypeEther:        "ETH",
	TypeEtherClassic: "ETC",
	TypeBitcoin:      "BTC",
	TypeLitecoin:     "LTC",
	TypeZcash:        "ZEC",
	TypeTrc:          "TRC",
	TypeYcc:          "YCC",
}

CoinName 币种名称

Functions

func GetSLIP0044CoinType

func GetSLIP0044CoinType(name string) uint32

GetSLIP0044CoinType 获取货币的 CoinType 值

func NewMnemonicString

func NewMnemonicString(lang, bitsize int) (string, error)

NewMnemonicString 创建助记词 lang=0 英文助记词,lang=1 中文助记词bitsize=[128,256]并且bitsize%32=0

func PrivkeyToPub

func PrivkeyToPub(coinType, keyTy uint32, priv []byte) ([]byte, error)

PrivkeyToPub 私钥转换成公钥

func PubToAddress

func PubToAddress(pub []byte) (string, error)

PubToAddress 将公钥转换成地址

Types

type HDWallet

type HDWallet struct {
	CoinType  uint32
	RootSeed  []byte
	MasterKey *bip32.Key
	KeyType   uint32
}

HDWallet 支持BIP-44标准的HD钱包

func NewWalletFromMnemonic

func NewWalletFromMnemonic(coinType, keyType uint32, mnemonic string) (wallet *HDWallet, err error)

NewWalletFromMnemonic 通过助记词生成钱包对象

func NewWalletFromSeed

func NewWalletFromSeed(coinType, keyType uint32, seed []byte) (wallet *HDWallet, err error)

NewWalletFromSeed 通过种子生成钱包对象

func (*HDWallet) NewAddress

func (w *HDWallet) NewAddress(index uint32) (string, error)

NewAddress 新建地址

func (*HDWallet) NewKeyPair

func (w *HDWallet) NewKeyPair(index uint32) (priv, pub []byte, err error)

NewKeyPair 通过索引生成新的秘钥对

Directories

Path Synopsis
Package basen basen (base-N) is a simple Go encoding package for representing bytes as big integers in arbitrary base-N encoding.
Package basen basen (base-N) is a simple Go encoding package for representing bytes as big integers in arbitrary base-N encoding.
Package btcutil Utility functions for Bitcoin elliptic curve cryptography.
Package btcutil Utility functions for Bitcoin elliptic curve cryptography.
Package bip32 A fully compliant implementation of the BIP0032 spec for Hierarchical Deterministic Bitcoin addresses
Package bip32 A fully compliant implementation of the BIP0032 spec for Hierarchical Deterministic Bitcoin addresses
Package bip39 A golang implementation of the BIP0039 spec for mnemonic seeds
Package bip39 A golang implementation of the BIP0039 spec for mnemonic seeds
Package bip44 基于 BIP32 的系统,赋予树状结构中的各层特殊的意义。
Package bip44 基于 BIP32 的系统,赋予树状结构中的各层特殊的意义。
Package transformer 通过私钥生成所选币种的公钥和地址
Package transformer 通过私钥生成所选币种的公钥和地址
btcbase
Package btcbase 转换基于比特币地址规则的币种 使用此规则的币种有:BTC、BCH、LTC、ZEC、USDT、 TRC
Package btcbase 转换基于比特币地址规则的币种 使用此规则的币种有:BTC、BCH、LTC、ZEC、USDT、 TRC

Jump to

Keyboard shortcuts

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