pq

package
v1.19.13 Latest Latest
Warning

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

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

Documentation

Overview

Package pq implements the post-quantum consensus engine that combines classical and quantum-resistant consensus mechanisms.

Package pq implements post-quantum hardened consensus.

PQ uses quantum-safe cryptographic primitives throughout the consensus pipeline: ML-KEM for key exchange, ML-DSA for signatures, and hybrid certificates from the quasar overlay. The topology can be linear or DAG, but all operations are quantum-resistant for long-term security.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsensusEngine

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

ConsensusEngine implements post-quantum consensus combining classical and quantum-resistant security

func NewConsensus

func NewConsensus(params config.Parameters) *ConsensusEngine

NewConsensus creates a new post-quantum consensus engine

func (*ConsensusEngine) FinalityChannel

func (e *ConsensusEngine) FinalityChannel() <-chan FinalityEvent

FinalityChannel returns the channel for finality events

func (*ConsensusEngine) Height

func (e *ConsensusEngine) Height() uint64

Height returns the current finalized height

func (*ConsensusEngine) Initialize

func (e *ConsensusEngine) Initialize(ctx context.Context, blsKey, pqKey []byte) error

Initialize sets up the PQ engine with keys

func (*ConsensusEngine) IsFinalized

func (e *ConsensusEngine) IsFinalized(blockID ids.ID) bool

IsFinalized checks if a block has achieved PQ finality

func (*ConsensusEngine) Metrics

func (e *ConsensusEngine) Metrics() map[string]interface{}

Metrics returns engine metrics

func (*ConsensusEngine) ProcessBlock

func (e *ConsensusEngine) ProcessBlock(ctx context.Context, blockID ids.ID, votes map[string]int) error

ProcessBlock processes a block through PQ consensus

func (*ConsensusEngine) SetFinalizedCallback

func (e *ConsensusEngine) SetFinalizedCallback(cb func(FinalityEvent))

SetFinalizedCallback sets a callback for finalized blocks

type Engine

type Engine interface {
	// Start starts the engine
	Start(context.Context, uint32) error

	// Stop stops the engine
	Stop(context.Context) error

	// HealthCheck performs a health check
	HealthCheck(context.Context) (interface{}, error)

	// IsBootstrapped returns whether the engine is bootstrapped
	IsBootstrapped() bool

	// VerifyQuantumSignature verifies a post-quantum signature
	VerifyQuantumSignature([]byte, []byte, []byte) error

	// GenerateQuantumProof generates a quantum-resistant proof
	GenerateQuantumProof(context.Context, ids.ID) ([]byte, error)
}

Engine defines the post-quantum consensus engine

type FinalityEvent

type FinalityEvent struct {
	Height    uint64
	BlockID   ids.ID
	Timestamp time.Time
	PQProof   []byte // Post-quantum proof
	BLSProof  []byte // Classical BLS proof
}

FinalityEvent represents a finalized block with quantum-resistant proofs

type PostQuantum

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

PostQuantum implements post-quantum consensus engine

func New

func New() *PostQuantum

New creates a new post-quantum consensus engine

func (*PostQuantum) GenerateQuantumProof

func (pq *PostQuantum) GenerateQuantumProof(ctx context.Context, blockID ids.ID) ([]byte, error)

GenerateQuantumProof generates a quantum-resistant proof

func (*PostQuantum) HealthCheck

func (pq *PostQuantum) HealthCheck(ctx context.Context) (interface{}, error)

HealthCheck performs a health check

func (*PostQuantum) IsBootstrapped

func (pq *PostQuantum) IsBootstrapped() bool

IsBootstrapped returns whether the engine is bootstrapped

func (*PostQuantum) Start

func (pq *PostQuantum) Start(ctx context.Context, requestID uint32) error

Start starts the engine

func (*PostQuantum) Stop

func (pq *PostQuantum) Stop(ctx context.Context) error

Stop stops the engine

func (*PostQuantum) VerifyQuantumSignature

func (pq *PostQuantum) VerifyQuantumSignature(message, signature, publicKey []byte) error

VerifyQuantumSignature verifies a post-quantum signature

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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