Configuration File
captaind uses TOML format for configuration. The default config file is located at:
./bark-server/captaind.toml (relative to working directory)
Or specify with -C flag: captaind -C /path/to/config.toml
View the complete default configuration: captaind.default.toml
Environment Variables
Configuration can be overridden using environment variables with the prefix BARK_SERVER__:
# Override network setting
export BARK_SERVER__NETWORK = signet
# Override database password
export BARK_SERVER__POSTGRES__PASSWORD = newpassword
# Override Bitcoin RPC URL
export BARK_SERVER__BITCOIND__URL = http :// 127 . 0 . 0 . 1 : 38332
Use double underscores (__) to separate nested configuration sections.
Core Settings
Data Directory
# Directory for wallet state and mnemonic
data_dir = "./bark-server"
Stores:
mnemonic.txt: Server seed phrase (backup this!)
Wallet state and changesets
Network
# Bitcoin network to operate on
network = "signet" # "mainnet" | "testnet" | "signet" | "regtest"
Must match your Bitcoin Core network configuration.
VTXO Parameters
# VTXO lifetime in blocks (default: 4320 ≈ 30 days)
vtxo_lifetime = 4320
# Blocks between each VTXO exit clause (default: 144 ≈ 1 day)
vtxo_exit_delta = 144
# Maximum VTXO amount (optional)
# max_vtxo_amount = "1000000 sat"
# Minimum board (onchain onboarding) amount
min_board_amount = "20000 sat"
# Maximum arkoor (off-chain transfer) depth
max_arkoor_depth = 5
# Maximum arkoor outputs per input
max_arkoor_fanout = 4
VTXO Lifetime : Longer lifetimes reduce refresh frequency but increase channel capital requirements. 30 days (4320 blocks) is a good balance.
Confirmation Requirements
# Board transaction confirmations before accepting VTXO
required_board_confirmations = 3
# Confirmations for untrusted round inputs
round_tx_untrusted_input_confirmations = 2
Round Configuration
Timing
# Time between rounds
round_interval = "10s"
# Time for users to submit payments
round_submit_time = "2s"
# Time for users to sign VTXO tree
round_sign_time = "2s"
Short Intervals : Very short round intervals (< 5s) may cause issues with slower clients. Adjust based on your user base.
Round Nonces
# Number of cosign nonces required per user
# Limits maximum VTXO tree size: max_vtxos = 4^nb_round_nonces
nb_round_nonces = 8 # = 4^8 = 65,536 max VTXOs per round
Forfeit Management
# Timeout for forfeit nonce storage
round_forfeit_nonces_timeout = "30s"
RPC Configuration
[ rpc ]
# Public Ark API (required)
public_address = "127.0.0.1:3535"
# Admin API (optional but recommended)
admin_address = "127.0.0.1:3536"
# Integration manager API (optional)
integration_address = "127.0.0.1:3537"
RPC Error Handling
# Include full stack traces in RPC errors (disable in production)
rpc_rich_errors = true
PostgreSQL Configuration
[ postgres ]
host = "localhost"
port = 5432
name = "bark-server-db"
user = "postgres"
password = "super_secure"
max_connections = 10
Connection Pooling : max_connections controls the connection pool size. Increase for high-traffic servers.
Bitcoin Core Configuration
[ bitcoind ]
url = "http://127.0.0.1:18443" # RPC endpoint
# Authentication: Use ONE of the following methods
# Option 1: Cookie file
cookie = "/home/bitcoin/.bitcoin/.cookie"
# Option 2: Username/password
# rpc_user = "admin"
# rpc_pass = "super_secure"
Port Reference (default Bitcoin Core ports):
Network RPC Port Mainnet 8332 Testnet 18332 Signet 38332 Regtest 18443
Lightning Configuration
Configure one or more Core Lightning (CLN) nodes:
# CLN node reconnection interval
cln_reconnect_interval = "10s"
# Invoice checking intervals
invoice_check_interval = "3s"
invoice_recheck_delay = "2s"
invoice_check_base_delay = "10s"
max_invoice_check_delay = "10m"
invoice_poll_interval = "30s"
# TrackAll stream reconnection backoff
track_all_base_delay = "1s"
max_track_all_delay = "60s"
# HTLC timing
htlc_expiry_delta = 40 # blocks between LN and Ark HTLC expiries
htlc_send_expiry_delta = 258 # blocks for HTLC-send VTXO expiry
max_user_invoice_cltv_delta = 250
# Invoice expiry
invoice_expiry = "48h"
# Timeout for user to claim received payments
receive_htlc_forward_timeout = "30s"
# Require proof for lightning receives (anti-DoS)
ln_receive_anti_dos_required = false
CLN Node Configuration
Add one or more CLN nodes:
[[ cln_array ]]
uri = "http://127.0.0.1:8000"
priority = 10 # Lower number = higher priority
server_cert_path = "/etc/cln/server.cert"
client_cert_path = "/etc/cln/client.cert"
client_key_path = "/etc/cln/client.key"
# Optional: Hold invoice plugin configuration
[ cln_array . hold_invoice ]
uri = "http://127.0.0.1:8001"
server_cert_path = "/etc/cln/hold/server.cert"
client_cert_path = "/etc/cln/hold/client.cert"
client_key_path = "/etc/cln/hold/client.key"
# Add more nodes as needed
[[ cln_array ]]
uri = "http://127.0.0.1:9000"
priority = 20
# ... (same cert configuration)
Fee Configuration
Define fee schedules for different operations:
Board Fees (Onboarding)
[ fees . board ]
min_fee_sat = 330 # Minimum fee (can be dust)
base_fee_sat = 100 # Base fee
ppm = 1000 # Parts per million (0.1%)
Offboard Fees (On-chain Exit)
[ fees . offboard ]
base_fee_sat = 200
fixed_additional_vb = 212 # Virtual bytes to charge (covers tx size)
# Expiry-based PPM tiers
ppm_expiry_table = [
{ expiry_blocks_threshold = 0 , ppm = 0 }, # ≤96 blocks: 0%
{ expiry_blocks_threshold = 97 , ppm = 1000 }, # 97-198: 0.1%
{ expiry_blocks_threshold = 199 , ppm = 4000 }, # 199-2160: 0.4%
{ expiry_blocks_threshold = 2161 , ppm = 8000 }, # >2160: 0.8%
]
Refresh Fees (VTXO Refresh)
[ fees . refresh ]
base_fee_sat = 150
ppm_expiry_table = [
{ expiry_blocks_threshold = 0 , ppm = 0 },
{ expiry_blocks_threshold = 97 , ppm = 1000 },
{ expiry_blocks_threshold = 199 , ppm = 4000 },
{ expiry_blocks_threshold = 2161 , ppm = 8000 },
]
Lightning Fees
# Lightning receive fees
[ fees . lightning_receive ]
base_fee_sat = 100
ppm = 2000 # 0.2%
# Lightning send fees
[ fees . lightning_send ]
min_fee_sat = 10
base_fee_sat = 75
ppm_expiry_table = [
{ expiry_blocks_threshold = 0 , ppm = 0 },
{ expiry_blocks_threshold = 97 , ppm = 1000 },
{ expiry_blocks_threshold = 199 , ppm = 4000 },
{ expiry_blocks_threshold = 2161 , ppm = 8000 },
]
Fee Formula : fee = base_fee + (amount * ppm / 1_000_000)Example: For a 100,000 sat refresh with base_fee=150 and ppm=1000:
fee = 150 + (100000 * 1000 / 1000000) = 150 + 100 = 250 sats
Offboard Configuration
# Feerate for offboard transactions
offboard_feerate = "7sat/vb"
# Offboard session timeout
offboard_session_timeout = "30s"
VTXO Pool Configuration
[ vtxopool ]
# Target VTXO denominations and counts
vtxo_targets = [
"1000sat:10" , # Maintain 10 VTXOs of 1000 sats
"10000sat:10" # Maintain 10 VTXOs of 10000 sats
]
# Issue new VTXOs when pool falls below this % of target
vtxo_target_issue_threshold = 80
# Pool VTXO lifetime in blocks
vtxo_lifetime = 432
# Don't use VTXOs this close to expiry
vtxo_pre_expiry = 144
# Maximum depth for pool VTXOs
max_vtxo_arkoor_depth = 3
# How often to check if issuance is needed
issue_interval = "1m"
Watchman Configuration
[ watchman ]
enabled = true # Enable forfeit watcher
process_interval = "60s" # How often to check for forfeits
progress_grace_period = 2 # Blocks before deadline to progress
claim_chunksize = 20 # Max VTXOs to claim per transaction
incremental_relay_fee = "100 sat/kvb"
min_cpfp_amount = "10000 sat" # Minimum for CPFP fee bumping
Watchman Wallet Funding
# Minimum balance for watchman wallet
watchman_min_balance = "1 btc"
The server automatically rebalances when watchman balance is low.
Fee Estimator
[ fee_estimator ]
update_interval = "1m" # Poll bitcoind for fee estimates
# Fallback rates when estimator unavailable
fallback_fee_rate_fast = "25sat/vb" # 1 block target
fallback_fee_rate_regular = "10sat/vb" # 3 block target
fallback_fee_rate_slow = "4sat/vb" # 6 block target
System Configuration
Indexing and Sync
# TX index check interval
txindex_check_interval = "30s"
# Block polling interval
sync_manager_block_poll_interval = "100ms"
# Transaction rebroadcast interval
transaction_rebroadcast_interval = "1m"
Mailbox
# Maximum items returned per mailbox query
max_read_mailbox_items = 100
Public Service Announcement
# Optional message sent to clients on handshake
# handshake_psa = "Welcome to our Ark Server!"
Telemetry & Monitoring
# OpenTelemetry collector endpoint (optional)
# otel_collector_endpoint = "http://127.0.0.1:4000"
# Tracing sample rate: 0.0-1.0 (0=disabled, 1=all traces)
# otel_tracing_sampler = "0.5"
# Deployment name for metrics
otel_deployment_name = "my_regtest"
See Monitoring for details on setting up observability.
Validation
Validate your configuration:
captaind -C /path/to/config.toml start
If configuration is invalid, captaind will exit with a detailed error message.
Configuration Best Practices
Use environment variables for secrets
Store sensitive values like passwords in environment variables or secret management systems: export BARK_SERVER__POSTGRES__PASSWORD = $( cat /run/secrets/db_password )
export BARK_SERVER__BITCOIND__RPC_PASS = $( cat /run/secrets/rpc_password )
Tune round intervals for your use case
High frequency (5-10s): Better UX, higher resource usage
Low frequency (30-60s): Lower resource usage, slower UX
Consider your hardware and expected transaction volume
Set appropriate VTXO lifetimes
Shorter (7-14 days): Less capital locked, more frequent refreshes
Longer (30-60 days): Less refresh overhead, more capital locked
Balance based on your liquidity and user patterns
Configure fees competitively