> ## 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.

# Staking & Delegation

> Validator selection, delegation, withdrawal availability, and staking-pool custody.

NEAR delegation uses staking-pool contracts to manage delegated funds and distribute rewards. For an exchange, this requires tracking balances held in each pool and when unstaked funds become available for withdrawal.

***

<h2 id="how-do-we-get-the-balance-of-an-account-after-it-has-delegated-funds%3F">
  Balances and Withdrawals
</h2>

Query the staking-pool contract for the account's delegated balance. In the reference pool, the following read-only methods take `{"account_id":"<delegator_account_id>"}` and return balances in yoctoNEAR:

| Method | Result |
| - | - |
| `get_account_staked_balance` | Staked balance |
| `get_account_unstaked_balance` | Unstaked balance, which may still be waiting for withdrawal |
| `get_account_total_balance` | Sum of staked and unstaked balances |
| `is_account_unstaked_balance_available` | Whether the unstaked balance can be withdrawn in the current epoch |

Unstaking and withdrawing are separate operations. The [reference staking pool](https://github.com/near/core-contracts/blob/master/staking-pool/src/lib.rs) waits four epochs before withdrawal becomes available; query the selected pool’s withdrawal availability.

Use `unstake` or `unstake_all` to unstake, then `withdraw` or `withdraw_all` to return available funds to the delegator's account. See [Validator Staking](/protocol/network/staking) for commands and [Balances & Reconciliation](/integrations/balance-changes) for account balance queries.

***

<h2 id="what-is-the-process-for-becoming-a-validator%3F">
  Validator Participation
</h2>

Anyone can become a validator by meeting the network’s stake requirements and following the protocol’s validator selection process.

Submit a staking proposal and inspect the current and upcoming validator sets through the [network RPC](/api/rpc/introduction). Selection changes take effect at epoch boundaries. See [validators](/protocol/network/validators) for current requirements.

***

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="How long does a validator remain a validator?" id="how-long-does-a-validator-remain-a-validator%3F">
    A validator will stop being a validator for the following reasons:

    * Not producing enough blocks or chunks.
    * Not getting elected in the auction for next epoch because their stake is not large enough.

    A validator can continue while meeting the election and performance requirements. Slashing is not enabled in nearcore 2.13.4.

    Validator election happens in [epochs](/protocol/network/epoch). Validator assignments are determined ahead of the epoch in which they apply. Query upcoming validator sets to determine when a staking proposal takes effect.
  </Accordion>

  <Accordion title="What is the penalty for misbehaving validators?" id="what-is-the-penalty-for-misbehaving-validators%3F">
    Validators are not slashed for being offline but they do miss out on the rewards of validating. Validators who miss too many blocks or chunks will be removed from the validation set in the next auction and not get any reward (but, again, without slashing).
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.