1# `bitcoin.conf` Configuration File 2 3The configuration file is used by `bitcoind`, `bitcoin-qt` and `bitcoin-cli`. 4 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. 6 7## Configuration File Format 8 9The configuration file is a plain text file and consists of `option=value` entries, one per line. Leading and trailing whitespaces are removed. 10 11In contrast to the command-line usage: 12- an option must be specified without leading `-`; 13- a value of the given option is mandatory; e.g., `testnet=1` (for chain selection options), `noconnect=1` (for negated options). 14 15### Blank lines 16 17Blank lines are allowed and ignored by the parser. 18 19### Comments 20 21A comment starts with a number sign (`#`) and extends to the end of the line. All comments are ignored by the parser. 22 23Comments may appear in two ways: 24- on their own on an otherwise empty line (_preferable_); 25- after an `option=value` entry. 26 27### Network specific options 28 29Network specific options can be: 30- placed into sections with headers `[main]` (not `[mainnet]`), `[test]` (not `[testnet]`) or `[regtest]`; 31- prefixed with a chain name; e.g., `regtest.maxmempool=100`. 32 33Network specific options take precedence over non-network specific options. 34If multiple values for the same option are found with the same precedence, the 35first one is generally chosen. 36 37This means that given the following configuration, `regtest.rpcport` is set to `3000`: 38 39``` 40regtest=1 41rpcport=2000 42regtest.rpcport=3000 43 44[regtest] 45rpcport=4000 46``` 47 48## Configuration File Path 49 50The 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. 51 52The `includeconf=<file>` option in the `bitcoin.conf` file can be used to include additional configuration files. 53 54### Default configuration file locations 55 56Operating System | Data Directory | Example Path 57-- | -- | -- 58Windows | `%APPDATA%\Bitcoin\` | `C:\Users\username\AppData\Roaming\Bitcoin\bitcoin.conf` 59Linux | `$HOME/.bitcoin/` | `/home/username/.bitcoin/bitcoin.conf` 60macOS | `$HOME/Library/Application Support/Bitcoin/` | `/Users/username/Library/Application Support/Bitcoin/bitcoin.conf` 61 62You can find an example bitcoin.conf file in [share/examples/bitcoin.conf](../share/examples/bitcoin.conf). 63