Skip to content

Configuration Settings

Eric Voskuil edited this page Feb 7, 2015 · 30 revisions

Command Line

Libbitcoin Server uses source code generation and Boost's program_options library to bind command line parameters to strongly-typed command class properties.

Configuration Settings

Libbitcoin Server uses Boost's program_options library to bind configuration settings to strongly-typed application level properties.

The implementation supports a two level hierarchy of settings using "sections" to group settings, similar to an .ini file:

# Libbitcoin Server configuration file.

[general]
# The blockchain directory, defaults to 'blockchain'.
blockchain_path = blockchain
# The minimum height of the history database, defaults to 0.
history_height = 0
# The peer cache file path, defaults to 'hosts'.
hosts_file = hosts
# Enable the listening for incoming connections, defaults to true.
listener_enabled = true
# The maximum number of outgoing P2P network connections, defaults to 8.
out_connections = 8
# Enable the publisher, defaults to false.
publisher_enabled = false
# The maximum number of transactions in the pool, defaults to 2000.
tx_pool_capacity = 2000

[logging]
# The error log file path, defaults to 'error.log'.
error_file = error.log
# The debug log file path, defaults to 'debug.log'.
debug_file = debug.log
# Write service requests to the log, impacts performance, defaults to false.
log_requests = false

[endpoints]
# The query service endpoint, defaults to 'tcp://*:9091'.
service = tcp://*:9091
# The heartbeat endpoint, defaults to 'tcp://*:9092'.
heartbeat = tcp://*:9092
# The block publishing service endpoint, defaults to 'tcp://*:9093'.
block_publish = tcp://*:9093
# The transaction publishing service endpoint, defaults to 'tcp://*:9094'.
tx_publish = tcp://*:9094

[identity]
# The path to the server's certificate, not used by default.
#certificate_file = 
# The client certificates directory, allows anonymous clients if not set.
#client_certs_path = 
# Allowed client IP address, all clients allowed if none set, multiple entries allowed.
#client = 127.0.0.1
#client = 
# Node to augment peer discovery, formatted as host:port, multiple entries allowed.
#peer = obelisk.airbitz.co:8333
#peer = 
# The server name, must be unique if specified.
#unique_name = 

The path to the configuration settings file is specified by the --config command line option, the BX_CONFIG environment variable, or by default as follows:

  • Linux/OSX (prefix): <prefix>/etc/libbitcoin/bx.cfg
  • Linux/OSX (default): /usr/local/etc/libbitcoin/bx.cfg
  • Windows: %ProgramData%\libbitcoin\bx.cfg

The Windows directory is hidden by default. If the file is not found default values are loaded. If the file is contains invalid settings an error is returned via STDERR. If any setting is not specified its default is loaded.

The BX settings command shows the current value of all configuration settings.

Environment Variables

BX uses Boost's program_options library to bind environment variables. All BX environment variables are prefixed with BX_. Currently environment variables are bound explicitly (i.e. bindings are not generated from metadata).

BX_CONFIG is the only bound environment variable. BX uses a Boost feature to tie the environment variable and the command line option of the same identity (i.e. --config). Command line options have precedence if both set.

Clone this wiki locally