# JoinSplits

Veilnyx protocol transactions are specifically based on JoinSplit [transactions from ZCash](https://forum.zcashcommunity.com/t/is-my-understanding-of-how-zcash-works-correct/961).  In the overview, in a JoinSplit, a number of existing notes are spent, and new notes are created such that the total value remains conserved.

When a user spends his notes in a transaction, the so-called **nullifiers** of those notes need to be revealed. A nullifier is a unique element that is cryptographically bound to a note and can only be calculated with the knowledge of a note's properties, i.e. by its owner. The spent notes' nullifiers are marked in the application to prevent notes with already marked nullifiers from being spent again. A fresh set of new notes is created such that the total value is conserved in the state of application. The bearer of the newly created notes, however, may change in a transaction. In case of an external deposit/withdrawal of some value, the equivalent value is added/subtracted from newly created notes. Only the **commitments** of newly created notes are publicly shown during the transaction and are inserted into a Merkle tree data structure holding commitments of all notes ever created.

<figure><img src="/files/PNiKOikIYCmFls9e7EaV" alt="" width="563"><figcaption><p>JoinSplit</p></figcaption></figure>

The figure above represents notes involved in a JoinSplit. These transactions can be broadly divided into three types.&#x20;

* **Deposit:** Deposit transaction where a non-zero external amount $$V\_{in}$$ sent with the transaction payload, and equally valued one or more notes ($$N\_3$$ and $$N\_4$$) are created. Any spent notes’ ($$N\_1$$ and $$N\_2$$) value or any external withdrawal amount $$V\_{out}$$ are zero.
* **Withdraw:** Withdraw transaction where non-zero value notes ($$N\_1$$ and $$N\_2$$)  are spent to withdraw some non-zero value  $$V\_{out}$$ less than or equal to the sum of values of spent notes. Any change value left is accounted for by the creation of one or more notes ($$N\_3$$ and $$N\_4$$)  for the user.
* **Transfer:** Transfer transaction where no external value is revealed (i.e. $$V\_{in}$$ = $$V\_{out}$$ = 0). Some notes ($$N\_1$$ and $$N\_2$$) are spent to create some new notes ($$N\_3$$ and $$N\_4$$) such that values remain conserved. However, the bearer of some note ($$N\_3$$ in the figure) may change, which in effect represents a fully private peer-to-peer transfer of value.


---

# 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.veilnyx.com/technical-implementation/core-architecture/joinsplits.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.
