Prepare Staking Transaction for Pectra

Objective

Generate a prebuilt transaction aligned with the 0x02 staking flow for interacting with the Smart Contract 3.1.

Applicable Scenarios

  • You want to manually submit a staking transaction to the Ethereum network using 0x02 withdrawal credentials
  • You require a ready-to-sign transaction aligned with the 3.1 contract logic

Endpoints

Flow

  1. Provide required query parameters: amount, withdrawalAddress, controllerAddress, feeRecipientAddress
  2. The API returns a pre-assembled transaction payload (serializeTx) ready to be signed.

This flow is available for both Ethereum and SSV validators and only applies to validators using 0x02 withdrawal credentials.

Flow Example

1. Validator Setup Transaction (Smart Contract 3.1)

Send a GET request to /api/v1/eth/staking/direct/p2p/deposit.

Example request:

curl --request GET \
  --url "https://api.p2p.org/api/v1/eth/staking/direct/p2p/deposit?amount=66&withdrawalAddress=0xFf811dE5A...c599022C28&controllerAddress=0xFf811dE5...599022C28&feeRecipientAddress=0xFf811dE5Ad...53c599022C28" \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <token>'

Example response:

{
  "error": null,
  "result": {
    "serializeTx": "0x02f9025a83088bb0808404c...",
    "to": "0x5189070F8a73A503e7dC863EA146014CB2A8D8Ea",
    "gasLimit": "10000000",
    "data": "0xa49b131b020000000000000...",
    "value": "66000000000000000000",
    "chainId": 560048,
    "type": 2,
    "maxFeePerGas": "2149299070",
    "maxPriorityFeePerGas": "79693564"
  }
}

This method only supports validators using 0x02 withdrawal credentials and works for both Ethereum and SSV staking APIs.