Consensus Specifications

LP-0100 Series - Consensus mechanisms for Lux Network

Consensus Specifications (LP-0100 Series)

The LP-0100 series defines consensus mechanisms for the Lux Network, including Photon (chain consensus), Flare (DAG consensus), and Quasar (post-quantum consensus).

LP Index

LPTitleStatusImplementation
LP-0111Photon ConsensusFinalluxfi/consensus
LP-0112Flare DAG ConsensusFinalluxfi/consensus/dag
LP-0120FPC Fast FinalityFinalluxfi/consensus/fpc
LP-4099Quasar PQ ConsensusAcceptedluxfi/consensus/pq

LP-0111: Photon Consensus

Abstract

LP-0111 defines Photon, the primary chain consensus mechanism for Lux Network. Photon achieves sub-second finality with Byzantine fault tolerance up to 1/3 of validators.

Key Properties

PropertyValueNotes
Finality< 1 secondProbabilistic → deterministic
Fault Tolerancef < n/3Byzantine
Throughput4,500+ TPSPer chain
Validators100-1000Configurable

Consensus Flow

┌─────────────────────────────────────────────────────────────┐
│                    PHOTON CONSENSUS                          │
├─────────────────────────────────────────────────────────────┤
│                                                               │
│  Round 1: Propose                                            │
│  ┌─────────┐                                                 │
│  │ Leader  │ ──broadcast──> All validators                   │
│  │ Block   │                                                 │
│  └─────────┘                                                 │
│                                                               │
│  Round 2: Pre-Vote                                           │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐                      │
│  │ Vote 1  │  │ Vote 2  │  │ Vote N  │ ──> 2/3 threshold    │
│  └─────────┘  └─────────┘  └─────────┘                      │
│                                                               │
│  Round 3: Pre-Commit                                         │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐                      │
│  │Commit 1 │  │Commit 2 │  │Commit N │ ──> 2/3 threshold    │
│  └─────────┘  └─────────┘  └─────────┘                      │
│                                                               │
│  Round 4: Finalize                                           │
│  Block committed to chain with 2/3+ signatures               │
│                                                               │
└─────────────────────────────────────────────────────────────┘

Validator Selection

// Validator stake-weighted selection
type ValidatorSet struct {
    Validators []Validator
    TotalStake uint64
}

func (vs *ValidatorSet) SelectProposer(round uint64) Validator {
    // Deterministic selection based on stake weight
    seed := hash(round)
    target := seed % vs.TotalStake

    cumulative := uint64(0)
    for _, v := range vs.Validators {
        cumulative += v.Stake
        if cumulative > target {
            return v
        }
    }
    return vs.Validators[0]
}

Implementation

Repository: luxfi/consensus

import "github.com/luxfi/consensus/engine/chain"

// Create consensus engine
engine := chain.NewEngine(&chain.Config{
    Validators:    validatorSet,
    BlockTime:     500 * time.Millisecond,
    TimeoutPropose: 3 * time.Second,
    TimeoutPrevote: 1 * time.Second,
    TimeoutPrecommit: 1 * time.Second,
})

// Start consensus
engine.Start(ctx)

LP-0112: Flare DAG Consensus

Abstract

LP-0112 defines Flare, a DAG-based consensus mechanism for high-throughput parallel transaction processing. Flare enables multiple blocks to be processed simultaneously while maintaining total ordering.

Key Properties

PropertyValueNotes
StructureDAGDirected Acyclic Graph
Parallelism16-64 blocksSimultaneous processing
Throughput10,000+ TPSWith parallelism
Finality< 500msProbabilistic

DAG Structure

        ┌───┐
        │ G │  Genesis
        └─┬─┘

    ┌─────┼─────┐
    │     │     │
  ┌─┴─┐ ┌─┴─┐ ┌─┴─┐
  │B1 │ │B2 │ │B3 │  Epoch 1 (parallel)
  └─┬─┘ └─┬─┘ └─┬─┘
    │     │     │
    └──┬──┴──┬──┘
       │     │
     ┌─┴─┐ ┌─┴─┐
     │B4 │ │B5 │      Epoch 2 (parallel)
     └─┬─┘ └─┬─┘
       │     │
       └──┬──┘

        ┌─┴─┐
        │B6 │          Merge block
        └───┘

Conflict Resolution

