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

# Set up an Ark server manually

This guide walks through installing each dependency, building or downloading `captaind`, and launching an Ark server on **signet**.

<Note>
  This path runs on **signet**, Bitcoin's public test network. If you'd prefer a fully containerized local setup on regtest, see the [Docker Compose guide](/ark-server/docker-compose) instead.
</Note>

## Install dependencies

### PostgreSQL

<Tabs>
  <Tab title="Docker (recommended)">
    Run PostgreSQL in a Docker container:

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    docker run \
      --name my_postgres \
      -e POSTGRES_USER=postgres \
      -e POSTGRES_PASSWORD=postgres \
      -e POSTGRES_DB=bark-server-db \
      -p 5432:5432 \
      -d postgres
    ```
  </Tab>

  <Tab title="Package managers">
    <Tabs>
      <Tab title="macOS">
        ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
        brew install postgresql
        brew services start postgresql
        ```
      </Tab>

      <Tab title="Debian/Ubuntu">
        ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
        sudo apt update
        sudo apt install postgresql
        sudo systemctl start postgresql
        ```
      </Tab>

      <Tab title="Fedora/CentOS/RHEL">
        ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
        sudo dnf install postgresql-server
        sudo postgresql-setup --initdb
        sudo systemctl start postgresql
        ```
      </Tab>
    </Tabs>
  </Tab>

  <Tab title="Manual installation">
    Download PostgreSQL from the [official download page](https://www.postgresql.org/download/) and follow the platform-specific instructions.
  </Tab>
</Tabs>

Verify PostgreSQL is running:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
psql -h localhost -U postgres -c "SELECT version();"
```

### Bitcoin Core

Bitcoin Core v30.0+ is strongly recommended. Download from the [official download page](https://bitcoincore.org/en/download) and follow the installation instructions for your operating system.

For Linux, unpack the archive and add `bitcoind` and `bitcoin-cli` to your path.

Verify the installation:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bitcoind --version
```

### Optional dependencies

<Accordion title="Just and jq">
  **Just** is a command runner that simplifies running common tasks.

  <Tabs>
    <Tab title="macOS">
      ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
      brew install just
      ```
    </Tab>

    <Tab title="Debian/Ubuntu/Fedora">
      ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
      cargo install --locked just
      ```
    </Tab>
  </Tabs>

  Verify:

  ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  just --version
  ```

  **jq** is a command-line tool for processing JSON data.

  <Tabs>
    <Tab title="Package managers">
      <Tabs>
        <Tab title="macOS">
          ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
          brew install jq
          ```
        </Tab>

        <Tab title="Debian/Ubuntu">
          ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
          sudo apt update
          sudo apt install jq
          ```
        </Tab>

        <Tab title="Fedora/CentOS/RHEL">
          ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
          sudo dnf install jq
          ```
        </Tab>
      </Tabs>
    </Tab>

    <Tab title="Manual installation">
      Download the binaries from the [GitHub releases page](https://github.com/jqlang/jq/releases).
    </Tab>
  </Tabs>

  Verify:

  ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
  jq --version
  ```
</Accordion>

## Install captaind

<Note>
  Currently, only Unix-based systems (Linux, macOS) are supported.
</Note>

<Tabs>
  <Tab title="Download binary">
    Download the latest `captaind` binary from the [releases page](https://gitlab.com/ark-bitcoin/bark/-/releases).

    Verify the installation:

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    captaind --version
    ```
  </Tab>

  <Tab title="Compile from source">
    <Steps>
      <Step title="Clone the repository">
        ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
        git clone https://gitlab.com/ark-bitcoin/bark
        cd bark
        ```
      </Step>

      <Step title="Install build dependencies">
        You will need a Rust compiler. Find installation instructions on the [rustup website](https://rustup.rs).

        On Ubuntu/Debian, install the additional build dependencies:

        ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
        sudo apt update
        sudo apt install build-essential clang cmake pkg-config protobuf-compiler libpq-dev libsodium-dev libsqlite3-dev libssl-dev
        ```
      </Step>

      <Step title="Build and install">
        Build and install to your path:

        ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
        cargo install --locked --path ./server
        ```

        Or build without installing:

        ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
        cargo build --bin captaind
        ```
      </Step>

      <Step title="Verify the installation">
        ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
        captaind --version
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Configure and launch

<Steps>
  <Step title="Start your signet node">
    Launch a signet Bitcoin node:

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    bitcoind --signet --daemon
    ```

    If your `bitcoin.conf` file is empty, this will launch a signet node. By default the node will:

    * Create a cookie in `~/.bitcoin/signet/.cookie`
    * Listen for RPC connections on port `38332`

    Verify the node is running:

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    bitcoin-cli -signet \
    	-rpcconnect=localhost \
    	-rpcport=38332 \
    	-rpccookiefile=$HOME/.bitcoin/signet/.cookie \
    	getblockcount
    ```
  </Step>

  <Step title="Start PostgreSQL">
    Make sure PostgreSQL is running as described in the [Install dependencies](#postgresql) section above.
  </Step>

  <Step title="Create a config file">
    Create a `config.toml` file that specifies the configuration of your Ark server:

    ```toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
    data_dir = "./bark-server"
    network = "signet"

    [rpc]
    public_address = "127.0.0.1:3535"
    admin_address = "127.0.0.1:3536"

    [postgres]
    host = "localhost"
    port = 5432
    name = "bark-server-db"
    user = "postgres"
    password = "postgres"

    [bitcoind]
    url = "http://127.0.0.1:38332"
    cookie = "/home/<username>/.bitcoin/signet/.cookie"
    ```
  </Step>

  <Step title="Run the Ark server">
    Once you've got the dependencies running and set up your configuration, launch the server:

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
    captaind create --config <path-to-your-toml-file>
    captaind start --config <path-to-your-toml-file>
    ```
  </Step>
</Steps>

## Fund the server

Retrieve the server's funding address:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
captaind rpc wallet | jq -r '.rounds.address'
```

Send signet coins to this address using the [Second faucet](https://signet.2nd.dev). Once the transaction confirms, verify the funds arrived:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bitcoin-cli -signet getreceivedbyaddress <address>
```
