aggregated

package
v1.17.27 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedSignature

type AggregatedSignature struct {
	Type              SignatureType         `json:"type"`
	Signature         []byte                `json:"signature"`
	SignerIDs         []ids.NodeID          `json:"signerIds,omitempty"`
	SignerCount       int                   `json:"signerCount"`
	ThresholdPubKeys  []*ThresholdPublicKey `json:"thresholdPubKeys,omitempty"` // For Ringtail threshold
	AggregateKey      []byte                `json:"aggregateKey,omitempty"`     // For BLS
	ThresholdRequired int                   `json:"threshold,omitempty"`        // For threshold schemes
	TotalFee          uint64                `json:"totalFee"`
}

AggregatedSignature represents an aggregated signature with metadata

type AggregationSession

type AggregationSession struct {
	SessionID     string
	Message       []byte
	SignatureType SignatureType

	// Collected signatures
	BLSSignatures       []*bls.Signature
	BLSPublicKeys       []*bls.PublicKey
	ThresholdSignatures []*ThresholdSignature
	ThresholdPubKeys    []*ThresholdPublicKey

	// Signers
	Signers     map[ids.NodeID]bool
	SignerCount int

	// Status
	StartTime int64
	Completed bool
	Result    *AggregatedSignature
}

AggregationSession represents an active signature aggregation

type BLSManager

type BLSManager struct {
	// contains filtered or unexported fields
}

BLSManager manages BLS signature operations

func NewBLSManager

func NewBLSManager(log log.Logger) *BLSManager

NewBLSManager creates a new BLS manager

func (*BLSManager) CreateKeyPair

func (m *BLSManager) CreateKeyPair() (*bls.SecretKey, *bls.PublicKey, error)

CreateKeyPair generates a new BLS key pair

func (*BLSManager) Sign

func (m *BLSManager) Sign(sk *bls.SecretKey, message []byte) (*bls.Signature, error)

Sign creates a BLS signature

type CGGMP21Manager

type CGGMP21Manager struct {
	// contains filtered or unexported fields
}

CGGMP21Manager manages CGGMP21 threshold signature operations

func NewCGGMP21Manager

func NewCGGMP21Manager(log log.Logger) *CGGMP21Manager

NewCGGMP21Manager creates a new CGGMP21 manager

func (*CGGMP21Manager) GetParty

func (m *CGGMP21Manager) GetParty(index int) (*cggmp21.Party, error)

GetParty retrieves a CGGMP21 party by index

func (*CGGMP21Manager) InitializeParty

func (m *CGGMP21Manager) InitializeParty(
	partyID ids.NodeID,
	index int,
	config *cggmp21.Config,
) error

InitializeParty creates a new CGGMP21 party

type FeeCollector

type FeeCollector struct {
	// contains filtered or unexported fields
}

FeeCollector manages fee collection for signature operations

func NewFeeCollector

func NewFeeCollector() FeeCollector

NewFeeCollector creates a new fee collector

func (*FeeCollector) CollectFee

func (fc *FeeCollector) CollectFee(sigType SignatureType, amount uint64)

CollectFee records a fee collection

func (*FeeCollector) GetCollectedFees

func (fc *FeeCollector) GetCollectedFees() map[SignatureType]uint64

GetCollectedFees returns total collected fees by type

func (*FeeCollector) GetTotalFees

func (fc *FeeCollector) GetTotalFees() uint64

GetTotalFees returns the total of all collected fees

func (*FeeCollector) ResetFees

func (fc *FeeCollector) ResetFees() map[SignatureType]uint64

ResetFees resets the fee collection

type SignatureAggregator

type SignatureAggregator struct {
	// contains filtered or unexported fields
}

SignatureAggregator manages network-wide signature aggregation

func NewSignatureAggregator

func NewSignatureAggregator(config SignatureConfig, log log.Logger) (*SignatureAggregator, error)

NewSignatureAggregator creates a new signature aggregator

