Consensus Specifications LP-0100 Series - Consensus mechanisms for Lux Network
The LP-0100 series defines consensus mechanisms for the Lux Network, including Photon (chain consensus), Flare (DAG consensus), and Quasar (post-quantum consensus).
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.
Property Value Notes Finality < 1 second Probabilistic → deterministic Fault Tolerance f < n/3 Byzantine Throughput 4,500+ TPS Per chain Validators 100-1000 Configurable
┌─────────────────────────────────────────────────────────────┐
│ 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 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 ]
}
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 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.
Property Value Notes Structure DAG Directed Acyclic Graph Parallelism 16-64 blocks Simultaneous processing Throughput 10,000+ TPS With parallelism Finality < 500ms Probabilistic
┌───┐
│ G │ Genesis
└─┬─┘
│
┌─────┼─────┐
│ │ │
┌─┴─┐ ┌─┴─┐ ┌─┴─┐
│B1 │ │B2 │ │B3 │ Epoch 1 (parallel)
└─┬─┘ └─┬─┘ └─┬─┘
│ │ │
└──┬──┴──┬──┘
│ │
┌─┴─┐ ┌─┴─┐
│B4 │ │B5 │ Epoch 2 (parallel)
└─┬─┘ └─┬─┘
│ │
└──┬──┘
│
┌─┴─┐
│B6 │ Merge block
└───┘
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 Case Benefit High-throughput chains 10x+ throughput Parallel VM execution Concurrent contracts Cross-shard communication Efficient routing
LP-0120 defines Fast Probabilistic Consensus (FPC), a Byzantine agreement protocol achieving 1ms finality through repeated random sampling of validators.
Property Value Notes Finality ~1ms High confidence Rounds 3-5 Typical convergence Sample Size K=3-20 Configurable Threshold 2/3 (67%) Agreement threshold
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
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)
}
K Value Rounds to Finality Latency K=3 3-5 ~1ms K=10 5-8 ~3ms K=20 8-12 ~5ms
LP-4099 defines Quasar, a post-quantum consensus mechanism using lattice-based signatures (Dilithium/Ringtail) for quantum-resistant validator attestations.
Property Value Notes Signature Dilithium/Ringtail NIST PQC finalists Security 128-256 bit PQ Quantum resistant Signature Size 2.4-3.3 KB Larger than ECDSA Verification ~0.5ms Per signature
// 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
}
Phase 1 (Current): BLS-only signatures
↓
Phase 2 (Hybrid): BLS + Ringtail dual signatures
↓
Phase 3 (Future): Ringtail-only (full PQ)
Level Algorithm Classical Quantum 1 ML-DSA-44 128-bit 128-bit 2 ML-DSA-65 192-bit 192-bit 3 ML-DSA-87 256-bit 256-bit
Use Case Recommended Reason General transactions LP-0111 Photon Battle-tested, secure High throughput LP-0112 Flare Parallel processing Fast finality LP-0120 FPC 1ms finality Quantum security LP-4099 Quasar Future-proof DEX settlement LP-0120 FPC Low latency critical