# xGov status and voting power

## Abstract

This ARC defines the Expert Governor (xGov) status and voting power in the Algorand Expert Governance.

## Specification

The key words “ **MUST**”, “ **MUST NOT**”, “ **REQUIRED**”, “ **SHALL**”, “ **SHALL NOT**”, “ **SHOULD**”, “ **SHOULD NOT**”, “ **RECOMMENDED**”, “ **MAY**”, and “ **OPTIONAL**” in this document are to be interpreted as described in [RFC-2119](https://www.ietf.org/rfc/rfc2119.txt).

The notation `(x, y)` denotes a pair of elements, while `(x; y)` (with `;`) denotes the interval of real numbers between `x` and `y` (including neither `x` nor `y`).

### xGov Registry

The xGov Registry is the Application that manages the Algorand Expert Governance on the Algorand blockchain.

Let

- `g` be the Genesis Hash of the Algorand blockchain;
- `R` the xGov Registry Application ID;
- `Bc` the block number at which the xGov Registry `R` was created on `g`.

The xGov Registry is created by the Algorand Foundation and is identified by the tuple `(g, R, Bc)`.

> On the Algorand MainNet the xGov Registry is created by the Algorand Foundation address `I7OP7WFSK57IFDHJA6DM5TJC2IFY4M3XSBV4R4PVOV4YWF7K57BZFUVQ5E` and identified by:
>
> - `g`: `wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=`
> - `R`: `3147789458`
> - `Bc`: `52307574`

### Governance Period

A _governance period_ is identified by a pair `(Bi, Bf)` such that

- `Bi = 0 mod 1,000,000`;
- `Bf = 0 mod 1,000,000`;
- `Bf > Bi`;
- `Bf > Bc`.

And is intended as a range of blocks `[Bi; Bf)` (`Bi` included, `Bf` excluded).

> Note that `Bi < Bc` is valid and denotes a period across the xGov Registry creation.

### xGov Status

xGovs (Expert Governors) are decision makers in the Algorand Expert Governance, who acquire voting power by securing the network and producing blocks.

These individuals can participate in the designation and approval of proposals submitted to the Algorand Expert Governance process.

An xGov is associated with an Algorand Address (`a`) subscribing to the Algorand Expert Governance by acknowledging the xGov Registry.

Once the xGov Registry confirms the acknowledgement on block `h` for the address `a`, it acquires an xGov status and is considered an xGov.

The xGov status **MAY** be revoked on block `r` from address `a`, either by themself (unsubscribing from the xGov Registry) or by the xGov Registry rules.

The xGov status `(a, h, k)` of an address `a` **SHOULD** be persisted on the xGov Registry state.

If the xGov status `(a, h, k)` is revoked (`k ≠ 0`) it **SHOULD NOT** be deleted from xGov Registry state.

### xGov Voting Power

Given a governance period `(Bi, Bf)`, an xGov `(a, h, k)` is _eligible_ to acquire voting power for that period if and only if:

- `h ∈ [Bc; Bf)` (xGov status **acknowledged** at before `Bf`), and
- `k = 0` or `k ≥ Bf` (xGov status **not revoked** at `Bf`), and
- `a` has proposed at least one block in `[Bi; Bf)`.

The _voting power_ assigned to each xGov `(a, h, k)` is equal to the number of blocks proposed by its Algorand Address (`a`) over the governance period `[Bi; Bf)`.

> If an address `a` has acknowledged the xGov Registry at some `h ∈ [Bc; Bf)` and has proposed one or more blocks in `[Bi; Bf)`, then all such proposals in `[Bi; Bf)` contribute to its voting power, including those that occurred before `h`.

> The _eligibility_ of address `a` holds for all the governance periods `(Bi, Bf)` such that `h ∈ [Bc; Bf)` and the xGov status is not revoked at `Bf` (i.e., `k = 0` or `k ≥ Bf`), with no need to reacknowledge the xGov Registry for each period.

### xGov Committee

An xGov Committee is a group of _eligible_ xGovs that have acquired voting power in a governance period.

Given the xGov Registry `(g, R, Bc)` and a governance period `(Bi, Bf)` as above, an _xGov Committee_ for `(g, R, Bc, Bi, Bf)` is a finite set `C` of address–weight pairs `(a, v)` such that the following three conditions hold:

1. **Eligibility**: For all `(a, v)` in `C`, there exists an xGov status `(a, h, k)` such that:

- `h ∈ [Bc; Bf)`, and
   - `k = 0` or `k ≥ Bf`, and
   - `a` has proposed at least one block in `[Bi; Bf)`.
2. **Voting Power**: For all `(a, v)` in `C`, `v` is equal to the voting power of `a` in `[Bi; Bf)`;
3. **Uniqueness**: The addresses `a` in `C` are all distinct.

**Eligibility** at `Bf` **MUST** be evaluated on the xGov Registry state immediately after processing block `Bf-1` (i.e., the state at the end of block `Bf-1`).

An xGov Committee is defined by the tuple `(g, R, Bc, Bi, Bf, C)`.

If `C` is empty, then the xGov Committee for the governance period has no voting power.

#### xGov Committee Members

The _number of xGov Committee members_ `M` is the cardinality of `C`, more formally `M = |C|`.

#### xGov Committee Voting Power

The _total voting power_ of an xGov Committee `V` is the sum of votes (`v`) over all its members (`a`), more formally `V = Σ_{(a,v) ∈ C} v`.

### xGov Committee Selection Procedure

The xGov Committee selection is repeated periodically to select new xGov Committees over time.

To build the xGov Committee `(g, R, Bc, Bi, Bf, C)`, the selection is executed with the following procedure:

1. Collect all proposed blocks in the governance period `[Bi; Bf)` to build the _potential committee_ set `P` (note that not all the Block Proposers hold the xGov status).
2. For each Block Proposer address (`a`) in `P`, assign a voting power (`v`) equal to the number of blocks proposed in the governance period `[Bi; Bf)`.
3. Determine the set of xGov statuses `(a, h, k)` that are _eligible_ at `Bf`, i.e. those such that:

- `h ∈ [Bc; Bf)`, and
- `r = 0` or `r ≥ Bf`.

( **OPTIONAL**) If the xGov Registry state does not persist sufficient information to determine `(a, h, k)` at `Bf` from a state snapshot, replay the xGov Registry state transitions up to `Bf` to reconstruct xGov statuses at `Bf`.

4. Collect all the _eligible_ xGovs in the governance period `[Bc; Bf)` to build the _eligible xGovs_ set `E(Bi, Bf)`.
5. Filter `P ∩ E` to obtain the _xGov Committee_ `C`.

> The Committee for the governance period `(Bi, Bf)` is a pure function of:
> - The blocks history up to `Bf`;
> - The fixed registry identity `(g,R,Bc)`;
> And it does not depend on the time at which the Committee is elected.

### Representation

The xGov Committee **MUST** be represented with the canonical UTF-8 encoded JSON object with the following schema:

```json
{
  "title": "xGov Committee",
  "description": "Selected xGov Committee with voting power and validity",
  "type": "object",
  "properties": {
    "xGovs": {
      "description": "xGovs with voting power, sorted lexicographically with respect to addresses",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "address": {
            "description": "xGov address used on xGov Registry in base32",
            "type": "string"
          },
          "votes": {
            "description": "xGov voting power",
            "type": "integer",
            "minimum": 1
          }
        },
        "required": ["address", "votes"]
      },
      "uniqueItems": true
    },
    "periodStart": {
      "description": "First block of the Committee selection period, must ≡ 0 mod 1,000,000",
      "type": "integer",
      "multipleOf": 1000000
    },
    "periodEnd": {
      "description": "Last block of the Committee selection period, must ≡ 0 mod 1,000,000 and greater than periodStart",
      "type": "integer",
      "multipleOf": 1000000
    },
    "totalMembers": {
      "description": "Total number of Committee members",
      "type": "integer"
    },
    "networkGenesisHash": {
      "description": "The genesis hash of the network in base64",
      "type": "string"
    },
    "registryId": {
      "description": "xGov Registry application ID",
      "type": "integer"
    },
    "totalVotes": {
      "description": "Total number of Committee votes",
      "type": "integer"
    }
  },
  "required": ["networkGenesisHash", "periodEnd", "periodStart", "registryId", "totalMembers", "totalVotes", "xGovs"],
  "additionalProperties": false
}
```

For a valid xGov Committee JSON object:

- The number of entries in the xGovs array **MUST** equal `totalMembers`.
- The sum of the vote fields of all xGovs entries **MUST** equal `totalVotes`.
- All address values in the xGovs array **MUST** be distinct.

The following rules aim to create a deterministic outcome of the committee file and its resulting hash.

The object keys **MUST** be sorted in lexicographical order.

The xGovs arrays **MUST** be sorted in lexicographical order with respect to the _unique_ address keys.

The canonical representation of the committee object **MUST NOT** include decorative white-space (pretty printing) or a trailing newline.

An xGov Committee is identified by the following identifier:

`SHA-512/256(arc0086||SHA-512/256(xGov Committee JSON))`

The ASCII string "arc0086" **MUST** be encoded as the UTF-8 byte sequence `0x61 0x72 0x63 0x30 0x30 0x38 0x36`.

### Trust Model

The Algorand Foundation is responsible for executing the Committee selection algorithm described above and publishing the resulting Committee ID on the xGov Registry.

The correctness of the process is auditable post-facto via:

- The block proposers’ history (on-chain)
- The xGov Registry history and state (on-chain)
- The published Committee JSON (hash verifiable)

Any actor can recompute and verify the selected committee independently from on-chain data.

Clients **SHOULD** use a trusted provider for both the block proposer history and the xGov Registry state.

## Rationale

Given the shift of the Algorand protocol towards consensus incentivization, the xGov process could be an additional way to push consensus participation.

## Security Considerations

Recomputing the xGov Committee requires access to block proposer history for the entire governance period `[Bi; Bf)` and to the xGov Registry state.

Implementations **MUST** ensure that this historical data remains available (for example, via archival nodes or indexer services), or document any assumptions about third-party infrastructure.

Clients **SHOULD** notify the Algorand Foundation if:

- The xGov Committee for period `[Bi; Bf)` is not published by the Algorand Foundation within `10,000` blocks of the end of the period.
- A published Committee ID does not match any recomputed xGov Committee using the agreed `(g, R, Bc, Bi, Bf, C)`.
