# Pair

The **Viper Network** introduces a **session-based approach** to regulate interactions between **Requestors (clients)** and **Servicers**. This mechanism ensures a dynamic, efficient, and fair distribution of tasks while maintaining the network's integrity and performance.

### Session

**Sessions in Viper Network**

In Viper Network, **sessions** represent the temporary relationship between a **Requestor** and a set of **pseudorandomly** selected **Servicers**. These sessions are created to facilitate the exchange of **relay services**—the process through which the Requestor sends requests to Servicers for data processing, transactions, or blockchain interactions.

Each session is designed to:

* **Establish a pairing** between the Requestor and a specific group of Servicers.
* Assign servicers based on **non-native chain requirements** (i.e., the specific blockchain the Requestor wants to interact with) and the **geo zone** that aligns with the Requestor’s location or service needs. This geographical selection helps ensure low latency.
* Operate for a **predefined duration**, allowing sufficient time for requests to be processed.

Once the session ends, a **Rollover mechanism** is used to regenerate a new session, creating a **fresh pairing** between the Requestor and a different set of Servicers. This **dynamic rotation** prevents any single group of Servicers from being continually overloaded with requests from a particular client, ensuring a fair workload distribution.

In addition to the client-servicer relationship, sessions in the Viper Network also involve the selection of a **Fisherman**. The **Fisherman** acts as a performance monitor for the Servicers involved in that session. Their role is vital for ensuring the **quality and reliability** of the services being provided.

The **Fisherman** is responsible for:

* **Evaluating Servicer Performance**: The fisherman assesses factors such as:
  * **Reliability**: How consistently the Servicer responds to requests.
  * **Availability**: Whether the Servicer is operational during the session.
  * **Latency**: The speed at which the Servicer processes and responds to relay requests.
* **Gathering Data**: The fisherman collects key performance metrics, which are then used to determine the **quality of service** delivered during the session.

The performance scores generated by the Fisherman are integral to the **rewards and penalties system** within the Viper Network. Servicers are rewarded for high performance and penalized for low-quality service. This **reputation-based evaluation** helps maintain trust and ensures that only reliable, high-performing nodes continue to serve the network.

<figure><img src="/files/1LphAWSt5QQanm8VrcL8" alt=""><figcaption></figcaption></figure>

### **Session Generation**

A **session** in the Viper Network consists of four main components that ensure fairness, transparency, and reliability in the interaction between Requestors and Servicers. These components—**Key**, **Header**, **Servicers**, and **Fishermen**—work together to facilitate secure, performance-driven service exchanges.

**1. Session Key**

The **session key** is crucial in selecting the right group of Servicers for a session. It ensures that the selection process is fair and random, preventing bias and exploitation.

* The session key is generated by combining several pieces of information:
  * A **unique seed** derived from the hash of the latest block and the block height.
  * The **Requestor's public key**, ensures that the session is tailored to the individual user’s needs.
  * The **non-native chain ID**, identifies the chain the Requestor wishes to interact with.
* This combined data is passed through a **hash function**, producing a unique session key that is used to select Servicers for the session. This process helps guarantee that the selection of Servicers is both random and fair for all participants.

**2. Session Header**

The **header** contains key information about the session and its structure. It serves as a reference point for all data associated with the session, ensuring the integrity of the process.

* The **Session Header** includes:
  * The **Requestor's public key** to associate the session with the correct user.
  * The **chain** and **geo-zone** that the Requestor is interacting with, ensuring location-based selection.
  * The **number of Servicers** requested, ensuring that the right amount of resources is allocated.
  * The **Session block height**, providing a reference to the session’s place in the blockchain.

**3. Servicers**

Servicers are key participants in the Viper Network, responsible for providing services to clients and maintaining the integrity of the network. The selection of Servicers for each session is governed by a sophisticated mechanism to ensure fairness and reliability.

* **Eligibility Criteria**:
  * Servicers with a **performance score** above 0.75 (out of 1) and meeting the **minimum staking requirements** are eligible for selection.
* **Weighted Selection**:

<table><thead><tr><th width="246">Performance Score</th><th>Staked Tokens</th><th>Weight</th></tr></thead><tbody><tr><td>> 0.90</td><td>≥ Minimum (10,000)</td><td>1</td></tr><tr><td>> 0.75</td><td>≥ 2x Minimum</td><td>2</td></tr><tr><td>> 0.75</td><td>≥ 3x Minimum</td><td>3</td></tr><tr><td>> 0.75</td><td>≥ 4x Minimum</td><td>4</td></tr><tr><td>≤ 0.90</td><td>≥ Minimum</td><td>Score will be considered as Weight (0.1 - 0.9)</td></tr></tbody></table>

* **Pseudorandom Selection**:
  * The Servicers for each session are chosen based on a **weighted random process**, giving higher-weighted Servicers a higher chance of selection. This ensures that high-performing and well-staked Servicers are more likely to be chosen, while maintaining a decentralized approach.

**4. Fishermen**

Fishermen play a critical role in ensuring the **Quality of Service (QoS)** within the Viper Network. They act as **shadow clients**, continuously evaluating the performance of Servicers during a session.

* **Fisherman Role**:
  * Fishermen are **pseudo-randomly selected** for each session and are responsible for sending **sample relays** to all Servicers in the session.
  * By observing these relays, they measure the **latency**, **availability**, and **reliability** of each Servicer.
* **Fisherman Scores**:
  * The performance metrics collected by Fishermen are used to calculate **performance scores** for each Servicer. These scores reflect the quality of service provided during the session.
  * Higher scores, indicating better QoS, result in greater rewards for the Servicers.
* **Selection**:
  * The **assignment of Fishermen** to sessions is determined by the Team, ensuring that there are no malicious actors involved.


---

# 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://docs.vipernet.xyz/protocol/design/pair.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.
