---
updatedAt: 2026-09-29T11:00:11.000Z
agentTools:
  projectIndex: https://docs.stake.fish/llms.txt
---

# Stake Your First Validator

In this guide, you'll learn how to stake your first Ethereum validator on the testnet. Whether you're new to staking or looking for a streamlined process, this step-by-step guide covers all the essentials to get you up and running in a few minutes.

<Callout icon="🚧" theme="warn">
  ### Important

  This staking process is designed for institutions that want to hold custody over funds. It means you must have full control over the wallet from which deposits will be made. Never share the API keys discussed in this guide with third parties, particularly via web-based interfaces.

  If your goal is to enable non-custodial staking for your customers (they will retain control of their wallet and funds), we recommend exploring our [Client Staking](https://docs.stake.fish/docs/ethereum-client-staking) product, which provides access to public APIs and API keys tailored for customer-managed staking.
</Callout>

# What's a Validator?

Validators are the heart of the Ethereum network. Before you proceed with staking, it's essential to understand their role.

A validator is an entity that participates in the consensus layer by proposing and validating new blocks on the blockchain. Each validator must stake a minimum of 32 Ether (up to a maximum of 2048 Ether) as collateral to ensure honest behavior. Validators play a crucial role in maintaining the network's security and integrity. In return, they earn rewards in the form of Ether.

# Post-Pectra Staking Changes

The **Pectra upgrade** introduced a major change to Ethereum staking:
withdrawal credentials now support two formats that define how rewards are handled:

* **0x01 (Classic Staking)** → Rewards are withdrawn to a fixed payout address.
* **0x02 (Compounding Staking)** → Rewards are restaked automatically, increasing the validator's balance.

This provides institutions with more flexibility: either opt for predictable payouts to treasury, or maximize compounding yield for long-term growth.

# 0x01 vs 0x02 Staking

| Type     | Prefix | Behavior                                                                       | Benefits                                                    | Best For                                                                                                   |
| -------- | ------ | ------------------------------------------------------------------------------ | ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| **0x01** | `0x01` | Rewards and principal are sent to a **withdrawal address**.                    | Liquidity: you can receive rewards regularly and move them. | Institutions that need predictable ETH flow into treasury, custodians managing funds on behalf of clients. |
| **0x02** | `0x02` | Rewards are **compounded** by being added directly to the validator's balance. | Maximized long-term returns through automatic compounding.  | Long-term holders, institutions that don't need regular payouts and want to grow validator balance.        |

<Callout icon="⚖️" theme="default">
  ### **Rule of Thumb:**

  - Use **0x01** if you need liquidity and frequent access to staking rewards.
  - Use **0x02** if you want to maximize yield by compounding rewards into the validator balance.
</Callout>

# Check Remaining Public Keys

Before creating validators, check if your organization has enough allocated public keys:

```shell
curl -X GET "https://api.hoodi.stake.fish/eth/stake/v1/remaining-keys" \
     -H "Authorization: YOUR_SECURE_API_KEY"
```

<Callout icon="📘" theme="info">
  ### **Note:** Pass your API key directly in the `Authorization` header without a `Bearer` prefix.
</Callout>

This returns the number of remaining public keys as plain text.
Example response: `716` means you have 716 keys available.

# Create Validator

Once ready, you can create validators using the stakefish API.

## v1 API

```shell
curl -X POST "https://api.hoodi.stake.fish/eth/stake/v1/create-validators-admin" \
    -H "Content-Type: application/json" \
    -H "Authorization: YOUR_SECURE_API_KEY" \
    --data '{
        "count": "VALIDATOR_COUNT_UP_TO_100_AT_ONCE",
        "withdrawalCredentials": "YOUR_WITHDRAWAL_CREDENTIALS"
    }'
```

### Notes (v1):

* `count`: Number of validators to create (max 100).
* `withdrawalCredentials`: Must start with `0x01`. The V1 API only supports `0x01` withdrawal credentials.
* Deposits are always exactly 32 ETH per validator (total = 32 ETH × number of validators).
* For `0x02` withdrawal credentials with flexible deposit amounts, use the **V2 API**.

***

## v2 API (Recommended)

```shell
curl -X POST "https://api.hoodi.stake.fish/eth/stake/v2/create-validators-admin" \
    -H "Content-Type: application/json" \
    -H "Authorization: YOUR_SECURE_API_KEY" \
    --data '{
        "amounts": ["32", "64"],
        "withdrawalCredentials": "YOUR_WITHDRAWAL_CREDENTIALS"
    }'
```

### Notes (v2):

* `amounts`: Array of deposit amounts in **Ether** (decimal strings), one per validator, each between 32 and 2048 ETH, max 100 per request.
* `withdrawalCredentials`: Must be `0x02` compounding credentials (32 bytes), or a plain address which is converted to `0x02` credentials. `0x01` is not accepted on V2 — use the V1 API for 32 ETH `0x01` validators.

Example response:

```json
{
  "pubkeys": "0x<48 bytes per validator, concatenated>",
  "withdrawalCredentials": "0x020000000000000000000000<20-byte address>",
  "signatures": "0x<96-byte BLS deposit signature per validator, concatenated>",
  "depositDataRoots": ["0x<32 bytes>", "0x<32 bytes>"],
  "depositAmountsEth": ["32", "64"]
}
```

All arrays and concatenated fields are in the same validator order. `withdrawalCredentials` is a single 32-byte value shared by every validator in the batch.

***

# Deposit Validator

After creating validators and receiving deposit data, send the deposit transaction to Ethereum.

Steps:

1. Read the current per-validator fee from the **Batch Deposit Contract** (`fee()`, in wei).
2. Encode deposit calldata with the validator data returned by `create-validators`.
3. Send the transaction with `value = sum(deposit amounts) + validatorCount × fee`.
4. Wait for validator activation.

### Batch Deposit Contract Addresses

| Network       | V1 API (0x01)                                | V2 API (0x02)                                |
| ------------- | -------------------------------------------- | -------------------------------------------- |
| Hoodi Testnet | `0xAa41b40908dEa0430461Aa946993F15C891268e2` | `0x3b56fbba5a13c40cb9036b507544516aee09b5ec` |
| Mainnet       | `0x0194512e77d798E4871973d9cB9D7DDFC0fFd801` | `0xaD1D64a4e6a93B79581A8a0AA5816b6E4552b8Bd` |

Use the appropriate contract address based on which API version (V1 or V2) and network you are using. The two contracts have **different ABIs**:

| Contract  | Function                                                                                                                               | Required `msg.value`                  |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| V1 (0x01) | `batchDeposit(bytes pubkeys, bytes withdrawal_credentials, bytes signatures, bytes32[] deposit_data_roots) payable`                    | `validatorCount × (32 ETH + fee)`     |
| V2 (0x02) | `batchDeposit(bytes pubkeys, bytes withdrawal_credentials, bytes signatures, bytes32[] deposit_data_roots, uint256[] amounts) payable` | `sum(amounts) + validatorCount × fee` |

* `amounts` (V2 only) are **in wei**, one per validator, in the same order as `depositDataRoots`. Convert each entry of `depositAmountsEth` with `parseEther`. Each must be between 32 and 2048 ETH and a multiple of 1 gwei.
* `fee` is a per-validator service fee in wei, read from the contract's `fee()` view. It is currently `0` on all four contracts; always read it rather than hard-coding it, since it can change. When it is `0` the value is simply the sum of the deposits.
* The contract reverts with `BatchDeposit: Amount is not aligned with validator amounts` (V2) / `... with pubkeys number` (V1) if `msg.value` is not exact — overpaying also reverts.
* At most 100 validators per transaction.

Example (V2, using `viem`):

```javascript
import { createPublicClient, createWalletClient, custom, http, encodeFunctionData, parseAbi, parseEther } from 'viem'
import { hoodi } from 'viem/chains'

const BATCH_DEPOSIT_ADDRESS = '0x3b56fbba5a13c40cb9036b507544516aee09b5ec' // Hoodi V2

const abi = parseAbi([
  'function batchDeposit(bytes pubkeys, bytes withdrawal_credentials, bytes signatures, bytes32[] deposit_data_roots, uint256[] amounts) payable',
  'function fee() view returns (uint256)',
])

const publicClient = createPublicClient({ chain: hoodi, transport: http() })
const walletClient = createWalletClient({ chain: hoodi, transport: custom(window.ethereum) })
const [account] = await walletClient.getAddresses()

// Response of POST /eth/stake/v2/create-validators-admin
const res = await createValidatorsResponse.json()

const amounts = res.depositAmountsEth.map((eth) => parseEther(eth)) // wei
const fee = await publicClient.readContract({ address: BATCH_DEPOSIT_ADDRESS, abi, functionName: 'fee' })
const value = amounts.reduce((a, b) => a + b, 0n) + BigInt(amounts.length) * fee

const txHash = await walletClient.sendTransaction({
  account,
  to: BATCH_DEPOSIT_ADDRESS,
  data: encodeFunctionData({
    abi,
    functionName: 'batchDeposit',
    args: [res.pubkeys, res.withdrawalCredentials, res.signatures, res.depositDataRoots, amounts],
  }),
  value, // e.g. amounts ["32", "64"] and fee 0 → 96 ETH; with fee 0.01 ETH → 96.02 ETH
})

console.log('Transaction Hash: ', txHash)
```

For V1, drop the `amounts` argument, use the 4-argument ABI above and `value = BigInt(count) * (parseEther('32') + fee)`.

***

# Final Steps

After sending the transaction, you'll receive a transaction hash. Monitor it via [Hoodi Etherscan](https://hoodi.etherscan.io/) or your preferred explorer.

**Validator Activation:**
Once confirmed, your validator enters the activation queue. This can take a few minutes to several days depending on network load.

***

✅ You've successfully staked your Ethereum validator using stakefish API.
Choose **0x01** if you need liquidity and frequent payouts, or **0x02** if you want to maximize long-term compounding returns.