| Crates.io | verdyce |
| lib.rs | verdyce |
| version | 0.1.1 |
| created_at | 2025-07-24 15:51:26.462176+00 |
| updated_at | 2025-07-24 16:05:29.07395+00 |
| description | A time-decay threshold consensus engine for decentralized voting and governance with configurable decay models and dynamic thresholds. |
| homepage | https://github.com/Yuvraj-cyborg/verdyce |
| repository | https://github.com/Yuvraj-cyborg/verdyce |
| max_upload_size | |
| id | 1766216 |
| size | 60,094 |
A time-decay threshold consensus engine for decentralized voting and governance.
This library provides a pure Rust implementation of consensus mechanisms with configurable decay models and dynamic approval thresholds, allowing developers to build decentralized governance systems that encourage early participation while maintaining security through escalating scrutiny over time.
The following modules provide the core functionality:
engine provides the main consensus coordinator for managing proposals and votesmodels contains the core data structures for proposals and votesdecay implements time-decay models for vote weight calculationthreshold provides threshold progression functionswindow manages voting window state and timingAdd verdyce to your project to access all components:
[dependencies]
verdyce = "0.1.0"
A simple example of use follows. For more details, please visit the documentation.
use verdyce::{
engine::Engine,
models::{proposal::Proposal, vote::{Vote, VoteChoice}},
decay::DecayModel,
threshold::ThresholdModel,
};
use uuid::Uuid;
use chrono::Utc;
let mut engine = Engine::new();
let proposal = Proposal::new(
"Protocol Upgrade".to_string(),
"Upgrade to version 2.0".to_string(),
3600, // 1 hour voting period
DecayModel::Linear,
ThresholdModel::Linear(0.0001, 0.5),
);
let proposal_id = proposal.id;
engine.add_proposal(proposal);
let vote = Vote {
validator_id: Uuid::new_v4(),
choice: VoteChoice::Yes,
timestamp: Utc::now(),
revision: 0,
reason: None,
};
engine.cast_vote(proposal_id, vote);
engine.evaluate_all(Utc::now());
Vote weights decrease over time to encourage early participation:
Approval thresholds increase over time for higher scrutiny:
threshold = t × rate + startVote changes are penalized to discourage manipulation while allowing legitimate updates.
You can use Cargo to build the library:
cargo build
Minimum supported Rust version is 1.70.0.
Run the test suite:
cargo test
Generate and view documentation:
cargo doc --open
This project is under active development. Contributions are welcome! Please ensure:
cargo testcargo fmtcargo clippySee the contributor guidelines for more details.
Licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.