# 1. Set Up Fiamma Operator

### **Steps overview:**

1. Clone the repository
2. Set up the environment
3. Configure environment variables

### **Step 1: Clone the Repository**

First, clone the repository to your local machine:

```
git clone https://github.com/fiamma-chain/operator_for_linux.git
cd operator_for_linux
```

### **Step 2: Set up the Environment**

Run the setup script to install all dependencies and prepare your environment:

`./setup.sh`

**Important:** After the first execution of `setup.sh`, you need to enable the Rust environment variables:

```
source "$HOME/.cargo/env"
```

Alternatively, you can restart your terminal or run:

```
source ~/.bashrc
# or if you're using zsh:
source ~/.zshrc
```

This script will:

* Install required packages (build-essential, gcc, g++, libssl-dev)
* Install and configure PostgreSQL
* Install Docker and Docker Compose (if not already installed)
* Install Rust and SQLx CLI
* Create a default .env file from .env\_example
* Set up database and Redis containers
* Grant **execute permissions** for scripts

Next, run database migrations to set up the required database schema:

```
cd dal && cp .env.example .env && sqlx migrate run && cd ..
```

### **Step 3: Configure Environment Variables**

* Prepare three BTC addresses to process transactions:
  * Main address (auth): The address operator deposits funds to
  * Pegin address: The address responsible for processing deposit transactions
  * Pegout address: The address responsible for processing withdraw transactions
* Note: Please use p2tr type addresses

\
Edit the `.env` file:

* vim .env

Enter the three private keys from your addresses:

<pre><code>BITVM_BRIDGE_OPERATOR_AUTH_SK=your_auth_private_key
<strong>BITVM_BRIDGE_OPERATOR_PEGIN_SK=your_pegin_private_key
</strong>BITVM_BRIDGE_OPERATOR_PEGOUT_SK=your_pegout_private_key
</code></pre>

* Note: These private keys are essential for the Operator to function correctly and should not be the same.


---

# 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.fiammalabs.io/our-product-suite/pragmatically-trustless-bitvm-bitcoin-bridge/user-guides/testnet-beta/how-to-run-the-fiamma-operator/operator-for-linux/1.-set-up-fiamma-operator.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.
