---
# System prepended metadata

title: Decracy Democracy Module

---

# Decracy Democracy Module

Decracy represents democracy at its purest form, with the goal every human to have a single vote in the system. 

Since the inception of the decentralized systems, the major bottleneck was always the governance of it. A lot of projects tried to solve it via masternodes or validators, with proof of work or proof of stake, or even with on-chain voting, with less or no true success. 

Almost every solution has its flaws and most specifically the problem to identify if each node represents a single voter or a voter or a group of voters with a lot of resources can take advantage of the system and enforce a silent coup. Democracy in a decentralized system can only be achieved if the system is fair to everyone and makes sure that each node/validator represents a single human.

Decracy with the usage of X-ID validators solves that issue as a voter will always represent a single human being. X-ID validators are required to attach their biometrical data with the X-ID validator address to acquire a digital identity within the system. Users can participate in the network without that requirement but are only watchers of the system while all X-ID validated users are validating the network.

### Democracy User Structure

#### The Watchers

Watchers are the simplest nodes that exist in the system and can be spawn by anyone and participate in the network with no other requirement than running the node software. As the name suggests they are only available to watch the chain and sync with the network, they are also able to help other "watchers"  to sync up to the latest event block of the chain.

Watchers also batch the chain on each checkpoint so they can keep the data fingerprint minimal(light client). This gives them the advantage of being very light for the underlying system, as mobile devices and so on.

#### The Stakers

Stakers are nodes that hold collateral to validate a part of the event blocks. The stakers need to be almost all the time online serving the network and proving that they hold the collateral locked to be considered for validation and rewards.


#### The X-ID Validators

X-ID validators are nodes that contain in an encrypted form the biometrics of each user, one human one node, and are responsible for the event block validation. They don't need to hold collateral and get rewarded for the validation of each event block.


### The Rules In Democracy

While trying to preserve a truly democratic vision we have also to consider that one of the most fundamental ideas in a democracy is that humans are responsible for their actions. The same thing applies to Decracy as each node has a reputation system that goes along with it. 

Misbehavior or absence of a role execution will eventually lead to penalization of the user according to the severity of the action.

If users/nodes take a responsibility in the network as X-ID or staked validators, they need to be present to 95% of the event blocks in each epoch of the chain as a fundamental rule. Lazy validators are slashed on rewards and reputation as this is also taken as a penalized action.


### Modules

#### Voting

Voting takes place in Decracy among the X-ID validators and only them.
X-ID users can make proposals in the system and get voting on them.
Proposals are only made from validators that have a clean reputation and are part of the system for a maturity time.

Proposals have a lifetime period in event blocks that remain active and collect votes. A decision depending on the votes is taken with the due of the lifetime of the proposal.

Each X-ID validator has a cool down period after a proposal.
The cool down period is a 30 days silence of proposals to avoid the spam and misuse of the system. That will also encourage the proper usage of the system so it can be defended against crowd noise spam.


```rust
/// Decision represents the type of decisions available for
/// a proposal
pub enum Decision {
    /// Accepted represents a accepted decision on the system
    Accepted,
    /// Rejected represents a rejected desicion on the system
    Rejected,
    /// Tie represents a tied proposal on the system
    Tie,
    /// Pending represents a pending proposal on the system
    Pending,
}

/// Proposal represents the structure of a proposal in the system
pub struct Proposal {
    /// sig represents a signature of the peer_id, public_key of the node 
    /// that made the proposal and data of the proposal
    sig: Signature,
    /// start event_blocknumber represents the event block number that
    /// the proposal was presented to the system
    start_event_blocknumber: u128,
    /// end event_blocknumber represents the event block number that
    /// the proposal will expire and voting will conclude
    end_event_blocknumber: u128,
    /// data represents the data of the proposal in encoded bytes
    data: Vec<u8>,
    /// vote_collection represents the collections of the votes 
    /// for this proposal
    vote_collction: Vec<Vote>,
    /// decision represents the final decision of the proposal
    decision: Decision,
}

/// Democracy represents the structure that holds info 
/// about the state of the system
pub struct Democracy {
    /// in_cooldown represents the a collection of the current
    /// x-id validators that are in cooldown mode and unable to propose
    in_cooldown: Vec<XID>,
    /// current_proposals holds the current proposals 
    /// that are active for voting
    current_proposals: Vec<Proposal>,
    /// accepted_proposals holds the records for all accepted 
    /// proposals by the system
    accepted_proposals: Vec<Proposal>,
}
```