Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1# `bitcoin.conf` Configuration File3The configuration file is used by `bitcoind`, `bitcoin-qt` and `bitcoin-cli`.5All command-line options (except for `-?`, `-help`, `-version` and `-conf`) may be specified in a configuration file, and all configuration file options (except for `includeconf`) may also be specified on the command line. Command-line options override values set in the configuration file and configuration file options override values set in the GUI.7Changes to the configuration file while `bitcoind` or `bitcoin-qt` is running only take effect after restarting.9Users should never make any configuration changes which they do not understand. Furthermore, users should always be wary of accepting any configuration changes provided to them by another source (even if they believe that they do understand them).11## Configuration File Precedence13Options specified in the configuration file can be overridden by options in the [`settings.json` file](files.md) and by options specified on the command line.15The `settings.json` file contains dynamic settings that are set by the Bitcoin Core GUI and RPCs at runtime, and augment or replace the static settings specified in the `bitcoin.conf` file.17Command line options also augment or replace `bitcoin.conf` options, and can be useful for scripting and debugging.19It is possible to see which setting values are in use by checking `debug.log` output. Any unrecognized options that are found in `bitcoin.conf` also show up as warnings in `debug.log` output.21## Configuration File Format23The configuration file is a plain text file and consists of `option=value` entries, one per line. Leading and trailing whitespaces are removed.25In contrast to the command-line usage:26- an option must be specified without leading `-`;27- a value of the given option is mandatory; e.g., `testnet=1` (for chain selection options), `noconnect=1` (for negated options).29### Blank lines31Blank lines are allowed and ignored by the parser.33### Comments35A comment starts with a number sign (`#`) and extends to the end of the line. All comments are ignored by the parser.37Comments may appear in two ways:38- on their own on an otherwise empty line (_preferable_);39- after an `option=value` entry.41### Network specific options43Network specific options can be:44- placed into sections with headers `[main]` (not `[mainnet]`), `[test]` (not `[testnet]`, for testnet3), `[testnet4]`, `[signet]` or `[regtest]`;45- prefixed with a chain name; e.g., `regtest.maxmempool=100`.47Network specific options take precedence over non-network specific options.48If multiple values for the same option are found with the same precedence, the49first one is generally chosen.51This means that given the following configuration, `regtest.rpcport` is set to `3000`:53```54regtest=155rpcport=200056regtest.rpcport=300058[regtest]59rpcport=400060```62### Negated options64Almost all options can be negated by being specified with a `no` prefix. For example an option `-foo` could be negated by writing `nofoo=1` or `nofoo=` in the configuration file or `-nofoo=1` or `-nofoo` on the command line.66In general, negating an option is like setting it to `0` if it is a boolean or integer option, and setting it to an empty string or path or list if it is a string or path or list option.68However, there are exceptions to this general rule. For example, it is an error to negate some options (e.g. `-nodatadir` is disallowed), and some negated strings are treated like `"0"` instead of `""` (e.g. `-noproxy` is treated like `-proxy=0`), and some negating lists can have side effects in addition to clearing the lists (e.g. `-noconnect` disables automatic connections in addition to dropping any manual connections specified previously with `-connect=<host>`). When there are exceptions to the rule, they should either be obvious from context, or should be mentioned in usage documentation. Nonobvious, undocumented exceptions should be reported as bugs.70## Configuration File Path72The configuration file is not automatically created; you can create it using your favorite text editor. By default, the configuration file name is `bitcoin.conf` and it is located in the Bitcoin data directory, but both the Bitcoin data directory and the configuration file path may be changed using the `-datadir` and `-conf` command-line options.74The `includeconf=<file>` option in the `bitcoin.conf` file can be used to include additional configuration files.76### Default configuration file locations78Operating System | Data Directory | Example Path79-- | -- | --80Windows | `%LOCALAPPDATA%\Bitcoin\` | `C:\Users\username\AppData\Local\Bitcoin\bitcoin.conf`81Linux | `$HOME/.bitcoin/` | `/home/username/.bitcoin/bitcoin.conf`82macOS | `$HOME/Library/Application Support/Bitcoin/` | `/Users/username/Library/Application Support/Bitcoin/bitcoin.conf`84An example configuration file can be generated by [contrib/devtools/gen-bitcoin-conf.sh](../contrib/devtools/gen-bitcoin-conf.sh).85Run this script after compiling to generate an up-to-date configuration file.86The output is placed under `share/examples/bitcoin.conf`.87To use the generated configuration file, copy the example file into your data directory and edit it there, like so:89```90# example copy command for linux user91cp share/examples/bitcoin.conf ~/.bitcoin92```
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.