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

# Validator Consolidation

> The Pectra upgrade introduces major improvements to the process of validator creation and management across both Ethereum and SSV staking APIs. These enhancements improve scalability, enable larger validator's effective balance (up to 2048 ETH), and streamline flows using  type of withdrawal credentials.

You can now consolidate your stakes and merge multiple existing validators into one to share a single withdrawal address. By this measure, the following benefits can be gained:

* Easing the process of validator management
* Reducing the number of active validators tied to the same withdrawal address
* Migrating the withdrawal credentials from the `0x01` type to `0x02` which enables auto compounding and simplifies future staking operations
* Preparing the infrastructure for advanced staking operations, such as [top-ups](/docs/incremental-staking-top-up) and [partial withdrawals](/docs/partial-withdrawals)

To consolidate multiple validators:

1. Create the consolidation request.
2. Sign and broadcast the transaction.

Request examples are provided using [cURL](https://curl.se/).

<Check>
  The flow is supported for both Ethereum and SSV validators via the same endpoint.
</Check>

## 1. Create consolidation request

Send a POST request to [/api/v1/eth/staking/direct/tx/consolidation-validators](/reference/eth-staking-consolidation-validators) to prepare a transaction for merging several source validators into a target one.

Note that the maximum effective balance of the target validator is 2048 ETH.

Example request:

<CodeGroup>
  ```bash bash theme={null}
  curl --request POST \
    --url https://api.p2p.org/api/v1/eth/staking/direct/tx/consolidation-validators \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header 'Authorization: Bearer <token>' \
    --data '
  {
    "withdrawalAddress": "0x338EF19fA2eC0fc4d1277B1307a613fA1FBbc0cb",
    "sourcePubkeys": [
      "0xffC08FcD7cFeF5c70fB2b0e1f2A8EaA690AaE2bDFfa5dBEc4dEef31DcC0B19eB1f9Cebe3E2fe9eefBD9a1BDF6FD89b39",
      "0x4Ef81c0018aB0DCbBdC8915D26efAcEa7CDef61eE9aBdddcBdAD2f2F04c5b6E4fBA6F5afD1Ad46267c1DC8544E690fE4"
    ],
    "targetPubkey": "0xffC08FcD7cFeF5c70fB2b0e1f2A8EaA690AaE2bDFfa5dBEc4dEef31DcC0B19eB1f9Cebe3E2fe9eefBD9a1BDF6FD89b39"
  }
  '
  ```
</CodeGroup>

* `withdrawal address` — withdrawal address for the target validator.
* `sourcePubkeys` — list of public keys belonging to the source validators.
* `targetPubkey` — public key of the target validator.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
    "error": null,
    "result": {
      "list": [
        {
          "serializeTx": "0x02f87883088bb080840422bd...334caaf5e9c0",
          "gasLimit": "1000000",
          "data": "0xad9049587a26e8db61f6...1549f334caaf5e9",
          "value": "1",
          "chainId": 560048,
          "type": 2,
          "maxFeePerGas": "2211533588",
          "maxPriorityFeePerGas": "69385672"
        }
      ]
    }
  }
  ```
</CodeGroup>

* `serializeTx` — serialized unsigned transaction.
* `gasLimit` — maximum <Tooltip tip="A measure of computational effort required to execute a transaction or smart contract on a blockchain. Users must pay a gas fee, usually in the native token, to have their transactions processed by the network.">gas</Tooltip> limit for this block.
* `data` — transaction data.
* `value` — amount this transaction is sending in Wei.
* `chainId` — chain ID this transaction is authorized on, as specified by [EIP-155](https://eips.ethereum.org/EIPS/eip-155).
* `type` — [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) type of this transaction envelope.
* `maxFeePerGas` — maximum price per unit of gas this transaction will pay for the combined [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) block's base fee and this transaction's priority fee in Wei.
* `maxPriorityFeePerGas` — price per unit of gas in Wei, which is added to the [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) block's base fee. This added fee is used to incentivize miners to prioritize this transaction.

## 2. Sign and broadcast transaction

Use `serializeTx` from the previous step to [sign and send](/docs/signing-transaction-eth) the signed transaction to the Ethereum network.

By broadcasting this transaction, you are queuing the consolidation request. After the transaction is processed in the chain's queue, the source validator will be closed, and the resulting target validator will use the `0x02` type of withdrawal credentials.


## Related topics

- [Overview](/docs/pectra-overview.md)
- [Validator](/docs/validator.md)
- [Consolidate Multiple Validators](/reference/eth-eigen-consolidation.md)
- [Get Validator Fee](/reference/data-validator-fee.md)
