Skip to main content

Prerequisites

Before setting up captaind, ensure you have:
1

Bitcoin Core node

Running Bitcoin Core v24.0+ with:
  • txindex=1 enabled
  • RPC access configured
  • Fully synced for your target network (mainnet, testnet, or signet)
2

PostgreSQL database

PostgreSQL v13+ installed and running
  • Create a dedicated database for captaind
  • Note the connection credentials
3

System resources

  • 4GB+ RAM available
  • 50GB+ free disk space (SSD recommended)
  • Stable network connection

Installation

From Pre-built Binaries

Download the latest release from the bark repository:
# Download for your platform
wget https://gitlab.com/ark-bitcoin/bark/-/releases/download/v0.1.0-beta.7/bark-linux-x86_64.tar.gz

# Extract
tar -xzf bark-linux-x86_64.tar.gz

# Move to PATH
sudo mv captaind /usr/local/bin/

Building from Source

Requires Rust 1.74 or later. Install Rust from rustup.rs.
# Clone the repository
git clone https://gitlab.com/ark-bitcoin/bark.git
cd bark

# Build captaind
cargo build --release --bin captaind

# Binary will be at target/release/captaind
sudo cp target/release/captaind /usr/local/bin/

Initial Configuration

1. Create Configuration File

Copy the default configuration template:
# Create config directory
mkdir -p ~/.config/captaind

# Copy default config (from source directory)
cp server/captaind.default.toml ~/.config/captaind/captaind.toml

2. Configure Essential Settings

Edit ~/.config/captaind/captaind.toml with your settings:
captaind.toml
# Data directory for wallet and state
data_dir = "./bark-server"

# Bitcoin network: "mainnet", "testnet", "signet", or "regtest"
network = "signet"

# VTXO lifetime in blocks (default: 30 days)
vtxo_lifetime = 4320

# Round interval (how often to run payment rounds)
round_interval = "10s"

# PostgreSQL connection
[postgres]
host = "localhost"
port = 5432
name = "bark-server-db"
user = "postgres"
password = "your_password_here"
max_connections = 10

# Bitcoin Core RPC connection
[bitcoind]
url = "http://127.0.0.1:38332"  # Signet port

# Option 1: Use cookie file authentication
cookie = "/home/bitcoin/.bitcoin/signet/.cookie"

# Option 2: Use username/password (comment out cookie if using this)
# rpc_user = "bitcoinrpc"
# rpc_pass = "your_password_here"
Authentication Required: You must configure exactly one authentication method for Bitcoin Core - either cookie OR (rpc_user + rpc_pass), not both.

3. Create Database

Create the PostgreSQL database:
CREATE DATABASE "bark-server-db";
Or using psql:
psql -U postgres -c 'CREATE DATABASE "bark-server-db";'

4. Initialize Server

Run the create command to initialize captaind:
captaind -C ~/.config/captaind/captaind.toml create
This will:
  • Generate a new BIP39 mnemonic seed phrase
  • Save the mnemonic to <data_dir>/mnemonic.txt
  • Initialize the database schema
  • Create wallet state
Backup Your Mnemonic: The seed phrase in mnemonic.txt controls all server funds. Back it up securely and never share it.

5. Retrieve Your Mnemonic (if needed)

To view your server’s mnemonic later:
captaind -C ~/.config/captaind/captaind.toml get-mnemonic

Starting the Server

Run in Foreground

For testing or development:
captaind -C ~/.config/captaind/captaind.toml start
The server will:
  • Connect to Bitcoin Core and PostgreSQL
  • Start the RPC server on port 3535 (default)
  • Begin running payment rounds
  • Display logs to stdout

Run as a Service (Production)

Create a systemd service file:
/etc/systemd/system/captaind.service
[Unit]
Description=Bark Ark Server (captaind)
After=network.target postgresql.service bitcoind.service
Requires=postgresql.service
Wants=bitcoind.service

[Service]
Type=simple
User=bark
Group=bark
ExecStart=/usr/local/bin/captaind -C /etc/captaind/captaind.toml start
Restart=on-failure
RestartSec=10

# Security hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=true

[Install]
WantedBy=multi-user.target
Enable and start the service:
# Reload systemd
sudo systemctl daemon-reload

# Enable auto-start on boot
sudo systemctl enable captaind

# Start the service
sudo systemctl start captaind

# Check status
sudo systemctl status captaind

# View logs
journalctl -u captaind -f

Verification

Check Server Status

Use the admin RPC to verify the server is running:
captaind -C ~/.config/captaind/captaind.toml rpc wallet
Expected output:
{
  "rounds": {
    "address": "tb1q...",
    "total_balance": 0,
    "trusted_pending_balance": 0,
    "untrusted_pending_balance": 0,
    "confirmed_balance": 0,
    "confirmed_utxos": 0,
    "unconfirmed_utxos": 0
  }
}

Fund the Server Wallet

Get a receiving address:
captaind -C ~/.config/captaind/captaind.toml rpc wallet | jq -r '.rounds.address'
Send Bitcoin to this address to fund the server’s round wallet. This Bitcoin is used to:
  • Create round funding transactions
  • Pay transaction fees
  • Provide change outputs in rounds

Connect a Client

Test connectivity with a bark client:
# If running bark CLI wallet
bark --server 127.0.0.1:3535 info

Next Steps

Configuration

Customize server settings and fees

Lightning Setup

Configure CLN for Lightning payments

Monitoring

Set up observability and alerts

Rounds Management

Understand and manage payment rounds

Common Issues

”Error loading config file”

  • Verify the config file path is correct
  • Check TOML syntax for errors
  • Ensure all required fields are present

”Failed to connect to bitcoind”

  • Verify Bitcoin Core is running and synced
  • Check the RPC URL and port match your bitcoin.conf
  • Verify authentication credentials (cookie or user/pass)
  • Ensure txindex=1 is enabled in bitcoin.conf

”Failed to connect to db”

  • Verify PostgreSQL is running
  • Check database name, user, and password
  • Ensure the database was created
  • Verify network connectivity to PostgreSQL

”Mnemonic file already exists”

  • Server was already initialized
  • Use start command instead of create
  • To start fresh, delete the data directory (will lose funds!)

Build docs developers (and LLMs) love