# 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.
