# Dev environment configuration

## Instructions for launching a bridge instance for developers:

1. Install Rust and Docker.
2. Install Solana CLI: <https://docs.solanalabs.com/cli/install>
3. Install Anchor: <https://www.anchor-lang.com/docs/installation> and select version `0.30.1`:

```
avm install 0.30.1
avm use 0.30.1
```

4. Generate a new keypair: `solana-keygen new --no-bip39-passphrase -s -o anchor.json`.
5. Install yarn.
6. Run `yarn` at the project root.
7. Run `anchor test` to test BTC relay program.
8. Run `anchor build && cd block_relayer && cargo test` to start E2E tests of all bridge components.

## Block relayer

The Block Relayer uses a TOML configuration format. On startup, it attempts to open a `config.toml` file in its working directory. For detailed configuration options, refer to the [example configuration file](https://github.com/Yona-Labs/btc-lightclient/blob/main/block_relayer/example.toml).

The Block Relayer is a command-line tool with several subcommands:

```
block-relayer [SUBCOMMAND]
```

Available subcommands:

* `init-deposit`: Initialize a BTC deposit to the Relay program's PDA (currently unimplemented)
* `init-program`: Initialize the BTC relay program on the Yona network
* `relay-blocks`: Start relaying Bitcoin blocks to the Yona network
* `relay-transactions`: Start the transaction relaying service

#### Getting Started

1. Clone the repository:

   ```
   git clone https://github.com/your-repo/yona-block-relayer.git
   cd yona-block-relayer
   ```
2. Create a `config.toml` file in the project root directory, using the provided [example](https://github.com/Yona-Labs/btc-lightclient/blob/main/block_relayer/example.toml) as a template.
3. Run the desired command:

   ```
   cargo run -- [SUBCOMMAND]
   ```


---

# 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.yona.network/yona-network/yona-btc-canonical-bridge/dev-environment-configuration.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.
