> For the complete documentation index, see [llms.txt](https://docs.vapinetwork.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vapinetwork.ai/stake/how-staking-works.md).

# How staking works

Stake is coming soon; active stake checkpoints and a seven-day unstaking cooldown define the planned staking flow.

{% hint style="info" %}
Stake is coming soon. This page describes how it works at launch.
{% endhint %}

Staking moves vAPI into `VapiStaking` as active stake. The contract records timestamp checkpoints so the Compute distribution can use the stake position at the daily snapshot.

## Stake

Approve the exact amount of vAPI that you want to stake, then call:

```solidity
stake(uint256 amount)
```

The amount must be greater than zero. The contract transfers the approved tokens from your wallet, increases your active stake and the network total, and writes checkpoints for both balances.

## Request an unstake

Call:

```solidity
requestUnstake(uint256 amount)
```

The amount must be greater than zero and no greater than your active stake. You can have one pending unstake per wallet. When the request succeeds:

* The requested amount leaves your active stake immediately.
* The amount stays in the contract during the cooldown.
* `availableAt` is the request time plus `604800` seconds, or 7 days.
* The amount is added to the pending-unstake total.

You can add more stake while an unstake is pending. A second `requestUnstake` is rejected until the first pending unstake is withdrawn.

## Withdraw

After `availableAt`, call:

```solidity
withdraw()
```

The contract clears the pending request and transfers the pending amount only to the wallet that made the request. Calling `withdraw` before `availableAt` fails. There is no expiry window after the cooldown.

<figure><picture><source srcset="/files/Na7CMF2Ds8D2C2YZ3gxG" media="(prefers-color-scheme: dark)"><img src="https://2910737941-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FluFLDikXvA0Cayg0zp6v%2Fuploads%2Fgit-blob-ca321b33c9786637e9320ffad189638662e8e4f4%2Fvapi-stake-unstake-light.svg?alt=media" alt="The life of staked vAPI. Your wallet calls stake(amount) after approving the exact amount, and the tokens become active stake, which counts at each 00:00 UTC Compute snapshot; you can add more at any time. requestUnstake(amount) moves the amount out of active stake at once into a pending unstake that stays in the contract, with one pending unstake per wallet. Seven days later, at availableAt, the amount becomes withdrawable with no expiry window, and withdraw() sends it to the same wallet only; withdraw() fails before availableAt. On the timeline, day 0 is the requestUnstake, the cooldown is 604,800 seconds, and day 7 is availableAt."></picture><figcaption><p>Unstake requests remove tokens from active stake immediately. Those tokens stop counting at the next 00:00 UTC Compute snapshot. Today's distribution stays unaffected. You can withdraw the tokens seven days after the request.</p></figcaption></figure>

## Historical reads

Tokens sent directly to the staking contract do not increase active stake. The `unaccountedStakingToken()` read reports tokens held by the contract above the accounted active and pending totals.

The contract stores timestamp checkpoints for each wallet's active stake and for total active stake. `stakedBalanceAt` and `totalStakedAt` read those checkpoints. A lookup for a future timestamp reverts.

## Administrative posture

`VapiStaking` is ownerless and not upgradeable. It has no pause, slashing, or principal-rescue path. Active stake and pending amounts leave through the contract functions described above.

Checked on 2026-10-02.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.vapinetwork.ai/stake/how-staking-works.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
