> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zecolabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# BarettaVM

> A deterministic virtual machine for smart contracts and secure local execution.

Baretta is a deterministic, bytecode-based virtual machine. It is designed for blockchain smart contracts and for secure local execution.

* **Deterministic:** the same code with the same input always gives the same result.
* **Ahead-of-time (AOT) compilation:** Baretta can compile code to native code before it runs, and it saves the compiled code in a persistent cache.
* **Controlled execution:** the Baretta runtime and its defined execution rules always govern how code runs.

You can use BarettaVM on the blockchain or locally on your own computer.

## How it works

**1. Write Python code**

Write your smart contract in Python, following the [Baretta Rules](https://docs.zecolabs.com/baretta/rules.md).

**2. Compile to Python bytecode**

Your code is compiled to Python bytecode instructions.

**3. Translate to the Baretta ISA**

The instructions are translated to the Baretta instruction set (ISA). This ISA is static.

**4. Compile with the Baretta AOT compiler**

The Baretta AOT compiler turns the static ISA instructions into an executable object.

**5. Run with the Baretta runtime**

The Baretta runtime runs the executable object.

## Why Python?

Python is easy to read and easy to learn. Even beginners can pick it up quickly, so more people can write smart contracts without learning a new language first.

## What is different from normal Python?

The main difference is the coding style. You may need a little time to adjust. These pages explain the changes:

* [Data types](https://docs.zecolabs.com/baretta/types.md): Baretta supports a limited set of types.
* [Baretta Rules](https://docs.zecolabs.com/baretta/rules.md): types must be declared, and pointers are available.
* [Lists and dicts](https://docs.zecolabs.com/baretta/collections.md): collections hold one type of value.
* [Lookup](https://docs.zecolabs.com/baretta/lookup.md): how errors are handled.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.