type ConflictResolver interface {
    // Detect conflicts between parallel blocks
    DetectConflicts(blocks []*Block) []Conflict

    // Resolve conflicts using deterministic ordering
    Resolve(conflicts []Conflict) (*Block, error)
}

// Resolution rules:
// 1. Earlier timestamp wins
// 2. Tie: Lower block hash wins
// 3. Merge blocks consolidate state

Use Cases

Use CaseBenefit
High-throughput chains10x+ throughput
Parallel VM executionConcurrent contracts
Cross-shard communicationEfficient routing

LP-0120: FPC Fast Finality

Abstract

LP-0120 defines Fast Probabilistic Consensus (FPC), a Byzantine agreement protocol achieving 1ms finality through repeated random sampling of validators.

Key Properties

PropertyValueNotes
Finality~1msHigh confidence
Rounds3-5Typical convergence
Sample SizeK=3-20Configurable
Threshold2/3 (67%)Agreement threshold

FPC Protocol

INITIALIZE:
    opinion = initial_value  // 0 or 1
    confidence = 0

FOR round IN 1..MAX_ROUNDS:
    // Sample K random validators
    sample = RandomSample(validators, K)

    // Query opinions
    votes = QueryOpinions(sample)

    // Count votes
    yes_count = Count(votes, 1)
    no_count = Count(votes, 0)

    // Update opinion based on threshold
    IF yes_count >= THRESHOLD:
        opinion = 1
        confidence++
    ELSE IF no_count >= THRESHOLD:
        opinion = 0
        confidence++
    ELSE:
        confidence = 0  // Reset on tie

    // Check for finality
    IF confidence >= FINALITY_THRESHOLD:
        RETURN opinion  // Finalized!

RETURN UNDECIDED

Configuration

type FPCConfig struct {
    K                 int           // Sample size (default: 3)
    Threshold         float64       // Agreement threshold (default: 0.67)
    MaxRounds         int           // Maximum rounds (default: 100)
    FinalityThreshold int           // Consecutive agreements (default: 3)
    QueryTimeout      time.Duration // Per-query timeout (default: 100ms)
}

Performance

K ValueRounds to FinalityLatency
K=33-5~1ms
K=105-8~3ms
K=208-12~5ms

LP-4099: Quasar Post-Quantum Consensus

Abstract

LP-4099 defines Quasar, a post-quantum consensus mechanism using lattice-based signatures (Dilithium/Ringtail) for quantum-resistant validator attestations.

Key Properties

PropertyValueNotes
SignatureDilithium/RingtailNIST PQC finalists
Security128-256 bit PQQuantum resistant
Signature Size2.4-3.3 KBLarger than ECDSA
Verification~0.5msPer signature

Hybrid Signature Mode

// Hybrid BLS + Ringtail for transition period
type HybridSignature struct {
    BLSSignature      [96]byte   // Classical (aggregate)
    RingtailSignature []byte     // Post-quantum
    PublicKeys        [][]byte   // RT public keys
}

func (h *HybridSignature) Verify(msg []byte, validators []Validator) error {
    // Both must verify for hybrid mode
    if err := h.verifyBLS(msg, validators); err != nil {
        return err
    }
    if err := h.verifyRingtail(msg, validators); err != nil {
        return err
    }
    return nil
}

Migration Path

Phase 1 (Current):  BLS-only signatures

Phase 2 (Hybrid):   BLS + Ringtail dual signatures

Phase 3 (Future):   Ringtail-only (full PQ)

Security Levels

LevelAlgorithmClassicalQuantum
1ML-DSA-44128-bit128-bit
2ML-DSA-65192-bit192-bit
3ML-DSA-87256-bit256-bit

Implementation Status

LPStatusVersionRepository
LP-0111Implementedv1.22.0luxfi/consensus
LP-0112Implementedv1.22.0luxfi/consensus
LP-0120Implementedv1.22.0luxfi/consensus
LP-4099In Developmentv0.5.0luxfi/consensus

Consensus Selection Guide

Use CaseRecommendedReason
General transactionsLP-0111 PhotonBattle-tested, secure
High throughputLP-0112 FlareParallel processing
Fast finalityLP-0120 FPC1ms finality
Quantum securityLP-4099 QuasarFuture-proof
DEX settlementLP-0120 FPCLow latency critical