Ethereum
Learn how to connect Ethereum staking via Everstake Wallet SDK API.
Getting Started
You can use Javascript library to implement Ethereum staking for Everstake validator.
TypeScript Library
https://www.npmjs.com/package/@everstake/wallet-sdk-ethereum
Step. 1: Installing the Library
Install the npm library or yarn by copying the code below.
$ npm install @everstake/wallet-sdk-ethereum$ yarn add @everstake/wallet-sdk-ethereumStep. 2: Import Wallet SDK
After installing the app, you can import module of Ethereum blockchain and use the SDK:
Import ES6
// import module
import { Ethereum } from '@everstake/wallet-sdk-ethereum';Import ES5
// import module
const { Ethereum } = require("@everstake/wallet-sdk-ethereum");WARNING
For Ethereum, no API key or authentication token is required. Instead, utilize the source.
The source is a unique identifier provided by the Everstake that allows the Everstake to recognize and verify the origin of the staking transactions.
Please contact us to obtain your unique 'source' value. This approach allows us to track all Ethereum requests originating from your account, ensuring personalized and secure service.
Pay attention that Wallet SDK utilizes Public RPC, you need to replace it with your own RPC URL, as current one has limits.
Methods
Actions
stake(address, amount, source): Stakes funds into pool. The minimum amount required for staking is 0.1 ETH.activateStake(): Activates the pending stake by interchanging it with a withdrawal requests.autocompound(address): Claims all autocompound user rewards and restakes them into new pool automatically.unstake(address, amount, allowedInterchangeNum, source): You can unstake value from autocompound balance. Your ETH can be unstaked immediately if value <= pool pending balance. Also, if 'allowedInterchangeNum > 0', an instant ustake is possible. Else, you need to create a withdraw request. Please note that the execution of a withdraw request may take some time.simulateUnstake(address, amount, allowedInterchangeNum, source): Simulates transactions without committing them. It is required, especially for predicting transaction outcomes and gas fees in Ethereum blockchain.unstakePending(address, amount): Unstakes pending amount. Your ETH will be unstaked immediately. Smart contract checks remainder of pending balance after unstake. It should be greater or equal min stake amount (0.1 ETH for now).claimWithdrawRequest(address): Claims funds requested by withdraw
Getting Info
balance(): Returns total deposited and activated pools balance. The total amount of ETH that has been staked.pendingBalance(): Returns the pending balance of staked ETH in the pool, which is always less than 32 ETH.pendingBalanceOf(address): Returns the pending balance of the user, which represents the amount of ETH staked but not yet active due to the pool not being fully filled. There is one type of pending balance: "Autocompound," which represents rewards earned by the user that are automatically staked but not yet active.pendingDepositedBalance(): Returns pool pending deposited balance. Balance was deposited into Beacon deposit contract but validators are still not active.pendingRestakedRewards(): Returns pool restaked rewards which in pending status.pendingDepositedBalanceOf(address): Returns user pending deposited balance. Balance which deposited into validator but not active yet. Pending deposited balance can't be unstake till validator activation.pendingRestakedRewardOf(address): Returns user restaked rewards in pending state.RestakedRewardOf(address): Returns total user restaked rewards. Includes rewards in pending state.depositedBalanceOf(address): Returns user active origin deposited balance.getPoolFee(): Returns Pool fee in bips (1/10000). To obtain the pool fee percentage, simply multiply it by 100.autocompoundBalanceOf(address): Returns total user autocompound balance. The "Autocompound balance" refers to the user's actively staked ETH balance that continuously increases as rewards are restaked. Part of this balance could be in pending state after rewards autocompound.withdrawRequestQueueParams(): Provides a overview of the withdrawal request queue. It retrieves information about the total amount of funds requested for withdrawal over the entire operational period, giving an insight into the overall demand for withdrawals. Additionally, the function details the current amount that is permissible for interchange with deposits, which is crucial for maintaining a balanced liquidity between incoming and outgoing funds.withdrawRequest(address): Returns user withdraw request info. Actual requested amount and amount ready for claim.minStakeAmount(): Returns the minimum amount required for a single user stake.poolBalances(): Returns batch of pool balances using multicall contract. One call instead of several.userBalances(): Returns batch of user balances using multicall contract. One call instead of several.
Getting Validator Info
closeValidatorsStat(): Returns the number of validators expected to stop.getPendingValidatorCount(): Returns number of validators prepared for deposit.getPendingValidator(index): By using an index, retrieve the pending validator public key. Please note that the list of pending validators is dynamic, and the ordering may be unstable.getValidatorCount(): Returns the total number of known validators. Validators can be in one of the following statuses: pending, deposited, or exited. Exited validators will be replaced by new pending validators to optimize memory usage.getValidator(index): Returns validator pubkey and status.
Stake
The stake namespace contains method used for sending transactions on delegation. The unique method to the stake namespace is:
stake(address, amount, source): Stakes funds into pool. The minimum amount required for staking is 0.1 ETH. Thesourceis a unique identifier provided by the Everstake that allows the Everstake to recognize and verify the origin of the staking transactions.activateStake(): Activates the pending stake by interchanging it with a withdrawal requests.
Stake Code Example
WARNING
Currently, all Wallet SDK methods for Ethereum are available on the Ethereum Mainnet and Holesky test network.
WARNING
Using REST API methods and JS library, you have to sign transaction on your side: see more
Unstake
The unstake namespace contains method used for sending transactions on unstake. The unique method to the unstake namespace is:
unstake(address, amount, allowedInterchangeNum, source): You can unstake value from autocompound balance. Your ETH can be unstaked immediately if value <= pool pending balance. Also, if 'allowedInterchangeNum > 0', an instant ustake is possible. Else, you need to create a withdraw request. Please note that the execution of a withdraw request may take some time. Thesourceis a unique identifier provided by the Everstake that allows the Everstake to recognize and verify the origin of the staking transactions.unstakePending(address, amount): Unstakes pending amount. Your ETH will be unstaked immediately. Smart contract checks the remainder of pending balance after unstake. It should be greater or equal min stake amount (0.1 ETH for now).
Unstake Code Example
Unstake Pending Code Example
Claim Ethereum
The claim namespace contains method used for sending transactions on claim. The unique method to the claim namespace is:
claimWithdrawRequest(address): Claims funds requested by withdraw.
Claim Withdraw Request Code Example
Autocompound
The autocompound namespace contains method used for sending transactions on autocompound. The unique method to the autocompound namespace is:
autocompound(address): Claims all autocompound user rewards and restakes them into pool.
Autocompound Code Example
Getting Info
The get namespace contains method used for getting info. The unique method to the get namespace is:
balance(): Returns total deposited and activated pools balance. The total amount of ETH that has been staked.pendingBalance(): Returns the pending balance of staked ETH in the pool, which is always less than 32 ETH.pendingBalanceOf(address): Returns the pending balance of the user, which represents the amount of ETH staked but not yet active due to the pool not being fully filled. There is one type of pending balance: "Autocompound," which represents rewards earned by the user that are automatically staked but not yet active.pendingDepositedBalance(): Returns pool pending deposited balance. Balance was deposited into Beacon deposit contract but validators are still not active.pendingRestakedRewards(): Returns pool restaked rewards which in pending status.pendingDepositedBalanceOf(address): Returns user pending deposited balance. Balance which deposited into validator but not active yet. Pending deposited balance can't be unstake till validator activation.pendingRestakedRewardOf(address): Returns user restaked rewards in pending state.RestakedRewardOf(address): Returns total user restaked rewards. Includes rewards in pending state.depositedBalanceOf(address): Returns user active origin deposited balance.getPoolFee(): Returns Pool fee in bips (1/10000). To obtain the pool fee percentage, simply multiply it by 100.autocompoundBalanceOf(address): Returns total user autocompound balance. The "Autocompound balance" refers to the user's actively staked ETH balance that continuously increases as rewards are restaked. Part of this balance could be in pending state after rewards autocompound.withdrawRequestQueueParams(): Provides a overview of the withdrawal request queue. It retrieves information about the total amount of funds requested for withdrawal over the entire operational period, giving an insight into the overall demand for withdrawals. Additionally, the function details the current amount that is permissible for interchange with deposits, which is crucial for maintaining a balanced liquidity between incoming and outgoing funds.withdrawRequest(address): Returns user withdraw request info. Actual requested amount and amount ready for claim.minStakeAmount(): Returns the minimum amount required for a single user stake.poolBalances(): Returns batch of pool balances using multicall contract. One call instead of several.userBalances(): Returns batch of user balances using multicall contract. One call instead of several.
Get Balance
Get Pending Pool Balance
Get Pending User Balance
Get Pending User Deposited Balance
Get Pending User Restake Rewards
Get User Active Origin Deposited Balance
Get Pool Fee
Get Autocompound Balance
Get Withdraw Request Queue Params
Get Withdraw Request
Get Unstake Balance
Get Pool Balances
Get User Balances
Getting Validator Info
The getValidator namespace contains method used for getting validator info. The unique method to the getValidator namespace is:
closeValidatorsStat(): Returns the number of validators expected to stop.getPendingValidatorCount(): Returns number of validators prepared for deposit.
getPendingValidator(index): By using an index, retrieve the pending validator public key. Please note that the list of pending validators is dynamic, and the ordering may be unstable.getValidatorCount(): Returns the total number of known validators. Validators can be in one of the following statuses: pending, deposited, or exited. Exited validators will be replaced by new pending validators to optimize memory usage.getValidator(index): Returns validator pubkey and status.
Get Close Validators Stat
Get Pending Validator Count
Get Pending Validator
Get Validator Count
Get Validator
Sign Transaction
Securely sign Ethereum transactions using your own infrastructure with the assistance of our SDK. By signing transactions on your side, you maintain control over your private keys and sensitive data, enhancing the security of your operations. Our SDK simplifies the process, providing the necessary tools and functions to prepare, sign, and send transactions to the Ethereum network while ensuring that your private keys never leave your secure environment.
Signing on your side, Code Example
Simulate Unstake
The simulate namespace contains method used for simalating transactions on unstake. The unique method to the simulate namespace is:
simulateUnstake(address, amount, allowedInterchangeNum, source): Simulates transactions without committing them. It is required, especially for predicting transaction outcomes and gas fees in Ethereum blockchain. Thesourceis a unique identifier provided by the Everstake that allows the Everstake to recognize and verify the origin of the staking transactions.
Simulate Unstake Code Example

