# Ctex Consensus

1. **Sampling Process:** Validators in the network are randomly sampled to determine their opinion on whether a transaction should be accepted or rejected. This sampling process helps gather input from a diverse set of validators.
2. **Acceptance Threshold:** A sufficiently large portion (alpha α) of the sampled validators need to agree on whether to accept or reject the transaction. This threshold ensures that decisions are made based on a consensus among a significant portion of the network.
3. **Consecutive Rounds:** Validators repeat the sampling process for multiple consecutive rounds (beta β) until a consistent opinion is reached among the sampled validators. This iterative approach helps to confirm the validity of transactions over time.
4. **Conflict Resolution:** In cases where conflicting transactions exist, honest validators quickly converge around a single transaction through a positive feedback loop. This clustering process ensures that correct validators ultimately prefer the same transaction, leading to its acceptance.

**Finalization Process:** Once a transaction has received consensus agreement among a significant portion of validators for multiple consecutive rounds, it is finalized and added to the blockchain. Finalization occurs quickly for non-conflicting transactions, while conflicting transactions undergo a clustering process until a clear consensus is reached.

<figure><img src="/files/meez01oiknOPukaknkqs" alt=""><figcaption></figcaption></figure>

**Benefits:**

* **Efficiency:** The protocol enables quick validation and finalization of transactions, especially in the absence of conflicts.
* **Security:** Through random sampling and iterative rounds, the protocol ensures that decisions are made based on input from a diverse set of validators, enhancing security.
* **Decentralization:** By involving a large number of validators in the consensus process, CTEX Chain maintains decentralization and resilience against attacks.

Overall, the consensus protocol of CTEX Chain combines random sampling, iterative rounds, and conflict resolution mechanisms to achieve efficient and secure transaction validation on the blockchain.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ctex-network.gitbook.io/developer-documentation/ctex-consensus.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
