github.com/palcoin-project/palcd@v1.0.0/docs/configuration.md (about)

     1  # Configuration
     2  
     3  btcd has a number of [configuration](https://pkg.go.dev/github.com/palcoin-project/palcd)
     4  options, which can be viewed by running: `$ btcd --help`.
     5  
     6  ## Peer server listen interface
     7  
     8  btcd allows you to bind to specific interfaces which enables you to setup
     9  configurations with varying levels of complexity.  The listen parameter can be
    10  specified on the command line as shown below with the -- prefix or in the
    11  configuration file without the -- prefix (as can all long command line options).
    12  The configuration file takes one entry per line.
    13  
    14  **NOTE:** The listen flag can be specified multiple times to listen on multiple
    15  interfaces as a couple of the examples below illustrate.
    16  
    17  Command Line Examples:
    18  
    19  |Flags|Comment|
    20  |----------|------------|
    21  |--listen=|all interfaces on default port which is changed by `--testnet` and `--regtest` (**default**)|
    22  |--listen=0.0.0.0|all IPv4 interfaces on default port which is changed by `--testnet` and `--regtest`|
    23  |--listen=::|all IPv6 interfaces on default port which is changed by `--testnet` and `--regtest`|
    24  |--listen=:8333|all interfaces on port 8333|
    25  |--listen=0.0.0.0:8333|all IPv4 interfaces on port 8333|
    26  |--listen=[::]:8333|all IPv6 interfaces on port 8333|
    27  |--listen=127.0.0.1:8333|only IPv4 localhost on port 8333|
    28  |--listen=[::1]:8333|only IPv6 localhost on port 8333|
    29  |--listen=:8336|all interfaces on non-standard port 8336|
    30  |--listen=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336|
    31  |--listen=[::]:8336|all IPv6 interfaces on non-standard port 8336|
    32  |--listen=127.0.0.1:8337 --listen=[::1]:8333|IPv4 localhost on port 8337 and IPv6 localhost on port 8333|
    33  |--listen=:8333 --listen=:8337|all interfaces on ports 8333 and 8337|
    34  
    35  The following config file would configure btcd to only listen on localhost for both IPv4 and IPv6:
    36  
    37  ```text
    38  [Application Options]
    39  
    40  listen=127.0.0.1:8333
    41  listen=[::1]:8333
    42  ```
    43  
    44  In addition, if you are starting btcd with TLS and want to make it
    45  available via a hostname, then you will need to generate the TLS
    46  certificates for that host. For example,
    47  
    48  ```
    49  gencerts --host=myhostname.example.com --directory=/home/me/.palcd/
    50  ```
    51  
    52  ## RPC server listen interface
    53  
    54  btcd allows you to bind the RPC server to specific interfaces which enables you
    55  to setup configurations with varying levels of complexity.  The `rpclisten`
    56  parameter can be specified on the command line as shown below with the -- prefix
    57  or in the configuration file without the -- prefix (as can all long command line
    58  options).  The configuration file takes one entry per line.
    59  
    60  A few things to note regarding the RPC server:
    61  
    62  * The RPC server will **not** be enabled unless the `rpcuser` and `rpcpass`
    63    options are specified.
    64  * When the `rpcuser` and `rpcpass` and/or `rpclimituser` and `rpclimitpass`
    65    options are specified, the RPC server will only listen on localhost IPv4 and
    66    IPv6 interfaces by default.  You will need to override the RPC listen
    67    interfaces to include external interfaces if you want to connect from a remote
    68    machine.
    69  * The RPC server has TLS enabled by default, even for localhost.  You may use
    70    the `--notls` option to disable it, but only when all listeners are on
    71    localhost interfaces.
    72  * The `--rpclisten` flag can be specified multiple times to listen on multiple
    73    interfaces as a couple of the examples below illustrate.
    74  * The RPC server is disabled by default when using the `--regtest` and
    75    `--simnet` networks.  You can override this by specifying listen interfaces.
    76  
    77  Command Line Examples:
    78  
    79  |Flags|Comment|
    80  |----------|------------|
    81  |--rpclisten=|all interfaces on default port which is changed by `--testnet`|
    82  |--rpclisten=0.0.0.0|all IPv4 interfaces on default port which is changed by `--testnet`|
    83  |--rpclisten=::|all IPv6 interfaces on default port which is changed by `--testnet`|
    84  |--rpclisten=:8334|all interfaces on port 8334|
    85  |--rpclisten=0.0.0.0:8334|all IPv4 interfaces on port 8334|
    86  |--rpclisten=[::]:8334|all IPv6 interfaces on port 8334|
    87  |--rpclisten=127.0.0.1:8334|only IPv4 localhost on port 8334|
    88  |--rpclisten=[::1]:8334|only IPv6 localhost on port 8334|
    89  |--rpclisten=:8336|all interfaces on non-standard port 8336|
    90  |--rpclisten=0.0.0.0:8336|all IPv4 interfaces on non-standard port 8336|
    91  |--rpclisten=[::]:8336|all IPv6 interfaces on non-standard port 8336|
    92  |--rpclisten=127.0.0.1:8337 --listen=[::1]:8334|IPv4 localhost on port 8337 and IPv6 localhost on port 8334|
    93  |--rpclisten=:8334 --listen=:8337|all interfaces on ports 8334 and 8337|
    94  
    95  The following config file would configure the btcd RPC server to listen to all interfaces on the default port, including external interfaces, for both IPv4 and IPv6:
    96  
    97  ```text
    98  [Application Options]
    99  
   100  rpclisten=
   101  ```
   102  
   103  ## Default ports
   104  
   105  While btcd is highly configurable when it comes to the network configuration,
   106  the following is intended to be a quick reference for the default ports used so
   107  port forwarding can be configured as required.
   108  
   109  btcd provides a `--upnp` flag which can be used to automatically map the bitcoin
   110  peer-to-peer listening port if your router supports UPnP.  If your router does
   111  not support UPnP, or you don't wish to use it, please note that only the bitcoin
   112  peer-to-peer port should be forwarded unless you specifically want to allow RPC
   113  access to your btcd from external sources such as in more advanced network
   114  configurations.
   115  
   116  |Name|Port|
   117  |----|----|
   118  |Default Bitcoin peer-to-peer port|TCP 8333|
   119  |Default RPC port|TCP 8334|
   120  
   121  ## Using bootstrap.dat
   122  
   123  ### What is bootstrap.dat?
   124  
   125  It is a flat, binary file containing bitcoin blockchain data starting from the
   126  genesis block and continuing through a relatively recent block height depending
   127  on the last time it was updated.
   128  
   129  
   130  **NOTE:** Using bootstrap.dat is entirely optional.  Btcd will download the
   131  block chain from other peers through the Bitcoin protocol with no extra
   132  configuration needed.
   133  
   134  ### What are the pros and cons of using bootstrap.dat?
   135  
   136  Pros:
   137  
   138  * Typically accelerates the initial process of bringing up a new node as it
   139    downloads from public P2P nodes and generally is able to achieve faster
   140    download speeds
   141  * It is particularly beneficial when bringing up multiple nodes as you only need
   142    to download the data once
   143  
   144  Cons:
   145  
   146  * Requires you to setup and configure a torrent client if you don't already have
   147    one available
   148  * Requires roughly twice as much disk space since you'll need the flat file as
   149    well as the imported database
   150  
   151  ### Where do I get bootstrap.dat?
   152  
   153  The bootstrap.dat file is made available via a torrent.  See
   154  [this](https://bitcointalk.org/index.php?topic=145386.0) thread on bitcointalk
   155  for the torrent download details.
   156  
   157  ### How do I know I can trust the bootstrap.dat I downloaded?
   158  
   159  You don't need to trust the file as the `addblock` utility verifies every block
   160  using the same rules that are used when downloading the block chain normally
   161  through the Bitcoin protocol.  Additionally, the chain rules contain hard-coded
   162  checkpoints for the known-good block chain at periodic intervals.  This ensures
   163  that not only is it a valid chain, but it is the same chain that everyone else
   164  is using.
   165  
   166  ### How do I use bootstrap.dat with btcd?
   167  
   168  btcd comes with a separate utility named `addblock` which can be used to import
   169  `bootstrap.dat`.  This approach is used since the import is a one-time operation
   170  and we prefer to keep the daemon itself as lightweight as possible.
   171  
   172  1. Stop btcd if it is already running.  This is required since addblock needs to
   173     access the database used by btcd and it will be locked if btcd is using it.
   174  2. Note the path to the downloaded bootstrap.dat file.
   175  3. Run the addblock utility with the `-i` argument pointing to the location of
   176     boostrap.dat:
   177  
   178  **Windows:**
   179  
   180  ```bat
   181  "%PROGRAMFILES%\Palcd Suite\Palcd\addblock" -i C:\Path\To\bootstrap.dat
   182  ```
   183  
   184  **Linux/Unix/BSD/POSIX:**
   185  
   186  ```bash
   187  $GOPATH/bin/addblock -i /path/to/bootstrap.dat
   188  ```