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

# Commands

> Reference for Blnk Watch CLI commands and options.

<Note>Blnk Watch is currently in beta. [Send us a message](mailto:support@blnkfinance.com)</Note>

Blnk Watch exposes a small set of CLI commands for running the service and syncing transactions from Blnk Core.

<Info>
  The `make` targets run the default command shape only.

  If you need to change flags such as `-port`, `-sync-interval`, or `-batch-size`, use the `blnk-watch` binary directly.
</Info>

***

## start

Use `start` to run Watch in continuous mode. It starts the Watch HTTP service and, when `DB_URL` is set, starts the watermark syncer in the same process.

This is the simplest way to run Watch against Blnk Core in one process. New transactions are continuously pulled from Blnk Core on a schedule, written into Watch, and evaluated against your active rules as they flow in.

Use `start` when you want the API and automatic Core ingestion together. If you only need the API (e.g. you send transactions via the inject API), use `watch`. If you only need to sync from Core without the API, use `sync` or `sync-once`.

<Tabs>
  <Tab title="Direct download" icon="download">
    When `blnk-watch` is on your PATH (for example after [direct download](/watch/deployment#standard-deployment) or `make install`):

    ```bash wrap theme={"system"}
    # Default: API on 8081, sync every 10s, batch size 1000
    blnk-watch start
    ```

    | Flag             | Description                                      | Default |
    | ---------------- | ------------------------------------------------ | ------- |
    | `-port`          | Port used by the Watch HTTP service              | `8081`  |
    | `-sync-interval` | How often Watch pulls new transactions from Core | `10s`   |
    | `-batch-size`    | Number of transactions to process per sync batch | `1000`  |
  </Tab>

  <Tab title="Using make" icon="square-terminal">
    Runs the default command only.

    ```bash wrap theme={"system"}
    make start
    ```
  </Tab>

  <Tab title="Using Go binary" icon="square-terminal">
    Use the binary from the project directory with custom flags (port, sync interval, batch size).

    ```bash wrap theme={"system"}
    # Default: API on 8081, sync every 10s, batch size 1000
    ./blnk-watch start

    # Custom port, sync interval, and batch size
    ./blnk-watch -command=start -port=9090 -sync-interval=5s -batch-size=500
    ```

    | Flag             | Description                                      | Default |
    | ---------------- | ------------------------------------------------ | ------- |
    | `-port`          | Port used by the Watch HTTP service              | `8081`  |
    | `-sync-interval` | How often Watch pulls new transactions from Core | `10s`   |
    | `-batch-size`    | Number of transactions to process per sync batch | `1000`  |
  </Tab>
</Tabs>

***

## install

Use `install` to build and install the `blnk-watch` binary in your system.

This is useful when you want to run `blnk-watch` directly from your shell instead of invoking it from the project directory.

<Tabs>
  <Tab title="Using make">
    Builds the binary and installs it into `$(go env GOPATH)/bin`.

    ```bash wrap theme={"system"}
    make install
    ```
  </Tab>

  <Tab title="Using Go binary">
    From the blnk-watch project root, build and install the binary into your Go path:

    ```bash wrap theme={"system"}
    go install ./cmd/blnk-watch
    ```
  </Tab>
</Tabs>

> To make sure you can run `blnk-watch`, add the Go bin directory to your `PATH`. Follow the steps below for your OS:

<Accordion title="Add Go bin to PATH" icon="terminal">
  <Tabs>
    <Tab title="macOS / Linux">
      Add to PATH for the current session:

      ```bash wrap theme={"system"}
      export PATH="$(go env GOPATH)/bin:$PATH"

      # Make it permanent and reload the shell (e.g. `~/.zshrc` or `~/.bashrc`)
      source ~/.zshrc
      ```

      Confirm the binary is available:

      ```bash wrap theme={"system"}
      blnk-watch -command=start
      ```
    </Tab>

    <Tab title="Windows">
      Add to PATH for the current session (PowerShell):

      ```powershell wrap theme={"system"}
      $env:Path += ";$(go env GOPATH)\bin"
      ```

      To make it permanent:

      1. Press **Win + R**, type `sysdm.cpl`, press Enter to open System Properties.
      2. Open the **Advanced** tab → **Environment Variables**.
      3. Under **User variables**, select **Path** → **Edit**.
      4. Click **New**, then add `%USERPROFILE%\go\bin`
      5. Click **OK** on each dialog to save.
      6. Close and reopen your terminal so the updated PATH is loaded.

      Confirm the binary is available:

      ```powershell wrap theme={"system"}
      blnk-watch -command=start
      ```
    </Tab>
  </Tabs>
</Accordion>

***

## watch

Use `watch` to run only the Watch service. This starts the HTTP API used to inject transactions, retrieve evaluation results, and serve the endpoints used during transaction evaluation.

Use `watch` when you only need the HTTP API (e.g. you inject transactions) and do not need to pull from Blnk Core. To run both the API and Core ingestion, use `start` instead.

<Tabs>
  <Tab title="Direct download" icon="download">
    When `blnk-watch` is on your PATH:

    ```bash wrap theme={"system"}
    # Default: API on port 8081
    blnk-watch -command=watch

    # Custom port
    blnk-watch -command=watch -port=9090
    ```

    | Flag    | Description                         | Default |
    | ------- | ----------------------------------- | ------- |
    | `-port` | Port used by the Watch HTTP service | `8081`  |
  </Tab>

  <Tab title="Using make" icon="square-terminal">
    Starts the default service command only. Use the binary if you need custom flags.

    ```bash wrap theme={"system"}
    make watch
    ```
  </Tab>

  <Tab title="Using Go binary" icon="square-terminal">
    Use the binary from the project directory with a custom port or other flags.

    ```bash wrap theme={"system"}
    # Default: API on port 8081
    ./blnk-watch -command=watch

    # Custom port
    ./blnk-watch -command=watch -port=9090
    ```

    | Flag    | Description                         | Default |
    | ------- | ----------------------------------- | ------- |
    | `-port` | Port used by the Watch HTTP service | `8081`  |
  </Tab>
</Tabs>

***

## sync

<Info>
  `sync` requires `DB_URL` so Watch can connect to the Blnk Core database.
</Info>

Use `sync` to run the watermark sync service continuously. This command reads transactions from Blnk Core in batches, stores them in Watch, and keeps moving forward from the current watermark.

In practice, `sync` is useful for backfills, historical evaluation, or when you only need to pull transactions from Core (no HTTP API). On a fresh setup, it can process older transactions from the configured sync start point. After that, it continues syncing new transactions as they appear.

`sync` does not start the Watch HTTP server. To run both the API and sync from Core, use `start` instead.

<Tabs>
  <Tab title="Direct download" icon="download">
    When `blnk-watch` is on your PATH:

    ```bash wrap theme={"system"}
    # Default: sync every 10s, batch size 1000
    blnk-watch -command=sync

    # Custom sync interval and batch size
    blnk-watch -command=sync -sync-interval=5s -batch-size=500
    ```

    | Flag             | Description                                        | Default |
    | ---------------- | -------------------------------------------------- | ------- |
    | `-sync-interval` | How often Watch runs the next watermark sync cycle | `10s`   |
    | `-batch-size`    | Number of transactions to process per sync batch   | `1000`  |
  </Tab>

  <Tab title="Using make" icon="square-terminal">
    Runs the default continuous sync command only. Use the binary to change sync settings.

    ```bash wrap theme={"system"}
    make sync
    ```
  </Tab>

  <Tab title="Using Go binary" icon="square-terminal">
    Use the binary from the project directory with a custom sync interval or batch size.

    ```bash wrap theme={"system"}
    # Default: sync every 10s, batch size 1000
    ./blnk-watch -command=sync

    # Custom sync interval and batch size
    ./blnk-watch -command=sync -sync-interval=5s -batch-size=500
    ```

    | Flag             | Description                                        | Default |
    | ---------------- | -------------------------------------------------- | ------- |
    | `-sync-interval` | How often Watch runs the next watermark sync cycle | `10s`   |
    | `-batch-size`    | Number of transactions to process per sync batch   | `1000`  |
  </Tab>
</Tabs>

***

## sync-once

<Info>
  `sync-once` requires `DB_URL` so Watch can connect to the Blnk Core database.
</Info>

Use `sync-once` to run a single watermark synchronization pass and then exit. It processes available historical transactions from Blnk Core up to the current watermark and stops when that run completes.

This is useful for backfills, one-off reprocessing, CI or maintenance jobs, and scheduled tasks such as cron jobs where you do not want a long-running process.

Unlike `sync`, this command does not keep polling for new transactions.

<Tabs>
  <Tab title="Direct download" icon="download">
    When `blnk-watch` is on your PATH:

    ```bash wrap theme={"system"}
    # Default: batch size 1000
    blnk-watch -command=sync-once

    # Custom batch size
    blnk-watch -command=sync-once -batch-size=2000
    ```

    | Flag          | Description                                                       | Default |
    | ------------- | ----------------------------------------------------------------- | ------- |
    | `-batch-size` | Number of transactions to process in the one-time sync batch loop | `1000`  |
  </Tab>

  <Tab title="Using make" icon="square-terminal">
    Runs the default one-time sync only. Use the binary if you need to change the batch size.

    ```bash wrap theme={"system"}
    make sync-once
    ```
  </Tab>

  <Tab title="Using Go binary" icon="square-terminal">
    Use the binary from the project directory with a custom batch size.

    ```bash wrap theme={"system"}
    # Default: batch size 1000
    ./blnk-watch -command=sync-once

    # Custom batch size
    ./blnk-watch -command=sync-once -batch-size=2000
    ```

    | Flag          | Description                                                       | Default |
    | ------------- | ----------------------------------------------------------------- | ------- |
    | `-batch-size` | Number of transactions to process in the one-time sync batch loop | `1000`  |
  </Tab>
</Tabs>

***

## Need help?

We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool.

To ask questions or discuss issues, please [contact us](mailto:support@blnkfinance.com) or [join our Discord community](https://discord.gg/7WNv94zPpx).

**Connect your ledger to Blnk Cloud**

Sign up and manage your ledger with our back-office dashboard. You can invite teammates to collaborate and manage your ledger operations directly from the dashboard.