func (*SignatureAggregator) AddSignature

func (sa *SignatureAggregator) AddSignature(
	sessionID string,
	signerID ids.NodeID,
	signature []byte,
	publicKey []byte,
) error

AddSignature adds a signature to an aggregation session

func (*SignatureAggregator) Cleanup

func (sa *SignatureAggregator) Cleanup(maxAge int64)

Cleanup removes old sessions

func (*SignatureAggregator) FinalizeAggregation

func (sa *SignatureAggregator) FinalizeAggregation(
	sessionID string,
	requiredSigners int,
) (*AggregatedSignature, error)

FinalizeAggregation completes the aggregation and returns the result

func (*SignatureAggregator) GetSessionStatus

func (sa *SignatureAggregator) GetSessionStatus(sessionID string) (map[string]interface{}, error)

GetSessionStatus returns the status of an aggregation session

func (*SignatureAggregator) StartAggregation

func (sa *SignatureAggregator) StartAggregation(
	sessionID string,
	message []byte,
	sigType SignatureType,
	expectedSigners int,
) error

StartAggregation starts a new signature aggregation session

func (*SignatureAggregator) VerifyAggregatedSignature

func (sa *SignatureAggregator) VerifyAggregatedSignature(
	message []byte,
	aggSig *AggregatedSignature,
) error

VerifyAggregatedSignature verifies an aggregated signature

type SignatureConfig

type SignatureConfig struct {
	// Network-wide signature type preference
	PreferredType SignatureType `json:"preferredType"`

	// Enable specific signature types
	EnableBLS      bool `json:"enableBLS"`
	EnableRingtail bool `json:"enableRingtail"`
	EnableCGGMP21  bool `json:"enableCGGMP21"`

	// Fee configuration (in nLUX - nano LUX)
	BLSFee      uint64 `json:"blsFee"`      // 0 = free
	RingtailFee uint64 `json:"ringtailFee"` // Premium for enhanced privacy
	CGGMP21Fee  uint64 `json:"cggmp21Fee"`  // Premium for threshold signatures

	// Performance settings
	ParallelAggregation bool `json:"parallelAggregation"`
	MaxSignersPerRound  int  `json:"maxSignersPerRound"`

	// Security settings
	MinSigners     int     `json:"minSigners"`
	ThresholdRatio float64 `json:"thresholdRatio"` // e.g., 0.67 for 2/3
}

SignatureConfig contains configuration for signature aggregation

type SignatureType

type SignatureType uint8

SignatureType represents the type of aggregated signature

const (
	SignatureTypeBLS SignatureType = iota
	SignatureTypeRingtail
	SignatureTypeCGGMP21
)

type ThresholdManager added in v1.17.24

type ThresholdManager struct {
	// contains filtered or unexported fields
}

ThresholdManager manages threshold signature operations Actual threshold operations use github.com/luxfi/threshold

func NewThresholdManager added in v1.17.24

func NewThresholdManager(log log.Logger) *ThresholdManager

NewThresholdManager creates a new threshold manager

type ThresholdPublicKey added in v1.17.24

type ThresholdPublicKey struct {
	Bytes []byte
}

ThresholdPublicKey is a placeholder for threshold public keys. Actual threshold operations use github.com/luxfi/threshold protocols.

func (*ThresholdPublicKey) Equal added in v1.17.24

func (pk *ThresholdPublicKey) Equal(other *ThresholdPublicKey) bool

Equal checks if two threshold public keys are equal

type ThresholdSignature added in v1.17.24

type ThresholdSignature struct {
	Bytes []byte
}

ThresholdSignature is a placeholder for threshold signatures. Actual threshold operations use github.com/luxfi/threshold protocols.

func (*ThresholdSignature) Verify added in v1.17.24

func (ts *ThresholdSignature) Verify(message []byte) bool

Verify is a placeholder - actual verification uses threshold package

Jump to

Keyboard shortcuts

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