# Unstaking

Unstaking is the process of retrieving the staked assets used for Validator operation.\
Once the process is initiated, the funds previously staked in the rollup contract will be transferred back to the Validator Wallet.

To proceed, certain conditions must be met, and the unstaking script must be executed.

{% hint style="info" %}
Unstaking requires manually running the provided script from the Git Repository.

* ​<https://github.com/dKargo/dkargo-validator-utils>
  {% endhint %}

## STEP 1 - Check Withdrawal Eligibility

To withdraw staked funds, the **curren**t staked RBlock must be finalized.

* The staked assets must remain locked for 6.4 days from the last staking event.
* Validator operation must be stopped until the withdrawal period is reached.

## STEP 2 - Unstake ETH

* Once the required period has elapsed, the **unstake function** can be called to retrieve the staked tokens.
* **Unstaked ETH is not immediately transferred** to the Validator Wallet.
* Instead, it remains **held within the rollup contract** and is managed under the `withdrawableFunds` variable.

```jsx
const res = await rollup.returnOldDeposit(stakerWalletAddress);

const receipt = await res.wait();

console.log(receipt.transactionHash)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dkargo.io/docs2-eng/validator-operations/unstaking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
