bls

package
v3.2.3-rc.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: GPL-3.0 Imports: 6 Imported by: 7

Documentation

Overview

Package bls implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme. This package exposes a public API for verifying and aggregating BLS signatures used by Ethereum.

Index

Constants

View Source
const AggregatedSignature = "bls aggregated signature"

AggregatedSignature represents aggregated signature produced by AggregateBatch()

View Source
const CurveOrder = "52435875175126190479447740508185965837690552500527637822603658699938581184513"

CurveOrder for the BLS12-381 curve.

View Source
const DomainByteLength = 4

DomainByteLength length of domain byte array.

Variables

This section is empty.

Functions

func AggregateCompressedSignatures

func AggregateCompressedSignatures(multiSigs [][]byte) (common.Signature, error)

AggregateCompressedSignatures converts a list of compressed signatures into a single, aggregated sig.

func AggregateSignatures

func AggregateSignatures(sigs []common.Signature) common.Signature

AggregateSignatures converts a list of signatures into a single, aggregated sig.

func NewAggregateSignature

func NewAggregateSignature() common.Signature

NewAggregateSignature creates a blank aggregate signature.

func RandKey

func RandKey() (common.SecretKey, error)

RandKey creates a new private key using a random input.

func VerifyMultipleSignatures

func VerifyMultipleSignatures(sigs [][]byte, msgs [][32]byte, pubKeys []common.PublicKey) (bool, error)

VerifyMultipleSignatures verifies multiple signatures for distinct messages securely.

func VerifySignature added in v3.2.1

func VerifySignature(sig []byte, msg [32]byte, pubKey common.PublicKey) (bool, error)

VerifySignature verifies a single signature. For performance reason, always use VerifyMultipleSignatures if possible.

Types

type PublicKey

type PublicKey = common.PublicKey

PublicKey represents a BLS public key.

func AggregateMultiplePubkeys

func AggregateMultiplePubkeys(pubs []PublicKey) PublicKey

AggregateMultiplePubkeys aggregates the provided decompressed keys into a single key.

func AggregatePublicKeys

func AggregatePublicKeys(pubs [][]byte) (PublicKey, error)

AggregatePublicKeys aggregates the provided raw public keys into a single key.

func PublicKeyFromBytes

func PublicKeyFromBytes(pubKey []byte) (PublicKey, error)

PublicKeyFromBytes creates a BLS public key from a BigEndian byte slice.

type SecretKey

type SecretKey = common.SecretKey

SecretKey represents a BLS secret or private key.

func SecretKeyFromBytes

func SecretKeyFromBytes(privKey []byte) (SecretKey, error)

SecretKeyFromBytes creates a BLS private key from a BigEndian byte slice.

type Signature

type Signature = common.Signature

Signature represents a BLS signature.

func MultipleSignaturesFromBytes

func MultipleSignaturesFromBytes(sigs [][]byte) ([]Signature, error)

MultipleSignaturesFromBytes creates a slice of BLS signatures from a LittleEndian 2d-byte slice.

func SignatureFromBytes

func SignatureFromBytes(sig []byte) (Signature, error)

SignatureFromBytes creates a BLS signature from a LittleEndian byte slice.

type SignatureBatch

type SignatureBatch struct {
	Signatures   [][]byte
	PublicKeys   []PublicKey
	Messages     [][32]byte
	Descriptions []string
}

SignatureBatch refers to the defined set of signatures and its respective public keys and messages required to verify it.

func NewSet

func NewSet() *SignatureBatch

NewSet constructs an empty signature batch object.

func (*SignatureBatch) AggregateBatch

func (s *SignatureBatch) AggregateBatch() (*SignatureBatch, error)

AggregateBatch aggregates common messages in the provided batch to reduce the number of pairings required when we finally verify the whole batch.

func (*SignatureBatch) Copy

func (s *SignatureBatch) Copy() *SignatureBatch

Copy the attached signature batch and return it to the caller.

func (*SignatureBatch) Join

Join merges the provided signature batch to out current one.

func (*SignatureBatch) RemoveDuplicates

func (s *SignatureBatch) RemoveDuplicates() (int, *SignatureBatch, error)

RemoveDuplicates removes duplicate signature sets from the signature batch.

func (*SignatureBatch) Verify

func (s *SignatureBatch) Verify() (bool, error)

Verify the current signature batch using the batch verify algorithm.

func (*SignatureBatch) VerifyVerbosely added in v3.2.1

func (s *SignatureBatch) VerifyVerbosely() (bool, error)

VerifyVerbosely verifies signatures as a whole at first, if fails, fallback to verify each single signature to identify invalid ones.

Directories

Path Synopsis
Package blst implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
Package blst implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
Package common provides the BLS interfaces that are implemented by the various BLS wrappers.
Package common provides the BLS interfaces that are implemented by the various BLS wrappers.
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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