# Run a Glittr Node

This guide is designed for running a Glittr Node locally.

Make sure you have access to Bitcoin RPC, read the following guide on running bitcoin node

{% content-ref url="run-a-bitcoin-node" %}
[run-a-bitcoin-node](https://docs.glittr.fi/node/run-a-bitcoin-node)
{% endcontent-ref %}

### Requirements

Install Rust toolchain (<https://doc.rust-lang.org/cargo/getting-started/installation.html>)

### Installation

1. Clone the repository

```bash
git clone https://github.com/Glittrfi/glittr-core-public
cd glittr-core-public
```

Checkout `testnet` if you want to run on testnet4. Use the `main` branch for local development.

2. Build the project

```bash
cargo build --release --features helper-api
```

The compiled binary will be available at `./target/release/glittr`

### Configuration

Create a `settings.yaml` file in your project directory:

```
btc_rpc_url: http://127.0.0.1:18443
btc_rpc_username: user
btc_rpc_password: password
rocks_db_path: db_data
api_url: 127.0.0.1:3001
```

#### Configuration Options

| Option             | Description                              | Default                  |
| ------------------ | ---------------------------------------- | ------------------------ |
| `btc_rpc_url`      | Bitcoin RPC endpoint URL                 | `http://127.0.0.1:48332` |
| `btc_rpc_username` | Bitcoin RPC authentication username      | -                        |
| `btc_rpc_password` | Bitcoin RPC authentication password      | -                        |
| `rocks_db_path`    | Local storage path for the node database | `db_data`                |
| `api_url`          | Glittr node API listening address        | `127.0.0.1:3001`         |

### Running the Node

Start the Glittr node:

```bash
./target/release/glittr
```

If you can see "Indexing block ..." then you have successfully run the Glittr node.
