vdf.rs - Proof of Work

The VDF (Verifiable Delay Function) module implements sequential proof-of-work computation using iterated Blake3 hashing. This approach provides deterministic timing for Bunkercoin's radio-synchronized mining while preventing parallelization attacks.

VDF Implementation

// src/vdf.rs (lines 1-11)
/// Simple VDF: iterate Blake3 hash `difficulty` times
/// This is NOT a real Wesolowski VDF, just a sequential proof-of-work
pub fn compute(seed: &[u8], difficulty: u32) -> [u8; 32] {
    let mut out = *blake3::hash(seed).as_bytes();
    for _ in 0..difficulty {
        out = *blake3::hash(&out).as_bytes();
    }
    out
}

Sequential Computation Properties

Non-Parallelizable Design

The VDF computation has several key properties:

Property
Implementation
Benefit

Sequential Dependency

Each iteration depends on the previous result

Prevents parallel speedup attacks

Deterministic Output

Same seed always produces same result

Enables verification by any node

Predictable Timing

Fixed iteration count ensures consistent duration

Critical for radio synchronization

Memory Efficient

Only requires 32 bytes of working memory

Suitable for resource-constrained environments

Blake3 Advantages for VDF

  • Fast computation: Optimized for sequential hashing performance

  • Cryptographic security: Collision-resistant hash function

  • Fixed output size: Always produces 32-byte results

  • Hardware efficiency: Works well on both desktop and embedded systems

Integration with Mining Process

Mining Algorithm Integration

Timing Synchronization

The VDF serves as a timing mechanism for radio-synchronized mining:

Verification Process

VDF Verification

The verification process is identical to the computation process, ensuring:

  • Transparency: Any node can verify VDF computation

  • Consensus: All nodes agree on valid VDF outputs

  • Trust minimization: No need to trust the miner's computation

Radio Environment Optimization

Power Consumption Considerations

The VDF is optimized for radio deployment scenarios:

Fixed Difficulty Strategy

Unlike Bitcoin's adaptive difficulty, Bunkercoin uses fixed difficulty:

Aspect
Bitcoin
Bunkercoin

Difficulty Adjustment

Every 2016 blocks

Fixed at 10,000 iterations

Block Time Target

~10 minutes

Exactly 30 seconds

Computation Predictability

Variable based on network hashrate

Deterministic based on hardware

Radio Suitability

Unpredictable timing

Predictable transmission windows

Performance Characteristics

Benchmark Data

Typical VDF performance on various hardware:

Hardware Scaling

The VDF timing scales predictably across hardware:

  • High-end systems: May complete in 15 seconds (faster than 30-second target)

  • Low-end systems: May take 60+ seconds (mining lag acceptable)

  • Power-constrained: Battery-powered nodes can throttle computation

Security Analysis

Attack Resistance

The VDF provides security against several attack vectors:

Parallel Computation Attacks

ASIC Resistance

  • Memory access patterns: Sequential hashing resists ASIC optimization

  • Algorithm simplicity: Blake3 is well-understood and difficult to optimize beyond software implementations

  • Economic barriers: Fixed difficulty eliminates mining profitability incentives

Cryptographic Properties

Property
Implementation
Security Implication

Pseudorandomness

Blake3 output appears random

VDF outputs are unpredictable

Collision Resistance

Blake3 security properties

Prevents VDF result forgery

One-way Function

Hash function irreversibility

Cannot work backwards from result

Future Enhancements

Real Wesolowski VDF Implementation

Plans for upgrading to a cryptographically rigorous VDF:

Adaptive Difficulty

Future versions may implement adaptive difficulty while maintaining radio compatibility:

Hardware-Specific Optimization

  • ARM NEON acceleration: SIMD optimizations for embedded systems

  • RISC-V support: Optimizations for open-source hardware

  • FPGA implementations: Specialized hardware for radio base stations

  • Power management integration: Dynamic frequency scaling during VDF computation

Last updated