secp256k1eth

package
v0.0.0-...-3c905e5 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: BSD-3-Clause Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Name = "secp256k1eth"
	ID   = 260
)

const

Variables

This section is empty.

Functions

func CaculCoinsEvmAccountKey

func CaculCoinsEvmAccountKey(addr string) []byte

CaculCoinsEvmAccountKey 兼容eth 账户的nonce 的key

func GetEvmChainID

func GetEvmChainID() int64

GetEvmChainID return evm chainID

Types

type Driver

type Driver struct{}

Driver 驱动

func (Driver) GenKey

func (d Driver) GenKey() (crypto.PrivKey, error)

GenKey 生成私钥

func (Driver) PrivKeyFromBytes

func (d Driver) PrivKeyFromBytes(b []byte) (crypto.PrivKey, error)

PrivKeyFromBytes 字节转为私钥

func (Driver) PubKeyFromBytes

func (d Driver) PubKeyFromBytes(b []byte) (crypto.PubKey, error)

PubKeyFromBytes must 65 bytes uncompress key

func (Driver) SignatureFromBytes

func (d Driver) SignatureFromBytes(b []byte) (crypto.Signature, error)

SignatureFromBytes 对字节数组签名

func (Driver) Validate

func (d Driver) Validate(msg, pub, sig []byte) error

Validate check signature

type PrivKeySecp256k1Eth

type PrivKeySecp256k1Eth [32]byte

PrivKeySecp256k1Eth PrivKey

func (PrivKeySecp256k1Eth) Bytes

func (privKey PrivKeySecp256k1Eth) Bytes() []byte

Bytes 字节格式

func (PrivKeySecp256k1Eth) Equals

func (privKey PrivKeySecp256k1Eth) Equals(other crypto.PrivKey) bool

Equals 私钥是否相等

func (PrivKeySecp256k1Eth) PubKey

func (privKey PrivKeySecp256k1Eth) PubKey() crypto.PubKey

PubKey 私钥生成公钥 非压缩 65 bytes 0x04+pub.X+pub.Y

func (PrivKeySecp256k1Eth) Sign

func (privKey PrivKeySecp256k1Eth) Sign(msg []byte) crypto.Signature

Sign 签名 The produced signature is in the [R || S || V] format where V is 0 or 1.

func (PrivKeySecp256k1Eth) String

func (privKey PrivKeySecp256k1Eth) String() string

type PubKeySecp256k1Eth

type PubKeySecp256k1Eth [65]byte

PubKeySecp256k1Eth uncompressed pubkey (just the x-cord), prefixed with 0x04

func (PubKeySecp256k1Eth) Bytes

func (pubKey PubKeySecp256k1Eth) Bytes() []byte

Bytes 字节格式

func (PubKeySecp256k1Eth) Equals

func (pubKey PubKeySecp256k1Eth) Equals(other crypto.PubKey) bool

Equals 公钥相等

func (PubKeySecp256k1Eth) KeyString

func (pubKey PubKeySecp256k1Eth) KeyString() string

KeyString Must return the full bytes in hex. Used for map keying, etc.

func (PubKeySecp256k1Eth) String

func (pubKey PubKeySecp256k1Eth) String() string

func (PubKeySecp256k1Eth) VerifyBytes

func (pubKey PubKeySecp256k1Eth) VerifyBytes(msg []byte, sig crypto.Signature) bool

VerifyBytes 验证字节

type SignatureS

type SignatureS struct {
	crypto.Signature
}

SignatureS 签名

type SignatureSecp256k1Eth

type SignatureSecp256k1Eth []byte

SignatureSecp256k1Eth Signature

func (SignatureSecp256k1Eth) Bytes

func (sig SignatureSecp256k1Eth) Bytes() []byte

Bytes 字节格式

func (SignatureSecp256k1Eth) Equals

func (sig SignatureSecp256k1Eth) Equals(other crypto.Signature) bool

Equals 相等

func (SignatureSecp256k1Eth) IsZero

func (sig SignatureSecp256k1Eth) IsZero() bool

IsZero 是否是0

func (SignatureSecp256k1Eth) String

func (sig SignatureSecp256k1Eth) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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