Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to readme and cosmetic changes to figures #247

Merged
merged 6 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 51 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,72 @@
# Taiga

Taiga is a framework for generalized shielded state transitions.
This repository contains the implementation of Taiga in Rust.
Taiga is a framework for generalized shielded state transitions. This repository contains the implementation of Taiga in Rust.

⚠️ It is a WIP project and cannot be used in production yet ⚠️
⚠️ Taiga is WIP and cannot be used in production yet ⚠️

# Introduction
![Taiga at the bottom, as a foundation for Taiga applications, and their state is stored in Notes.](./book/src/images/Intro_UTXO.png)

Taiga is a shielded state transition protocol that allows applications
built on top of it to enjoy the advantages of fully shielded multi-party
state transitions
(hiding the application type, the data associated with it, involved
parties, etc) without giving up the application complexity.
## Taiga in 500 Words

![img.png](./book/src/images/intro_taiga_app.png)
Taiga is a state transition protocol that allows applications built on top of it to enjoy the advantages of fully shielded multi-party state transitions (hiding the application type, the data associated with it, involved parties, etc.) without giving up the application complexity. Although an independent project, Taiga is intended to be at the heart of Anoma. Conceptually, Taiga can be seen as an operating system for execution of Anoma programs. In practice, Taiga is a set of APIs for creating notes, intents, transactions – for both shielded and transparent execution; creating and verifying transaction validity proofs; computing the state changes produced by transactions; de-/serializing all of the above.

[**Validity predicates**](./book/src/validity-predicates.md) are a key
component of
Taiga - applications built on top of Taiga use them to express the
application rules,
and Taiga makes sure that the rules are being followed with the help of
the [Action circuit](./book/src/action.md).
A [Note](./book/src/notes.md) represents an Anoma resource in Taiga. Notes are immutable and have a "denomination" and a non-negative value, among other fields. Every note has several executable programs (often referred to as [Validity Predicates](./book/src/validity-predicates.md) or VPs) associated with it. Input for programs is the notes plus a number of additional public and private inputs to the VPs. Taiga programs result in a state change, which includes a list of destroyed (or "nullified") notes and a list of newly created notes. Any existing note being input into a program gets destroyed. Destroying a note means revealing its nullifier, a secret value bound to the note. Note ownership is determined by knowledge of the nullifier plus arbitrary logic in a VP associated with the note. Creating a note means computing its commitment (a hash), and adding it to a merkle tree. The global state of Anoma is a hashset of note nullifiers and a commitment tree.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would explain in a couple of words what you mean by "denomination", especially since you use " "

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every note has several executable programs

Doesn't have to be several, unless several can mean just one too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Input for programs is the notes

What notes and what is the purpose of those programs?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taiga programs result in a state change,

Kinda vague enough to count as correct but still gives an incorrect vibe. They validate the proposed state change, don't create it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should switch to "consume" instead of "destroy" but it is a low priority question

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note ownership is determined by knowledge of the nullifier plus arbitrary logic in a VP associated with the note.

Questionable. The difference is also somewhat vague, but I would say that note ownership = knowledge of the nullifier (although we might want to clarify the difference between the case when the nullifier is published and is known to everyone), but owning a note alone doesn't allow you to induce the state change (in that sense, the state change is "owned" by a VP, because in the end VPs define if the state is acceptable)

Copy link
Contributor Author

@bazzilic bazzilic Nov 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To address some of your questions, the purpose of this particular text is to be short and provide an intuitive overview of the whole lifecycle rather than be fully technically correct (we have specs for that).

They validate the proposed state change, don't create it

Not since transparent execution is part of Taiga too. Transparent VPs can create state changes.

switch to "consume" instead of "destroy"

Maybe in the specs, but this was a point that I didn't understand for a while in the beginning that "spent" or "consumed" notes essentially get destroyed.

I would say that note ownership = knowledge of the nullifier

