Stake Your First Validator
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.
ImportantThis 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 product, which provides access to public APIs and API keys tailored for customer-managed staking.
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. |
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.
Check Remaining Public Keys
Before creating validators, check if your organization has enough allocated public keys:
curl -X GET "https://api.hoodi.stake.fish/v1/eth/stake/v1/remaining-keys" \
-H "Authorization: YOUR_SECURE_API_KEY"
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
curl -X POST "https://api.hoodi.stake.fish/v1/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 with0x01
.- 0x01: Deposits are always exactly 32 ETH per validator.
- 0x02: Still locked to 32 ETH in v1. Use v2 API for flexible deposits.
v2 API (Recommended)
curl -X POST "https://api.hoodi.stake.fish/v1/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.- 0x01: Still fixed at 32 ETH.
- 0x02: Can specify larger amounts (compounding staking).
Deposit Validator
After creating validators and receiving deposit data, send the deposit transaction to Ethereum.
Steps:
- Encode deposit calldata with validator data.
- Send transaction to the Batch Deposit Contract.
- Wait for validator activation.
Example (using viem
):
import { createWalletClient, custom } from 'viem'
import { hoodi } from 'viem/chains'
export const walletClient = createWalletClient({
chain: hoodi,
transport: custom(window.ethereum!),
})
function encodeBatchDepositCalldata(pubkeys, withdrawalCredentials, signatures, depositDataRoots) {
return viem.encodeFunctionData({
abi: [viem.parseAbiItem('function batchDeposit(bytes,bytes,bytes,bytes32[])')],
functionName: 'batchDeposit',
args: [pubkeys, withdrawalCredentials, signatures, depositDataRoots],
})
}
// Example payload
const depositPayload = {
pubkeys: '0x...',
withdrawalCredentials: '0x02...',
signatures: '0x...',
depositDataRoots: ['0x...']
}
const calldata = encodeBatchDepositCalldata(
depositPayload.pubkeys,
depositPayload.withdrawalCredentials,
depositPayload.signatures,
depositPayload.depositDataRoots,
)
const txHash = await walletClient.sendTransaction({
data: calldata,
to: BATCH_DEPOSIT_ADDRESS,
value: 32n * (10n **18n),
type: 'eip1559',
})
console.log("Transaction Hash: ", txHash);
Final Steps
After sending the transaction, you’ll receive a transaction hash. Monitor it via Hoodi Etherscan 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.
Updated 4 days ago