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

# Deposits

To make a deposit, the user first *instantiates* a deposit by calling a contract called the *Deposit Manager.* Instantiating a deposit entails two things:

1. Specifying the asset/amount the user would like to deposit + the [stealth address ](/nocturne/protocol-concepts/keys-and-stealth-addresses.md)they would like to "own" the deposited funds
2. Sending the specified asset and amount to the Deposit Manager contract

The Deposit Manager is a temporary "waiting room" where pending deposit request and related funds sit. If the user would like to retrieve their deposit, they can call on the Deposit Manager contract to retrieve their funds at any time.

While the funds sit in the Deposit Manager, a permissioned actor called the deposit screener polls for new deposits submitted to the Deposit Manager, signs all deposits under an acceptable risk threshold, and "completes" the deposit by submitting their signature to the Deposit Manager.

Upon receipt of a "complete deposit" transaction containing a valid screener signature, the Deposit Manager will move the funds into the primary "entry point" of the protocol - the Teller. Additionally, the deposit completion will trigger a third contract called the *Handler* to create a [note](/nocturne/protocol-concepts/notes-commitment-tree-nullifiers-and-joinsplits.md#notes) listing the deposited asset as the asset, the deposited amount as the amount, and the deposit address as the note's owner.

Once the note is created, it is queued for insertion into an on-chain merkle tree called the *commitment tree*. The commitment tree is a merkle tree of all notes ever created by the protocol. Later, when the user wishes to spend the note, they will prove its validity inside a ZKP by proving membership of the note in the tree.

Once the note is queued for insertion, the transaction is complete. The note will soon be inserted via a [Subtree Update](/nocturne/protocol-details/commitment-tree/subtree-update-circuit.md) in a batch together with other new notes to save gas. See [Commitment Tree](/nocturne/protocol-details/commitment-tree.md) for details on the subtree update mechanism.


---

# 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://nocturne-xyz.gitbook.io/nocturne/protocol-concepts/deposits.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.
