> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rated.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Performance Benchmarking

export const Endpoint = ({type, path, url}) => {
  const methodColors = {
    post: 'bg-blue-400/20 text-blue-700 dark:bg-blue-400/20 dark:text-blue-400',
    get: 'bg-green-400/20 text-green-700 dark:bg-green-400/20 dark:text-green-400',
    put: 'bg-yellow-400/20 text-yellow-700 dark:bg-yellow-400/20 dark:text-yellow-400',
    delete: 'bg-red-400/20 text-red-700 dark:bg-red-400/20 dark:text-red-400',
    patch: 'bg-orange-400/20 text-orange-700 dark:bg-orange-400/20 dark:text-orange-400'
  };
  const pathParts = path.startsWith('/') ? path.substring(1).split('/') : path.split('/');
  return <a href={url} className="relative flex-1 flex gap-2 min-w-0 rounded-xl items-center cursor-pointer p-1.5 border-standard">
        <div className={`rounded-lg font-bold px-1.5 py-0.5 text-sm leading-5 ${methodColors[type.toLowerCase()]}`}>
          {type}
        </div>
        <div className="flex items-center space-x-2 overflow-x-auto flex-1 no-scrollbar">
          <div className="group flex items-center flex-1 gap-0.5 font-mono">
            {url && <div className="absolute right-0 p-2 rounded-lg hidden group-hover:block">
                <Icon icon="arrow-right" />
              </div>}
            {pathParts.map((part, i) => {
    const isParam = part.includes('{');
    return <>
                  <div className="text-sm text-gray-400">/</div>
                  {isParam ? <div className="text-sm font-mono font-medium rounded-md px-1 border-2 min-w-max text-[#2AB673] bg-[#2AB673]/10 border-[#2AB673]/30">
                      {part}
                    </div> : <div className="text-sm font-medium text-gray-800 dark:text-white min-w-max">
                      {part}
                    </div>}
                </>;
  })}
          </div>
        </div>
      </a>;
};

Performance benchmarking is a critical practice that involves evaluating and comparing the efficiency of various validators, both internal and external, to find areas of efficiency. Rated APIs provide access to standardized performance metrics, which can be used by:

1. **Node Operators** to continuously monitor their own performance metrics in relation to their competitors. This not only helps in identifying areas of improvement but also facilitates the formulation of effective strategies to enhance their operational efficiency and service quality.

2. **Custodians** and **Centralised Exchanges** to conduct thorough evaluations of validator operators, comparing their performance against network standards and other validators. This comprehensive analysis assists in making strategic decisions regarding SLAs and pricing, ensuring optimal performance and cost-effectiveness.

## Integration Steps

### Step 1: Generate Authorization Token

