Shared ETH staking is a mechanism that allows users to stake any amount of Ethereum, breaking down the barriers to entry that traditionally required holding 32 ETH. This model is particularly advantageous for developers and individual users looking to participate in network validation and earn rewards without significant capital investment.
This guide provides a technical overview of how to implement shared ETH staking using two primary address models: the External Address model and the Wallet Address model. We'll cover the core operations—staking, unstaking, claiming stakes, and viewing rewards—along with practical considerations for transaction signing and broadcasting.
Understanding the Two Address Models
The process for interacting with shared ETH staking differs depending on who manages the private keys. You can choose the model that best fits your application's security and usability requirements.
The External Address Model
In the External Address model, the private keys are not managed by any third-party SDK. This is often referred to as a "bring your own wallet" (BYOW) approach. The developer or end-user is entirely responsible for securing the private keys and performing all signing operations off-platform. This model offers maximum self-custody but requires you to handle the complexities of transaction signing.
How to Stake ETH from an External Address
Before initiating a stake, you must ensure the external address holds enough ETH to cover both the stake amount and the network transaction (gas) fees. On testnets, you can often use a faucet to obtain test ETH for development purposes.
Once you build the stake operation through the appropriate API, you will receive unsigned transaction data. This data must be relayed to the end-user for signing using their own wallet software (e.g., MetaMask, Ethers.js). After signing, the transaction must be broadcast to the network.
👉 Explore a step-by-step staking guide
How to Unstake ETH from an External Address
Unstaking is the first step in a two-step withdrawal process. It involves submitting an exit request to the Ethereum network. It is crucial to understand that this process is not instantaneous; it can take the network 1-3 days to process the exit request.
Similar to staking, the unstake operation generates unsigned transaction data. This must be signed by the holder of the private key and then broadcast to the network.
How to Claim a Stake from an External Address
After the network has processed your unstake exit request (after the 1-3 day period), the assets become available to claim. The claim stake operation moves the withdrawn ETH from the staking contract back to your liquid balance.
Again, the operation generates a transaction that requires signing and broadcasting by the owner of the external address.
How to View Staking Rewards from an External Address
Once you stake ETH, rewards begin to accrue. You can programmatically check the rewards accrued by a specific external address by calling the stakingRewards method. This returns data on the rewards earned over a specified time period.
The Wallet Address Model
The Wallet Address model simplifies the development process by having the private keys managed by a dedicated SDK. This means the SDK can sign transactions on behalf of the user, streamlining the user experience. For production environments, it is highly recommended to use a server-signer implementation for enhanced security.
How to Stake ETH from a Wallet Address
To stake from a wallet address, ensure the wallet is funded with enough ETH for the stake and gas fees. The following simplified code example illustrates the process:
import { Coinbase, Wallet, StakeOptionsMode } from "@coinbase/coinbase-sdk";
// Create a new wallet address on the testnet.
let wallet = await Wallet.create({ networkId: Coinbase.networks.EthereumHoodi });
// Check the available balance that can be staked.
let stakeableBalance = await wallet.stakeableBalance(Coinbase.assets.Eth, StakeOptionsMode.PARTIAL);
// Create a stake operation for a specific amount.
let stakeOperation = await wallet.createStake(0.0001, Coinbase.assets.Eth, StakeOptionsMode.PARTIAL);Upon successful completion, the ETH is staked.
How to Unstake ETH from a Wallet Address
Unstaking follows the same network rules: it initiates an exit request that takes 1-3 days to process.
// Check the balance available to unstake.
let unstakeableBalance = await wallet.unstakeableBalance(Coinbase.assets.Eth, StakeOptionsMode.PARTIAL);
// Create an unstake operation.
let unstakeOperation = await wallet.createUnstake(0.0001, Coinbase.assets.Eth, StakeOptionsMode.PARTIAL);How to Claim a Stake from a Wallet Address
After the exit request is processed, you can claim your stake. The following code checks the claimable balance and creates the claim operation.
// Check the balance available to claim.
let claimableBalance = await wallet.claimableBalance(Coinbase.assets.Eth, StakeOptionsMode.PARTIAL);
// Create a claim_stake operation for the full amount.
let claimStakeOperation = await wallet.createClaimStake(claimableBalance, Coinbase.assets.Eth, StakeOptionsMode.PARTIAL);How to View Staking Rewards from a Wallet Address
You can easily retrieve staking rewards for a single wallet or a list of addresses. The example below fetches rewards for the last week.
// Get staking rewards for the default time window (1 week).
let rewards = await wallet.stakingRewards(Coinbase.assets.Eth);
// Iterate through and display each reward.
rewards.forEach(reward => console.log(reward.toString()));For looking up rewards for multiple addresses or getting USD conversion data, the API provides flexible methods to retrieve this information.
Signing and Broadcasting Transactions
For operations generated using the External Address model, you are responsible for signing and broadcasting the transaction data. A common practice is to use a library like Ethers.js to handle this interaction. The general workflow involves:
- Building the operation via the API to get the unsigned transaction.
- Sending the transaction data to the user's wallet for signing.
- Taking the signed transaction and broadcasting it to the network.
👉 Learn advanced transaction handling methods
Frequently Asked Questions
What is the minimum amount of ETH needed for shared staking?
A key advantage of shared staking pools is that there is no minimum requirement. You can stake any amount of ETH, making it accessible to a wide range of users.
How long does it take to unstake ETH?
The unstaking process involves a mandatory exit queue on the Ethereum network. This process typically takes between 1 to 3 days to complete before the funds are available to be claimed.
Can I stake from my existing MetaMask wallet?
Yes, this is possible using the External Address model. You would use your MetaMask wallet's address and then use the staking API to build operations that you subsequently sign with MetaMask.
How often are staking rewards distributed?
Rewards accrue continuously but are typically accounted for in real-time by the protocol. There can be a short delay (often up to a day) before newly accrued rewards are visible in API queries.
Is it safer to use an External Address or a Wallet Address?
The External Address model is considered more secure from a custody perspective because you never relinquish control of your private keys. The Wallet Address model offers greater convenience but requires you to trust the security practices of the SDK provider.
What is the difference between unstaking and claiming?
Unstaking is the act of requesting to exit the staking pool, which starts a several-day process. Claiming is the final step where you actually withdraw the processed funds from the staking contract back to your liquid wallet balance.