address

package
v1.66.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: BSD-3-Clause Imports: 8 Imported by: 422

Documentation

Overview

Package address 计算地址相关的函数

Index

Constants

View Source
const MaxExecNameLength = 100

MaxExecNameLength 执行器名最大长度

Variables

View Source
var ErrAddressChecksum = errors.New("address checksum error")

ErrAddressChecksum :

View Source
var ErrCheckChecksum = errors.New("Address Checksum error")

ErrCheckChecksum :

View Source
var ErrCheckVersion = errors.New("check version error")

ErrCheckVersion :

View Source
var MultiSignVer byte = 5

MultiSignVer 多重签名地址的版本号

View Source
var NormalVer byte

NormalVer 普通地址的版本号

Functions

func CheckAddress

func CheckAddress(addr string) (e error)

CheckAddress 检查地址

func CheckMultiSignAddress

func CheckMultiSignAddress(addr string) (e error)

CheckMultiSignAddress 检查多重签名地址的有效性

func ExecAddress

func ExecAddress(name string) string

ExecAddress 计算量有点大,做一次cache

func ExecPubKey

func ExecPubKey(name string) []byte

ExecPubKey 计算公钥

func MultiSignAddress

func MultiSignAddress(pubkey []byte) string

MultiSignAddress create a multi sign address

func PubKeyToAddr

func PubKeyToAddr(in []byte) string

PubKeyToAddr 公钥转为地址

func SetNormalAddrVer added in v1.65.1

func SetNormalAddrVer(ver byte)

SetNormalAddrVer 根据配置设置生成普通地址的version版本号,默认是0

Types

type Address

type Address struct {
	Version  byte
	Hash160  [20]byte // For a stealth address: it's HASH160
	Checksum []byte   // Unused for a stealth address
	Pubkey   []byte   // Unused for a stealth address
	Enc58str string
}

Address 地址

func GetExecAddress

func GetExecAddress(name string) *Address

GetExecAddress 获取地址

func HashToAddress

func HashToAddress(version byte, in []byte) *Address

HashToAddress hash32 to address

func NewAddrFromString

func NewAddrFromString(hs string) (a *Address, e error)

NewAddrFromString new 地址

func PubKeyToAddress

func PubKeyToAddress(in []byte) *Address

PubKeyToAddress 公钥转为地址

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte)

SetBytes 设置地址的bytes

func (*Address) String

func (a *Address) String() string

Jump to

Keyboard shortcuts

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