[Sign into the Rated Console](https://rated.network/signIn) to generate your API Token.

### Step 2: Get Performance Data

The Rated API offers time window aggregation, allowing you to consolidate data over various time periods such as `day`, `week`, `month`, `quarter`, `year` or `all time`. You can retrieve performance data in two ways:

1. Pre-materialized views
2. Specific validator groups

#### Step 2.1: Getting Performance Data for Pre-materialized Views

Imagine you're Kiln (a Node Operator), Lido (a Pool), or Coinbase (an Exchange). You want all your performance details for August 2023, shown daily. Here's how you'd go about getting this data.

<Endpoint path="/v0/eth/operators/{operator_id}/effectiveness" type="GET" url="/rated-api/api-reference/v0/ethereum/operators/get-effectiveness" />

| Key           | Required? | Value   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| :------------ | :-------- | :------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `operator_id` | Yes       | string  | Name of the Entity. For this example, you should either put `Lido` ,`Kiln` or`Coinbase` **Note:** the operator\_id is case-sensitive and should follow the same typecase as they are on the [Rated Explorer](https://www.rated.network/?network=mainnet\&view=pool\&timeWindow=1d\&page=1\&poolType=all)                                                                                                                                                                                                                                                                                                    |
| `idType`      | Yes       | string  | The type of entity class you would like returned. You might ask for `pool`, `poolShare`, `nodeOperator`, `depositAddress`, or `withdrawalAddress`. **Note:** it is optional and can be inferred automatically for pools, pool shares and node operators. It defaults to `depositAddress` if it is missing and an address is provided.                                                                                                                                                                                                                                                                       |
| `granularity` | Yes       | string  | The size of time increments you are looking to query. Can be `day` / `week` / `month` / `quarter` / `year`. For this example, you should set granularity to `day`.                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `from`        | Yes       | string  | Start day (integer) or date (e.g. from="2022-12-01") For this example, set from to `2023-08-31`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `size`        | Yes       | integer | The number of results included per page. For this example, you should set size as 31 as we want the monthly data for August 2023.                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `filterType`  | Yes       | string  | `hour`, `day` and `datetime` For this example, set to `datetime`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `include`     | Yes       | array   | A list of field names. To get the performance data, you should include the following data: `day`, `validatorCount`, `avgInclusionDelay`, `avgUptime`, `avgCorrectness`, `avgProposerEffectiveness`, `avgValidatorEffectiveness`, `avgAttesterEffectiveness`,`sumCorrectHead`, `sumCorrectTarget`, `sumCorrectSource`,`sumInclusionDelay`, `sumProposedCount`, `sumProposerDutiesCount`, `slashesCollected`, `slashesReceived`, `sumMissedSyncSignatures`, `sumLateSourceVotes`, `sumWrongTargetVotes`, `sumLateTargetVotes`, `sumMissedAttestations`, `sumWrongHeadVotes`, `sumExecutionProposedEmptyCount` |

**Example:** Obtaining daily performance metrics for the month of August 2023 for Kiln

<CodeGroup>
  ```sh curl theme={null}
  curl -v -X 'GET' \
  'https://api.rated.network/v0/eth/operators/Kiln/effectiveness?from=2023-08-31&size=31&granularity=day&filterType=datetime&include=validatorCount&include=avgInclusionDelay&include=avgUptime&include=avgCorrectness&include=avgProposerEffectiveness&include=avgValidatorEffectiveness&include=avgAttesterEffectiveness&include=sumCorrectHead&include=sumCorrectTarget&include=sumCorrectSource&include=sumInclusionDelay&include=sumProposedCount&include=sumProposerDutiesCount&include=slashesCollected&include=slashesReceived&include=day&include=sumMissedSyncSignatures&include=sumLateSourceVotes&include=sumWrongTargetVotes&include=sumLateTargetVotes&include=sumMissedAttestations&include=sumWrongHeadVotes&include=sumExecutionProposedEmptyCount&idType=nodeOperator' \
  -H 'Content-Type: application/json' \
  -H 'X-Rated-Network: mainnet' \
  -H 'Authorization: Bearer <YOUR-TOKEN-HERE>'
  ```

  ```python python theme={null}
  import requests

  url = "https://api.rated.network/v0/eth/operators/Kiln/effectiveness"
  params = {
      "from": "2023-08-31",
      "size": 31,
      "granularity": "day", 
      "filterType": "datetime",
      "include": [
          "validatorCount", "avgInclusionDelay", "avgUptime",
          "avgCorrectness", "avgProposerEffectiveness",
          "avgValidatorEffectiveness", "avgAttesterEffectiveness",
          "sumCorrectHead", "sumCorrectTarget", "sumCorrectSource",
          "sumInclusionDelay", "sumProposedCount", "sumProposerDutiesCount",
          "slashesCollected", "slashesReceived", "day",
          "sumMissedSyncSignatures", "sumLateSourceVotes",
          "sumWrongTargetVotes", "sumLateTargetVotes",
          "sumMissedAttestations", "sumWrongHeadVotes",
          "sumExecutionProposedEmptyCount"
      ],
      "idType": "nodeOperator"
  }
  headers = {
      "Content-Type": "application/json",
      "X-Rated-Network": "mainnet",
      "Authorization": "Bearer <YOUR-TOKEN-HERE>"
  }

  response = requests.get(url, params=params, headers=headers)
  print(response.json())
  ```
</CodeGroup>

#### Step 2.2: Getting Performance Data for Specific Validator Groups

For validator groupings, you will need to call the [Aggregating validator indices](/rated-api/api-reference/v0/ethereum/validators/get-effectiveness-aggregation) endpoint. We'll show this similarly as above for all performance details for the month of August 2023 for a set of validator indices, aggregated daily.

<Endpoint path="/v0/eth/validators/effectiveness" type="GET" url="/rated-api/api-reference/v0/ethereum/validators/get-effectiveness-aggregation" />

| Key                      | Required? | Value                                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| :----------------------- | :-------- | :------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pubkeys` (OR) `indices` | Yes       | array \[string] (OR) array \[integer] | Array of validator pubkeys or indicies you're performing the grouped analysis for. For this example, you should put indices as `675893` `675894` and `675895`                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `filterType`             | Yes       | string                                | `hour`, `day` and `datetime`. For this example, set to `datetime`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `from`                   | Yes       | string                                | The most recent date for your desired timeline. In this example, it is `2023-08-31`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `size`                   | Yes       | integer                               | The number of results included per page. For this example, you should set size as 31 as we want the monthly data for August 2023.                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `granularity`            | Yes       | string                                | The size of time increments you are looking to query. Can be `day` / `week` / `month` / `quarter` / `year`. For this example, set granularity to `day`.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `groupBy`                | Yes       | string                                | Aggregation groupings. Can be `timeWindow` if you'd like to aggregation for your desired time window or `validator` if you'd like it per validator. For this example, set it to `timeWindow`.                                                                                                                                                                                                                                                                                                                                                                                                               |
| `include`                | Yes       | array \[string]                       | A list of field names. To get the performance data, you should include the following data: `day`, `validatorCount`, `avgInclusionDelay`, `avgUptime`, `avgCorrectness`, `avgProposerEffectiveness`, `avgValidatorEffectiveness`, `avgAttesterEffectiveness`,`sumCorrectHead`, `sumCorrectTarget`, `sumCorrectSource`,`sumInclusionDelay`, `sumProposedCount`, `sumProposerDutiesCount`, `slashesCollected`, `slashesReceived`, `sumMissedSyncSignatures`, `sumLateSourceVotes`, `sumWrongTargetVotes`, `sumLateTargetVotes`, `sumMissedAttestations`, `sumWrongHeadVotes`, `sumExecutionProposedEmptyCount` |

**Example:** Obtaining daily performance metrics for the month of August 2023 for Validator group `{675893,675894,675895}`

<CodeGroup>
  ```sh curl theme={null}
  curl -v -X 'GET' \
  'https://api.rated.network/v0/eth/validators/effectiveness?indices=675893&indices=675894&indices=675895&from=2023-08-31&size=31&granularity=day&filterType=datetime&include=validatorCount&include=avgInclusionDelay&include=avgUptime&include=avgCorrectness&include=avgProposerEffectiveness&include=avgValidatorEffectiveness&include=avgAttesterEffectiveness&include=sumCorrectHead&include=sumCorrectTarget&include=sumCorrectSource&include=sumInclusionDelay&include=sumProposedCount&include=sumProposerDutiesCount&include=slashesCollected&include=slashesReceived&include=day&include=sumMissedSyncSignatures&include=sumLateSourceVotes&include=sumWrongTargetVotes&include=sumLateTargetVotes&include=sumMissedAttestations&include=sumWrongHeadVotes&include=sumExecutionProposedEmptyCount&groupBy=timeWindow' \
  -H 'Content-Type: application/json' \
  -H 'X-Rated-Network: mainnet' \
  -H 'Authorization: Bearer <YOUR-TOKEN-HERE>'
  ```

  ```python python theme={null}
  import requests

  url = "https://api.rated.network/v0/eth/validators/effectiveness"
  params = {
      "indices": [675893, 675894, 675895],
      "from": "2023-08-31",
      "size": 31,
      "granularity": "day",
      "filterType": "datetime",
      "groupBy": "timeWindow",
      "include": [
          "validatorCount", "avgInclusionDelay", "avgUptime",
          "avgCorrectness", "avgProposerEffectiveness",
          "avgValidatorEffectiveness", "avgAttesterEffectiveness",
          "sumCorrectHead", "sumCorrectTarget", "sumCorrectSource",
          "sumInclusionDelay", "sumProposedCount", "sumProposerDutiesCount",
          "slashesCollected", "slashesReceived", "day",
          "sumMissedSyncSignatures", "sumLateSourceVotes",
          "sumWrongTargetVotes", "sumLateTargetVotes",
          "sumMissedAttestations", "sumWrongHeadVotes",
          "sumExecutionProposedEmptyCount"
      ]
  }
  headers = {
      "Content-Type": "application/json",
      "X-Rated-Network": "mainnet",
      "Authorization": "Bearer <YOUR-TOKEN-HERE>"
  }

  response = requests.get(url, params=params, headers=headers)
  print(response.json())
  ```
</CodeGroup>
