๐ณ๏ธ Verdyce Core โ Time-Decay Threshold Consensus Engine
A modular Rust library for decentralized voting and governance, built around time-decaying vote weights and escalating approval thresholds. Designed for validator governance, DAOs, and decentralized committees that need time-sensitive and fault-tolerant consensus.
๐๏ธ Architecture
flowchart TD
A[PROPOSAL CREATED] --> B[Voting Starts t = 0]
B --> C[Validators cast votes with timestamps]
C --> D[Apply decay + weight floor]
D --> E[Engine tallies votes]
E --> F{YES weight โฅ threshold?}
F -- Yes --> G[Proposal PASSES โ
]
F -- No --> H[Proposal FAILS โ]
๐ Core Features
๐ Time-Decay Voting
Vote weights decrease over time to encourage early participation:
- Linear: Steady decline from 1.0 to 0.1
- Exponential: Rapid early decline with configurable rate
- Stepped: Discrete weight levels (1.0 โ 0.5 โ 0.1)
๐ Dynamic Thresholds
Approval thresholds increase over time for higher scrutiny:
- Linear:
threshold = t ร rate + start - Exponential: Asymptotic growth with configurable parameters
- Sigmoid: S-curve progression for smooth transitions
๐ช Smart Voting Windows
- Configurable duration with grace periods
- Auto-extension when near threshold and time expiry
- State tracking: NotStarted โ Open โ Extended โ GracePeriod โ Expired
โ๏ธ Revision Penalties
Vote changes are penalized to discourage manipulation:
- Weight penalty:
base_weight / (1 + revisions)ยฒ - Minimum weight floor of 0.1 ensures all votes count
๐งฑ Project Structure
src/
โโโ lib.rs # Library entry point
โโโ engine.rs # Main consensus coordinator
โโโ models/ # Core data structures
โ โโโ proposal.rs # Proposal logic and evaluation
โ โโโ vote.rs # Vote structures and weight calculation
โโโ decay/ # Time-decay models
โโโ threshold/ # Threshold progression models
โโโ window/ # Voting window management
๐ Quick Start
Add to your Cargo.toml:
[]
= "0.1.0"
Basic Usage
use ;
use Uuid;
use Utc;
// Create consensus engine
let mut engine = new;
// Create a proposal with 1-hour voting period
let proposal = new;
let proposal_id = proposal.id;
engine.add_proposal;
// Cast a vote
let vote = Vote ;
engine.cast_vote;
// Evaluate all proposals
engine.evaluate_all;
// Check results
if let Some = engine.get_proposal
Advanced Configuration
use ;
// Exponential decay (rapid early decline)
let decay = Exponential;
// Sigmoid threshold (S-curve progression)
let threshold = Sigmoid;
let proposal = new;
๐งช Development
Prerequisites
- Rust (stable toolchain)
Build & Test
# Build the library
# Run all tests
# Run with documentation tests
# Check code quality
# Generate documentation
Running Examples
# Run integration tests
# Run specific test module
๐ Model Comparison
Decay Models
| Model | Early Weight | Mid Weight | Late Weight | Use Case |
|---|---|---|---|---|
| Linear | 1.0 | 0.5 | 0.1 | Steady participation incentive |
| Exponential | 1.0 | ~0.4 | 0.1 | Strong early participation bias |
| Stepped | 1.0 | 0.5 | 0.1 | Clear phase-based incentives |
Threshold Models
| Model | Early Threshold | Mid Threshold | Late Threshold | Behavior |
|---|---|---|---|---|
| Linear | Configurable | Steady increase | High | Predictable progression |
| Exponential | Low | Rapid increase | Asymptotic | Quick early decisions |
| Sigmoid | Low | Smooth transition | High | Balanced progression |
๐ค Contributing
Contributions are welcome! Please ensure:
- All tests pass:
cargo test - Code is properly formatted:
cargo fmt - No clippy warnings:
cargo clippy - Documentation is updated for public APIs
Development Workflow
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes with tests
- Ensure all checks pass
- Submit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.