# Vote weight strategies · Chromia Docs (concept)

> Vote weight strategies are methods used to determine the weight of a vote.

Source: https://docs.chromia.com/ecosystem/governance/getting-started/governance-structure/vote-weight-strategy/

# Vote weight strategies

On this page

* [Example:](#example)
* [How to add a new vote weight strategy](#how-to-add-a-new-vote-weight-strategy)
* [Example of adding a new vote weight strategy](#example-of-adding-a-new-vote-weight-strategy)
* [Structure explanation](#structure-explanation)

Vote weight strategies are methods used to determine the weight of a vote. The LINEAR calculation is the standard vote
weight strategy, meaning that when calculating the winner of a proposal, the vote power is considered as is.

The QUADRATIC calculation is a vote weight strategy that computes vote power as the square of the vote amount. This
means that when determining the winning option of a proposal, the total vote power is calculated by squaring the amount
of vote power.

### Example:

* Person A votes for option 1 with 100 vote power.
* Person B votes for option 2 with 36 vote power.
* Person C votes for option 3 with 36 vote power.

Calculating total votes:

* For Option 1: (100^2 = 10,000)
* For Option 2: Person B's vote ( (36^2 = 1,296) + ) Person C's vote ( (36^2 = 1,296) = 2,592 )

In this case, Option 1 wins with the LINEAR vote weight strategy.

## How to add a new vote weight strategy

To add a new vote weight strategy, extend the `votes.get_available_vote_weight_strategies` function. The structure of
the vote weight strategy is as follows:

Rell

```
struct my_proposal_vote_weight_strategy {
    name: text;
    description: text;
    calculate_winner_option: (proposals.proposal) -> proposals.option_item;
    calculate_total_vote: (proposals.option_item) -> big_integer;
    display_total_vote: (proposals.option_item) -> decimal;
}
```

### Example of adding a new vote weight strategy

Rell

```
@extendable
function get_available_proposal_vote_weight_strategies(): map<text, votes.my_proposal_vote_weight_strategy>;

function linear_calculate_winner_option(proposals.proposal) {
    return proposals.option_item @ {
        .proposal == proposal
    } (
            $,
            @omit @sort_desc .total_vote
        ) limit 1;
}

function linear_calculate_total_vote(proposals.option_item): big_integer {
    return option_item.total_vote;
}

function linear_display_total_vote(proposals.option_item): decimal {
    val vote_power_base_vote = get_available_vote_power_calculation_strategies()
        .get(
            option_item.proposal
                .vote_power_calculation_strategy
        ).base_vote_power;
    return option_item.total_vote.to_decimal() / vote_power_base_vote;
}

@extend(votes.get_available_proposal_vote_weight_strategies)
function example_get_available_proposal_vote_weight_strategies() {
    val strategies = map<text, votes.my_proposal_vote_weight_strategy>();
    strategies.put(
        "LINEAR",
        votes.my_proposal_vote_weight_strategy(
            name = "LINEAR",
            description = "Linear vote weight strategy",
            calculate_winner_option = linear_calculate_winner_option(
                *
            ),
            calculate_total_vote = linear_calculate_total_vote(
                *
            ),
            display_total_vote = linear_display_total_vote(*)
        )
    );
    return strategies;
}
```

### Structure explanation

* **Name:** The name of the vote weight strategy.
* **Description:** A brief description to be displayed in the user interface (UI).
* **calculate\_winner\_option:** This function computes and returns the winning `option_item` record.
* **calculate\_total\_vote:** This function computes and returns the total votes of an `option_item`. It is used to
  display total votes for different options in the UI.
* **display\_total\_vote:** This function formats the total vote number for display in the UI.

[View this page on docs.chromia.com](https://docs.chromia.com/ecosystem/governance/getting-started/governance-structure/vote-weight-strategy/)Content mirrored from the live docs
