🔁Service
Last updated
Last updated
Service in Viper Network plays a crucial role in facilitating the relay of RPC requests between clients and blockchains. Servicers, which are nodes operating within the network, are responsible for servicing these relays. They ensure the efficient and reliable transmission of data, providing a seamless connection between clients and the underlying blockchain infrastructure. Servicers are staked and incentivized to perform their tasks diligently, as their performance directly impacts their rewards. By maintaining a robust network of servicers, Viper Network ensures the availability, reliability, and responsiveness required for smooth and uninterrupted interactions between clients and blockchains.
A relay is the fundamental mechanism that enables interaction between clients and blockchains within the Viper Network. It represents an API request made by a client to interact with a specific blockchain, either to read data (e.g., account balances, transaction history) or write data (e.g., submitting a transaction).
Once the client sends the request, it is routed through the network to the designated Servicers, who then process the request by interacting directly with the blockchain on the client’s behalf. After the blockchain responds to the request, the Servicers relay the blockchain’s response back to the client, completing the request-response cycle. This system allows clients to seamlessly access blockchain data or submit transactions, all while interacting in a trustless and decentralized manner.
Request Initiation: The relay lifecycle begins when a requestor initiates a session by specifying essential information such as the blockchain it intends to interact with, the desired geographic zone (geozone), and the number of servicers required for the session.
Session Generation: Upon receiving the request, a session is generated based on the provided information. This session contains details essential for the subsequent relay process, including the servicers paired and the fisherman.
Relay Request Submission: With the session information at hand, the requestor submits relay requests to the servicers. These requests include pertinent details regarding the payload to be relayed and information about the session itself.
Request Validation and Proof Storage: Upon receiving relay requests, the servicers validate the requests to ensure their authenticity and integrity. Subsequently, they store relevant proof of the request's receipt and authenticity
Relay Execution: Following successful validation, the servicers execute the relay requests as specified. This may involve interacting with the designated blockchain, processing transactions, or executing smart contract functions, among other actions.
Response Generation: Upon completing the relay task, the servicers generate responses corresponding to the relayed actions.
Response Signing and Return: Before returning the response to the requestor, the servicers sign the response to ensure its authenticity and integrity. Once signed, the response is returned to the requestor, completing the relay lifecycle for the specific request.
Ensuring a high Quality of Service (QoS) for relay services is essential for the Viper Network, as it directly impacts the reliability and user experience. To maintain this standard, Viper leverages the role of the Fisherman, an actor dedicated to continuously evaluating and overseeing the performance of Servicers during each session.
A unique feature of the Viper Network is its dynamic report card system, which evaluates each Servicer’s performance after every session. This report card influences two key aspects:
Chances of being selected for future sessions.
Proportion of rewards earned based on performance.
By incorporating these report cards, the Viper Network motivates Servicers to consistently provide high-quality service, knowing that their rewards are directly linked to their performance. The Fisherman plays a crucial role in updating these report cards, ensuring the integrity and reliability of the network’s services.
Key Performance Metrics
The Fisherman evaluates each Servicer based on three key metrics: availability, latency, and reliability. These metrics are calculated and used to determine the Servicer’s performance score, which in turn affects their rewards.
Availability
The Fisherman sends sample relays to all Servicers within a session, monitoring their responsiveness to these requests.
Downtime percentage is calculated by measuring the ratio of unanswered relays to the total relays sent.
The scaled availability score is calculated as follows:
scaledAvailabilityScore = 1 - (unansweredRelays / totalRelays)
A higher availability score rewards Servicers that are more responsive and have lower downtime.
Latency
The Fisherman measures Round Trip Time (RTT), which is the time it takes for the Fisherman to receive a signed response from a Servicer.
The latency score is calculated based on the ratio of the lowest average latency (fastest Servicer in the session) to the average latency of each Servicer.
This score is clamped to a maximum value of 1 to ensure consistency.
score = lowestAverageLatency / averageLatency (clamped to 1 )
Servicers with faster response times receive higher scores, incentivizing them to minimize latency.
Reliability
Reliability measures how consistently Servicers provide correct responses. The Fisherman sends sample requests locally and compares the outcomes with the responses from the Servicers.
If discrepancies are found, it indicates errors or inconsistencies in the Servicer’s responses.
Reliability score is calculated as the ratio of matched samples to the total samples sent:
reliabilityScore = matchedSamples / totalSample
Servicers with fewer discrepancies and more accurate responses receive higher reliability scores, ensuring that only consistent, error-free Servicers thrive in the network.
Availability
30%
Latency
40%
Reliability
30%
** The weights assigned to performance metrics are parameterized and can be adjusted in the future through the DAO governance.
The Viper Network’s Global Report Card system is an integral feature designed to track and evaluate the performance of validators over time. The system uses three key performance metrics to assess the overall contribution of validators: Latency Score, Availability Score, and Reliability Score.
When a validator submits a QoS report, the network updates the corresponding report card as follows:
Updating Scores: When a validator submits a Quality of Service (QoS) report, the Viper Network updates the corresponding report card using a decaying average formula:
updatedScore = (decayedCurrentScore
* 0.98 + newScore) / 2
Decaying Average: The formula applies a 0.98 decay factor to the current score, which reduces the impact of older sessions. This ensures that the report card reflects the validator’s recent performance more accurately and remains sensitive to changes in service quality.
Balancing Historical and Recent Performance: By averaging the decayed current score with the new score, the system maintains a balance between a validator’s long-term performance and the latest session's results.
This method also ensures that as the total number of sessions increases, the effect of any single new session on the overall score is minimized. The decaying average makes the report card more reflective of current performance rather than being overwhelmed by the cumulative effect of older sessions.
Averaging the Scores: The updated Latency, Availability, and Reliability scores are averaged, allowing the system to continuously track the performance of the validator over time without giving disproportionate weight to recent sessions. This approach ensures that:
The report card remains sensitive to changes in performance.
Older scores lose relevance more gradually, allowing for a more dynamic reflection of the validator's service quality.
Total Score Calculation
To calculate the total score for each validator, the individual scores (Latency, Availability, and Reliability) are multiplied by their respective weights and then added together. The total score is then normalized by dividing the sum by 1,000,000,000,000 to keep it within a manageable range.
This method ensures that each score contributes proportionally based on its assigned weight, reflecting the importance of each metric to the overall validator performance.
The report card system incentivizes validators to maintain consistent, high-quality service to the network and its users.