bls

package module
v0.0.0-...-2ae2f20 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 7 Imported by: 0

README

comet-bls12-381

A library for integrating bls12-381 into CometBFT

This conforms to the Ethereum 2.0 specification linked here.

Documentation

Index

Constants

View Source
const (
	// PrivKeySize defines the length of the PrivKey byte array.
	PrivKeySize = 32
	// PubKeySize defines the length of the PubKey byte array.
	PubKeySize = 48
	// KeyType is the string constant for the bls12_381 algorithm.
	KeyType = "bls12_381"
)
View Source
const (
	PrivKeyName = "cometbft/PrivKeyBLS12_381"
	PubKeyName  = "cometbft/PubKeyBLS12_381"
)

-------------------------------------.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrivKey

type PrivKey []byte

func GenPrivKey

func GenPrivKey() (PrivKey, error)

func NewPrivateKeyFromBytes

func NewPrivateKeyFromBytes(bz []byte) (PrivKey, error)

func (PrivKey) Bytes

func (privKey PrivKey) Bytes() []byte

Bytes returns the byte representation of the ECDSA Private Key.

func (PrivKey) Equals

func (privKey PrivKey) Equals(other cmtcrypto.PrivKey) bool

Equals returns true if two ECDSA private keys are equal and false otherwise.

func (PrivKey) PubKey

func (privKey PrivKey) PubKey() cmtcrypto.PubKey

PubKey returns the ECDSA private key's public key. If the privkey is not valid it returns a nil value.

func (PrivKey) Sign

func (privKey PrivKey) Sign(digestBz []byte) ([]byte, error)

func (PrivKey) Type

func (privKey PrivKey) Type() string

Type returns eth_bls12_381.

type PubKey

type PubKey []byte

func (PubKey) Address

func (pubKey PubKey) Address() cmtcrypto.Address

Address returns the address of the ECDSA public key. The function will return an empty address if the public key is invalid.

func (PubKey) Bytes

func (pubKey PubKey) Bytes() []byte

Bytes returns the pubkey byte format.

func (PubKey) Equals

func (pubKey PubKey) Equals(other cmtcrypto.PubKey) bool

Equals returns true if the pubkey type is the same and their bytes are deeply equal.

func (PubKey) Type

func (pubKey PubKey) Type() string

Type returns eth_bls12_381.

func (PubKey) VerifySignature

func (pubKey PubKey) VerifySignature(msg, sig []byte) bool

Directories

Path Synopsis
bls
blst
Package blst implements a go-wrapper around a library implementing the BLS12-381 curve and signature scheme.
Package blst implements a go-wrapper around a library implementing the BLS12-381 curve and signature scheme.

Jump to

Keyboard shortcuts

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