I meant an (optional) user VP, which would provide an additional factor for authorizing spending the note.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not since transparent execution is part of Taiga too. Transparent VPs can create state changes.

Hmm interesting. The whole idea of state change created by a predicate doesn't make sense to me, are transparent predicates still predicates?

Maybe in the specs, but this was a point that I didn't understand for a while in the beginning that "spent" or "consumed" notes essentially get destroyed.

I get what you mean, but this phrasing also confuses people. They think it literally stops existing, but it just becomes invalid (yet sort of exists in the form of cm/nf being stored). We can say destroyed for now, people are probably confused no matter what word we use 😅

I meant an (optional) user VP, which would provide an additional factor for authorizing spending the note.

I'm really nitpicking here, we don't have to specify this detail in the overview if it hinders more than it helps 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are transparent predicates still predicates

We will know when transparent execution spec is finished! :D

becomes invalid

I can use the word "invalidated" probably


The state transition is considered to be valid if validity predicates of
all involved parties are satisfied, and the Action circuit check passed
successfully.
Taiga transactions consist of valid partial transactions (sometimes referred to as "intents"). Every partial transaction consists of exactly two input notes and two output notes. Output notes are crafted by the creator of the partial transaction. If a transaction gets executed, its output notes are "created": added to the merkle tree. A Partial transaction is considered valid if all programs (VPs) associated with the notes comprising it are valid (result in `true`). If we don't need all 4 note slots in a partial transaction, we can use "padding" notes: they are same as real notes, but have the `is_merkle_checked` flag set to `false`. Padding notes can also be used to describe the user intent by attaching an intent VP to it. Intent VP can describe arbitrarily complex logic of a valid state change: unless it is satisfied, the whole partial transaction would not be valid and therefore can't be part of a valid transaction.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use "padding" notes: they are same as real notes, but have the is_merkle_checked flag set to false.

Could we clarify the three names: padding, ephemeral, and dummy notes?
In the codebase, I use the "padding" to indicate a note with a FALSE is_merkle_checked flag and zero value(quantity). And padding notes are only used to pad when the number doesn't reach 2.
We used to call a note with a FALSE is_merkle_checked flag dummy or ephemeral. But the dummy in the Zcash protocol means a zero-value note. I lean to call it ephemeral.
The spec team might have the definition somewhere? @vveiln

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a discussion that happens as long as I remember. I personally don't like the term ephemeral now, even though I suggested it in the first place 😄 at the time, I thought they only exist within a transaction and disappear without a trace, but then it turned out they still get their nullifiers and commitments added to the state for privacy purposes, so they are not as ephemeral as I thought! But if everyone agrees on ephemeral (or ghost 👻 notes!) that's fine.

Here I call them padding because that's what they are for. Ephemeral notes used for padding. I can see how this particular phrasing might seem like I add a new term, so i'll see how I can fix that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally never liked to call them ephemeral, but this is what we call them in the spec right now, so I'd suggest to stick to ephemeral for now. We def shouldn't call them padding notes: they can be used for padding, but also for much more than just padding

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sometimes referred to as "intents")

Intents being or not being partial transactions is a fight we should not bring up here. If we want to say something about intents, we should define them properly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to the merkle tree.

Not just some merkle tree we have, the commitment tree

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Padding notes can also be used to describe the user intent by attaching an intent VP to it.

And many other ways we didn't discuss probably. We shouldn't limit the purpose of these notes to two use cases. They could be used to pad or to carry intent vps, but they are not padding notes


Taiga transaction is valid if *1)* all contained partial transactions are valid; and *2)* the transaction is balanced: for every note denomination, the sum of values of all input notes of that denomination is equal to the sum of all output notes of the same denomination. A single partial transaction can be a valid transaction if it is valid.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A single partial transaction can be a valid transaction if it is valid

and balanced

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that's a typo 😄


