Choose a staking flow
The Staking API creates validators in two ways:Direct 1.0
To start staking on the Ethereum network using the Staking API:- Set up nodes for staking using P2P infrastructure.
- Check the status of the node set-up operation.
- Construct a serialized transaction to deposit the stake amount with a smart contract.
1
Create setting-up node request
-
Prepare
idthat is an arbitrary UUID. Generate it in one of the following ways: -
Set up staking nodes through the P2P infrastructure by sending a POST request to /api/v1/eth/staking/direct/nodes-request/create. Use https://api-test.p2p.org for testing or https://api.p2p.org for production.
Example request:
id— arbitrary UUID. You can later use that UUID to check the status of the set-up operation.type— staking operation type:REGULAR— default value for native staking transactions. Set theREGULARoperation type for this flow.RESTAKING— value that is used to initiate a restaking operation with the EigenPod address.MANAGED_SSV— creates distributed validators that P2P runs on the SSV network. See SSV Managed. The deprecated SSV 1.0 typeSSVis rejected.
validatorsCount— number of validators, from 1 to 3,125 per request. A0x01validator holds 32 ETH; a0x02validator holds 32–2,048 ETH.amountPerValidator— amount to stake per validator in Gwei, from32000000000(32 ETH) to2048000000000(2,048 ETH). If you set it and omitwithdrawalCredentialsType, the API uses0x02. If you omit both, it uses 32 ETH and0x01. A0x01request above 32 ETH is rejected. All validators in one request use the same amount.withdrawalCredentialsType— withdrawal credentials preferred format:0x01or0x02.withdrawalAddress— withdrawal address for the validators.eigenPodOwnerAddress— owner of the EigenPod address. Used in the restaking flow.feeRecipientAddress— fee recipient address.controllerAddress— for the validators.nodesOptions:location— node location. Currently, onlyanyis supported.relaysSet— Miner Extractable Value () relay selection.
2
Check request status
After setting up the node, check the status of the node set-up operation by sending a GET request to /api/v1/eth/staking/direct/nodes-request/status/{id} . You must poll this until status is Example response:
ready.Example request:id— UUID that was specified in the node set-up request.
This example response was obtained on Hoodi. On mainnet,
forkVersion is 00000000 and eth2NetworkName names mainnet.-
status— current status of the nodes request:init— node request was created.processing— node request is in progress.ready— backend has the deposit data for the node request.cancel— something went wrong, and the deposit data was not created. This covers failed generation, exhausted retries, expired requests and cancellation by an administrator. A request does not stay inprocessingindefinitely, so handlecancelwhen polling.
-
amountPerValidator— amount of tokens to stake in Gwei per validator. -
withdrawalCredentialsType— withdrawal credentials preferred format:0x01or0x02. -
depositData:pubkey— validator public key.signature— validator signature.withdrawalCredentials— withdrawal address credentials, passed in the expected format by the Ethereum deposit smart contract.amount— amount of ETH, denominated in Gwei, that is being deposited.depositDataRoot— SHA-256 hash of the SSZ-encodeddepositDataobject. Used as a protection against malformed input.depositMessageRoot— cryptographic hash of the Merkle tree’s root, ensuring the integrity and authenticity of the deposit data.forkVersion— version of the network fork that the deposit is intended for. It helps in aligning the deposit with a specific version of the protocol.eth2NetworkName— name of the Ethereum 2.0 network where the deposit is made.depositCliVersion— version of the deposit command-line interface (CLI) tool that was used to generate the deposit data.nonce— returned only forMANAGED_SSVrequests. SSV registration nonce of the validator; submit deposits in strictly ascending nonce order.
3
Prepare staking transaction
After setting up the nodes and successfully generating the Example response:
depositData, retrieve it and proceed with make the deposit.There are two flows to make a deposit:The current P2pEth2Depositor (v3) supports
0x01 and 0x02 validators and a separate amount per validator.Batch deposit (P2pEth2Depositor)
Create a serialized transaction for depositing the stake amount and send it as a POST request to /api/v1/eth/staking/direct/tx/deposit.-
withdrawalAddress— withdrawal address for the validators. -
depositData:pubkey— validator public key.signature— validator signature.withdrawalCredentials— withdrawal address credentials, passed in the expected format by the Ethereum deposit smart contract.depositDataRoot— hash of the deposit data.
This example response was obtained on Hoodi. On mainnet,
chainId is 1 and to is the mainnet P2pEth2Depositor address.serializeTx— serialized unsigned transaction.to— recipient address for this transaction.gasLimit— maximum 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.type— EIP-2718 type of this transaction envelope.maxFeePerGas— maximum price per unit of gas this transaction will pay for the combined 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 block’s base fee. This added fee is used to incentivize miners to prioritize this transaction.
serializeTx from the previous step to sign and send the signed transaction to the Ethereum network.Broadcasting this transaction deposits the stake for every validator in the request. The P2pEth2Depositor contract forwards the ETH to the beacon deposit contract in the same transaction and holds none of it.Ethereum direct deposit
Use this if you prefer to interact with the official Ethereum contract without a proxy.- Take
pubkey,withdrawalCredentials,signatureanddepositDataRootfor each validator from the status response. - Go to the Official Ethereum Deposit Contract
- Call
depositonce per validator, sending that validator’samount(converted from Gwei to wei). ForMANAGED_SSV, submit in ascendingnonceorder.
Smart contracts
Current addresses
Returned by the API endpoint; forwards to Beacon DepositContract.
Previous addresses
Legacy P2pEth2Depositor v1 and v2. Deprecated: they deposit a fixed 32 ETH per validator and cannot create 0x02 validators. Existing on-chain integrations keep working; the API now returns transactions for v3 only.