> For the complete documentation index, see [llms.txt](https://mixfun.gitbook.io/mixfun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mixfun.gitbook.io/mixfun/concepts/nullifiers.md).

# Nullifiers

> How MixFun prevents the same note from being used to withdraw twice.

A nullifier is a value derived from your deposit's secret that becomes public when the note is withdrawn. The withdrawal transaction publishes the nullifier; the on-chain program records it as spent. Any later attempt to withdraw with the same note fails, because the nullifier is already on the spent list.

Nullifiers are how MixFun gets the guarantee "each note can only withdraw once" without revealing which note was used.

## What a nullifier contains

The nullifier is computed from your deposit's spend secret using a one-way hash. The same secret always produces the same nullifier, but the nullifier cannot be reversed to reveal the secret. This is what makes the scheme work: observers can verify the nullifier has not been spent (it is not in the on-chain registry) without learning anything about which deposit is about to be withdrawn.

## Where nullifiers are stored

Every pool has a paired nullifier registry, an on-chain account that maintains a record of every nullifier spent against that pool. Before accepting a withdrawal, the program checks the registry; if the nullifier is already there, the transaction reverts.

The nullifier registry is program-enforced. Not even MixFun can mark a nullifier as spent or unspent outside the on-chain program logic.

## Why two deposits use different nullifiers

Each deposit generates its own secret plus nullifier, both random. Two deposits from the same wallet produce two different secrets, two different commitments, and two different nullifiers. Withdrawing from one does not affect the other.

## What happens if a nullifier is leaked

A nullifier alone cannot withdraw. Withdrawal requires the secret (to generate the ZK proof), not just the nullifier. Leaking the nullifier leaks the fact that a spend is coming; it does not let an attacker withdraw.

However, publishing a nullifier before a withdrawal is submitted would tell observers exactly which commitment the withdrawal will match. The proof system prevents this: the nullifier only becomes public as part of the withdrawal transaction itself, not earlier.

## Nullifier and note together

A note is "spent" when its nullifier lands on-chain. Before that moment, the note is live and withdrawable. After that moment, the note is inert: it cannot withdraw again, and it cannot be used to link your deposit to the withdrawal after the fact.

See [Notes and custody](/mixfun/concepts/notes-and-custody.md) for the note itself, and [Anonymity sets](/mixfun/concepts/anonymity-sets.md) for the privacy properties that depend on the nullifier not leaking early.


---

# 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://mixfun.gitbook.io/mixfun/concepts/nullifiers.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.