#### ZKP privacy
To achieve shielded properties, Taiga uses zero-knowledge proof system [Halo2](https://zcash.github.io/halo2/) to hide the sensitive information about the state transitions (application types, parties involved, etc). Transactions of different applications are indistinguishable from one another and all applications benefit from the shared shielded pool of transactions.

Taiga uses zero-knowledge proof system Halo2 to hide the sensitive
information about the state transitions (application types, parties
involved, etc).
Transactions of different applications are indistinguishable from one
another and all applications benefit from the shared shielded pool of
transactions.
## Features

#### UTXO model
* Support for arbitrary *atomic* multi-party state transitions
* *Data* and *function privacy*: to a third-party observer, all transactions look the same, no matter what applications are involved
* *Matchmaking* is taken care of: with the help of *intent applications* and *solvers* finding counterparties becomes easy
* In addition to shielded execution, Taiga also implements *transparent* execution. Assets can be moved between the transparent and shielded pool, and applications may support both types of state transitions
* Performance benefits from using PLONK arithmetization (including lookups)

## Taiga Specs

* [Applications](./book/src/app.md)
* [Notes](./book/src/notes.md)
* [Validity predicates](./book/src/validity-predicates.md)
* [The Action circuit](./book/src/action.md)
* [Execution model](./book/src/exec.md)
* [Intent Application](./book/src/intent.md)
* [Examples](./book/src/exec_examples.md)
* [Performance](./book/src/performance.md)

Taiga is based on the UTXO model - the application states are stored in
immutable objects called **notes**.
To update the state, an application (or anyone with sufficient rights)
would "spend" (verifiably invalidate) the notes containing the old state and create notes containing
a new state.
or run the Taiga book:

![img_1.png](./book/src/images/Intro_UTXO.png)
```plaintext
cd book
mdbook serve --open
```

#### Some of the nice Taiga features
## Examples of Taiga Transactions

* Support for arbitrary *atomic* multi-party state transitions
* Data and *function privacy*: to a third-party observer, all transactions
look the same, no matter what applications are involved
* *Matchmaking* is taken care of: with the help of *intent application*
and *solvers* finding counterparties became easy
* Taiga is compatible with transparent Anoma. Assets can be moved between
the transparent and shielded pool, applications can support both types of
state transitions (if they want)
* Performance benefits from using PLONK arithmetization (including
lookups)

### Taiga overview

If you want to learn more about how Taiga works, check out the sections below

- [Applications](./book/src/app.md)
- [Notes](./book/src/notes.md)
- [Validity predicates](./book/src/validity-predicates.md)
- [The Action circuit](./book/src/action.md)
- [Execution model](./book/src/exec.md)
- [Intent Application](./book/src/intent.md)
- [Examples](./book/src/exec_examples.md)
- [Performance](./book/src/performance.md)
### Split the Note

Let's assume we have a note representing 1 ETH, and we want to give 0.7 ETH to a friend. To do so, we would first need to split the note into two smaller notes. Let's start constructing a partial transaction! We have a 1 ETH note, and we want a 0.7 ETH note:

or run the Taiga book:
```plaintext
Inputs: [ 1 ETH ] [ ]
Outputs: [0.7 ETH] [ ]
```
cd book
mdbook serve --open

We would probably want to get the change too:

```plaintext
Inputs: [ 1 ETH ] [ ]
Outputs: [0.7 ETH] [0.3 ETH]
```

This is not a valid partial transaction because it doesn't have two inputs. We can use a padding note (let's mark padding notes using `^` symbol):

```plaintext
Inputs: [ 1 ETH ] [0 PAD^ ]
Outputs: [0.7 ETH] [0.3 ETH]
```

Padding notes may have a non-zero value, but in this case, the value is zero, thus it doesn't contribute to balancing the transaction. Sum of input notes in this partial transaction is 1 ETH; sum of outputs is also 1 ETH. This single partial transaction is balanced, and thus is also a valid full transaction. We, of course, assume, that all VPs associated with the notes involved result in `true`.
Binary file modified book/src/images/Intro_UTXO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified book/src/images/intro_taiga_app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.