# Consolidation & Switch

### What is Consolidation and Switching ?

Pectra EIP 7251 enables consolidation of stake from multiple validators into a single validator with a maximum effective balance of 2048 ETH. This operations moves stake from multiple validators into a single validator without having to exit the validators from the network.&#x20;

Switching operations are performed to convert validators with 0x01 type withdrawal credentials to 0x02 type withdrawal credentials in order to be eligible for auto-compounding and partial withdrawals.&#x20;

## API Reference

* [Consolidation Request](#consolidation-request)
  * [Sample Request](#sample-request)
  * [Types](#types)
    * [Consolidate Response Object](#consolidate-response-object)
* [Switch Request](#switch-request)
  * [Sample Request](#sample-request-1)
  * [Types](#types-1)
    * [Switch Response Object](#switch-response-object)

## Consolidation Request

<mark style="color:green;">`POST`</mark> `/validators/consolidate`

Submits a consolidate request to generate an unsigned transaction. This transaction needs to be signed by the validator withdrawal address and broadcasted to the network to trigger consolidation.<br>

#### Headers

| Name                                      | Type   | Description                   |
| ----------------------------------------- | ------ | ----------------------------- |
| api-key<mark style="color:red;">\*</mark> | String | API Key provided by Luganodes |

#### Request Body

| Name                                           | Type   | Description                        |
| ---------------------------------------------- | ------ | ---------------------------------- |
| sourcePubKey<mark style="color:red;">\*</mark> | String | Public address of source validator |
| targetPubKey<mark style="color:red;">\*</mark> | String | Public address of target validator |

{% tabs %}
{% tab title="200: OK Consolidate Response Object" %}

```json
{
    "message": "Consolidation request transaction created successfully",
    "consolidationRequestTrx": {
        "to": "0x0000bbddc7ce488642fb579f8b00f3a590007251",
        "data": "0x9838f66ccbe1dcd40b31e619c8fdd6aa3ce1e4f8c5ba0eb04776202612d4898f9967de72983711297b1af0868c73f973b5a2635ef8d420a0c5d23341c638dd11a500aefa8f7d9fc1f726edbf8163f4e0b727f47faa57b91af50c13e863f13142",
        "value": 1,
        "nonce": 54,
        "gasLimit": 100000,
        "maxFeePerGas": "2297448015",
        "maxPriorityFeePerGas": "84044341",
        "type": 2,
        "chainId": "560048"
    },
    "unsignedTx": "0x02f87883088bb0368405026a358488f0464f830186a08001b8609838f66ccbe1dcd40b31e619c8fdd6aa3ce1e4f8c5ba0eb04776202612d4898f9967de72983711297b1af0868c73f973b5a2635ef8d420a0c5d23341c638dd11a500aefa8f7d9fc1f726edbf8163f4e0b727f47faa57b91af50c13e863f13142c0"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Consolidation operations can be performed for one source and one target validator at a time.  If you want to perform batch operations, you can use our [CLI](/tools/ethereum/pectra-cli.md).
{% endhint %}

#### **Sample Request**

```bash
curl --location '{{url}}/api/validators/consolidate' \
--header 'api-key: 7f9c2b4a1e6d4c8fb3a9d0e5c2f18a47c91b6d3a2f0e8c4b9a5d1e7f2=' \
--data '{
    "sourcePubKey": "0x9838f66ccbe1dcd40b31e619c8fdd6aa3ce1e4f8c5ba0eb04776202612d4898f9967de72983711297b1af0868c73f973",
    "targetPubKey": "0xb5a2635ef8d420a0c5d23341c638dd11a500aefa8f7d9fc1f726edbf8163f4e0b727f47faa57b91af50c13e863f13142"
}'
```

#### **Types**

#### Consolidate Response Object

<table><thead><tr><th width="216.13020833333331">Property</th><th width="469">Description</th><th>Type</th></tr></thead><tbody><tr><td>message</td><td>Transaction generation status</td><td>String</td></tr><tr><td>consolidationRequestTrx</td><td>Transaction Object</td><td>Object</td></tr><tr><td>unsignedTx</td><td>Unsigned transaction object which needs to be signed wiith the validator withdrawal address</td><td>String</td></tr></tbody></table>

## Switch Request

<mark style="color:green;">`POST`</mark> `/validators/switch`

Submits a switch request to generate an unsigned transaction which needs to be signed with the validators withdrawal address and broadcasted to the network. This operation will convert your validators 0x01 withdrawal credentials to 0x02 type.<br>

#### Headers

| Name                                      | Type   | Description                   |
| ----------------------------------------- | ------ | ----------------------------- |
| api-key<mark style="color:red;">\*</mark> | String | API Key provided by Luganodes |

#### Request Body

| Name                                     | Type   | Description                  |
| ---------------------------------------- | ------ | ---------------------------- |
| pubKey<mark style="color:red;">\*</mark> | String | Public address of  validator |

{% tabs %}
{% tab title="200: OK Switch Response Object" %}

```json
{
    "message": "Validator switch request txn created successfully",
    "switchRequestTrx": {
        "to": "0x0000bbddc7ce488642fb579f8b00f3a590007251",
        "data": "0x9838f66ccbe1dcd40b31e619c8fdd6aa3ce1e4f8c5ba0eb04776202612d4898f9967de72983711297b1af0868c73f9739838f66ccbe1dcd40b31e619c8fdd6aa3ce1e4f8c5ba0eb04776202612d4898f9967de72983711297b1af0868c73f973",
        "value": "11",
        "nonce": 60,
        "gasLimit": 100000,
        "maxFeePerGas": "2267675245",
        "maxPriorityFeePerGas": "87740461",
        "type": 2,
        "chainId": "560048"
    },
    "unsignedTx": "0x02f88c83088bb03c84053ad02d848729fa6d830186a0940000bbddc7ce488642fb579f8b00f3a5900072510bb8609838f66ccbe1dcd40b31e619c8fdd6aa3ce1e4f8c5ba0eb04776202612d4898f9967de72983711297b1af0868c73f9739838f66ccbe1dcd40b31e619c8fdd6aa3ce1e4f8c5ba0eb04776202612d4898f9967de72983711297b1af0868c73f973c0"
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Switch operations can be performed for one validator at a time.  If you want to perform batch operations, you can use our [CLI](/tools/ethereum/pectra-cli.md).
{% endhint %}

#### **Sample Request**

```bash
curl --location '{{url}}/api/validators/switch' \
--header 'api-key: 7f9c2b4a1e6d4c8fb3a9d0e5c2f18a47c91b6d3a2f0e8c4b9a5d1e7f2=' \
--data '{
    "pubKey": "0x9838f66ccbe1dcd40b31e619c8fdd6aa3ce1e4f8c5ba0eb04776202612d4898f9967de72983711297b1af0868c73f973"
}'
```

#### **Types**

#### Switch Response Object

<table><thead><tr><th width="216.13020833333331">Property</th><th width="469">Description</th><th>Type</th></tr></thead><tbody><tr><td>message</td><td>Transaction generation status</td><td>String</td></tr><tr><td>switchRequestTrx</td><td>Transaction Object</td><td>Object</td></tr><tr><td>unsignedTx</td><td>Unsigned transaction object which needs to be signed wiith the validator withdrawal address</td><td>String</td></tr></tbody></table>


---

# 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.luganodes.com/apis/ethereum/consolidation-and-switch.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.
