NEAR uses a Proof-of-Stake (PoS), meaning that users chose the active node validators by delegating their tokens to them. In this article you’ll find a detailed explanation of the staking process, including delegating, viewing balances, and withdrawing using the NEAR CLI.Documentation Index
Fetch the complete documentation index at: https://docs.near.org/llms.txt
Use this file to discover all available pages before exploring further.
Contract source codeYou can review the Staking pool smart contract source code in this GitHub repository.
Delegate NEAR tokens
Before delegating, you need to choose a validator (a node that participates in staking). Check NearBlocks, Pikespeak or Near Staking, and look for validators with a good track record, uptime, and reasonable commission rates.List validators using CLI
List validators using CLI
If you prefer, you can get the list of current validators by using the
near-validator CLI:Stake Tokens
- Staking CLI
- Function Call
Lantstool
Staked Balance
To check your staked balance on the<my_validator> pool for the <user-account.near> account, run the following command:
- Staking CLI
- Function Call
Lantstool
Staking pool balances
Staking pool balances
You can view additional information and balances from the staking pool using the following CLI commands:
Total staked balance of the entire pool
- 🖥️ CLI
Lantstool
Owner of the staking pool
- 🖥️ CLI
Lantstool
Current reward fee
- 🖥️ CLI
Lantstool
Owner’s balance
- 🖥️ CLI
Lantstool
Staking key
- 🖥️ CLI
Lantstool
Withdrawing Staked Tokens
To withdraw your staked tokens, you will first need to “un-delegate” them from the validator. Your tokens will enter a 4 epoch (~24 hours) unbonding period before they can be withdrawn.Unstake Tokens
- Staking CLI
- Function Call
Lantstool
Use the
unstake-all command to to unstake all tokens at once:Query Unstaked Balance
- Staking CLI
- Function Call
Lantstool
Withdraw Tokens
Once the unbonding period has passed, you can withdraw your unstaked tokens:- Staking CLI
- Function Call
Lantstool
If you want to withdraw all available tokens, you can use the
withdraw-all command:Sunsetting a Stake Pool
If you are a stake pool owner and want to wind down your validator service, follow these steps to ensure delegators can safely recover their funds.Step 1: Notify Delegators
Before making any changes, inform your delegators that the pool is shutting down. Give them enough time to unstake and withdraw their tokens. They need to:- Call
unstake_allon the pool. - Wait for the 4-epoch unbonding period (~48 hours).
- Call
withdraw_allto retrieve their tokens.
Step 2: Pause Staking
Callpause_staking from the pool owner account. This causes the contract to unstake everything (stake 0) and stop restaking, without affecting share balances or reward calculations.
The contract will unstake all tokens at the next epoch boundary. Delegators will still see their shares and can unstake and withdraw normally.
Step 3: Withdraw Owner Balance
Once your own staked tokens are unstaked and the unbonding period has passed, withdraw them:- Staking CLI
- Function Call
Step 4: Resume (Optional)
If you decide to keep the pool running again, you can re-enable staking at any time:Tools and Resources
- Supported wallets for staking and managing your tokens:
- To explore validators and staking pools: