byzantine

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const MaxByzantine = 0.33

MaxByzantine is the maximum fraction of malicious nodes we can tolerate BFT requires n > 3f, so with f malicious we need 3f+1 total

Variables

This section is empty.

Functions

This section is empty.

Types

type BFTAggregator

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

BFTAggregator aggregates reports with Byzantine fault tolerance

func NewBFTAggregator

func NewBFTAggregator(minWitnesses int) *BFTAggregator

NewBFTAggregator creates a BFT-aware aggregator

func (*BFTAggregator) AddReport

func (a *BFTAggregator) AddReport(report *SignedReport) bool

AddReport adds a signed report after verification

func (*BFTAggregator) Aggregate

func (a *BFTAggregator) Aggregate(target types.NodeID) (types.Belief, bool)

Aggregate computes belief tolerating up to f byzantine nodes

func (*BFTAggregator) CanTolerate

func (a *BFTAggregator) CanTolerate() int

CanTolerate returns how many byzantine nodes we can handle

type Keypair

type Keypair struct {
	Public  ed25519.PublicKey
	Private ed25519.PrivateKey
}

Keypair manages witness identity

func GenerateKeypair

func GenerateKeypair() (*Keypair, error)

GenerateKeypair creates a new witness identity

func (*Keypair) Sign

func (k *Keypair) Sign(target types.NodeID, belief types.Belief, timestamp uint64) *SignedReport

Sign creates a signed report

type SignedReport

type SignedReport struct {
	Witness   types.NodeID
	Target    types.NodeID
	Belief    types.Belief
	Timestamp uint64
	Signature []byte
	PublicKey ed25519.PublicKey
}

SignedReport is a witness report with cryptographic signature

func (*SignedReport) Verify

func (r *SignedReport) Verify() bool

Verify checks if signature is valid

Jump to

Keyboard shortcuts

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