# Smart Contracts

Mainnet app id is: **2714516089**

The contracts are written using AlgoKit and TEALScript.

The source for Reti, its contracts, node daemon and UI is currently at <https://github.com/algorandfoundation/reti>

Audits for the contracts can be found alongside the contracts, here:\
<https://github.com/algorandfoundation/reti/tree/main/contracts/contracts/audit>

Information on Tealscript can be found [here](https://tealscript.netlify.app/).

See the README in the contracts/ directory for build / testing details.

Some diagrams of the workings are provided here as some may find them useful but the contracts themselves are the best source for complete details. Not every operation is shown in the sequence diagrams as they would be far too verbose.

A video discussing some of the details of the contracts presented at Decipher 20024 can be viewed here:

{% embed url="<https://www.youtube.com/watch?v=l5TFlphojnQ>" %}
The Water's Fine: Reti P2P Staking Pools | Decipher 2024 Day 2
{% endembed %}

## General Overview

<figure><img src="https://1403166646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fo7lSMUOwxe088C6rBm9T%2Fuploads%2Fgit-blob-73f107c9d68d5f76c3ba1e1cee19297c59f830b4%2FReti%20Validator%20Pools%20-%20Page%201.png?alt=media" alt=""><figcaption><p>General Overview</p></figcaption></figure>

## Basic Operations

<figure><img src="https://1403166646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fo7lSMUOwxe088C6rBm9T%2Fuploads%2Fgit-blob-729345591727f019e1b42381073d66a0480b8d1d%2FReti%20Validator%20Pools%20-%20Page%202.png?alt=media" alt=""><figcaption><p>Basic Operations</p></figcaption></figure>

***

## **State and Box Storage**

<figure><img src="https://1403166646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fo7lSMUOwxe088C6rBm9T%2Fuploads%2Fgit-blob-79ce74b72838a380f9a6fbafcce6d24634909954%2FretiStorage.png?alt=media" alt=""><figcaption></figcaption></figure>

## **Validator Operations**

<figure><img src="https://1403166646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fo7lSMUOwxe088C6rBm9T%2Fuploads%2Fgit-blob-0a1455dc498bebdc4988c0bf1ea82be96eb58ad2%2Fvalidator.png?alt=media" alt=""><figcaption></figcaption></figure>

## **Staking Operations**

<figure><img src="https://1403166646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fo7lSMUOwxe088C6rBm9T%2Fuploads%2Fgit-blob-ba025a5e131d9f77eb465728c3192b95129f400a%2Fstaker.png?alt=media" alt=""><figcaption></figcaption></figure>
