github.com/badrootd/celestia-core@v0.0.0-20240305091328-aa4207a4b25d/docs/core/configuration.md (about)

     1  ---
     2  order: 3
     3  ---
     4  
     5  # Configuration
     6  
     7  CometBFT can be configured via a TOML file in
     8  `$CMTHOME/config/config.toml`. Some of these parameters can be overridden by
     9  command-line flags. For most users, the options in the `##### main base configuration options #####` are intended to be modified while config options
    10  further below are intended for advance power users.
    11  
    12  ## Options
    13  
    14  The default configuration file create by `cometbft init` has all
    15  the parameters set with their default values. It will look something
    16  like the file below, however, double check by inspecting the
    17  `config.toml` created with your version of `cometbft` installed:
    18  
    19  ```toml
    20  
    21  # This is a TOML config file.
    22  # For more information, see https://github.com/toml-lang/toml
    23  
    24  # NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or
    25  # relative to the home directory (e.g. "data"). The home directory is
    26  # "$HOME/.cometbft" by default, but could be changed via $CMTHOME env variable
    27  # or --home cmd flag.
    28  
    29  #######################################################################
    30  ###                   Main Base Config Options                      ###
    31  #######################################################################
    32  
    33  # TCP or UNIX socket address of the ABCI application,
    34  # or the name of an ABCI application compiled in with the CometBFT binary
    35  proxy_app = "tcp://127.0.0.1:26658"
    36  
    37  # A custom human readable name for this node
    38  moniker = "anonymous"
    39  
    40  # If this node is many blocks behind the tip of the chain, FastSync
    41  # allows them to catchup quickly by downloading blocks in parallel
    42  # and verifying their commits
    43  fast_sync = true
    44  
    45  # Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb
    46  # * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
    47  #   - pure go
    48  #   - stable
    49  # * cleveldb (uses levigo wrapper)
    50  #   - fast
    51  #   - requires gcc
    52  #   - use cleveldb build tag (go build -tags cleveldb)
    53  # * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt)
    54  #   - EXPERIMENTAL
    55  #   - may be faster is some use-cases (random reads - indexer)
    56  #   - use boltdb build tag (go build -tags boltdb)
    57  # * rocksdb (uses github.com/tecbot/gorocksdb)
    58  #   - EXPERIMENTAL
    59  #   - requires gcc
    60  #   - use rocksdb build tag (go build -tags rocksdb)
    61  # * badgerdb (uses github.com/dgraph-io/badger)
    62  #   - EXPERIMENTAL
    63  #   - use badgerdb build tag (go build -tags badgerdb)
    64  db_backend = "goleveldb"
    65  
    66  # Database directory
    67  db_dir = "data"
    68  
    69  # Output level for logging, including package level options
    70  log_level = "info"
    71  
    72  # Output format: 'plain' (colored text) or 'json'
    73  log_format = "plain"
    74  
    75  ##### additional base config options #####
    76  
    77  # Path to the JSON file containing the initial validator set and other meta data
    78  genesis_file = "config/genesis.json"
    79  
    80  # Path to the JSON file containing the private key to use as a validator in the consensus protocol
    81  priv_validator_key_file = "config/priv_validator_key.json"
    82  
    83  # Path to the JSON file containing the last sign state of a validator
    84  priv_validator_state_file = "data/priv_validator_state.json"
    85  
    86  # TCP or UNIX socket address for CometBFT to listen on for
    87  # connections from an external PrivValidator process
    88  priv_validator_laddr = ""
    89  
    90  # Path to the JSON file containing the private key to use for node authentication in the p2p protocol
    91  node_key_file = "config/node_key.json"
    92  
    93  # Mechanism to connect to the ABCI application: socket | grpc
    94  abci = "socket"
    95  
    96  # If true, query the ABCI app on connecting to a new peer
    97  # so the app can decide if we should keep the connection or not
    98  filter_peers = false
    99  
   100  
   101  #######################################################################
   102  ###                 Advanced Configuration Options                  ###
   103  #######################################################################
   104  
   105  #######################################################
   106  ###       RPC Server Configuration Options          ###
   107  #######################################################
   108  [rpc]
   109  
   110  # TCP or UNIX socket address for the RPC server to listen on
   111  laddr = "tcp://127.0.0.1:26657"
   112  
   113  # A list of origins a cross-domain request can be executed from
   114  # Default value '[]' disables cors support
   115  # Use '["*"]' to allow any origin
   116  cors_allowed_origins = []
   117  
   118  # A list of methods the client is allowed to use with cross-domain requests
   119  cors_allowed_methods = ["HEAD", "GET", "POST", ]
   120  
   121  # A list of non simple headers the client is allowed to use with cross-domain requests
   122  cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time", ]
   123  
   124  # TCP or UNIX socket address for the gRPC server to listen on
   125  # NOTE: This server only supports /broadcast_tx_commit
   126  grpc_laddr = ""
   127  
   128  # Maximum number of simultaneous connections.
   129  # Does not include RPC (HTTP&WebSocket) connections. See max_open_connections
   130  # If you want to accept a larger number than the default, make sure
   131  # you increase your OS limits.
   132  # 0 - unlimited.
   133  # Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files}
   134  # 1024 - 40 - 10 - 50 = 924 = ~900
   135  grpc_max_open_connections = 900
   136  
   137  # Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool
   138  unsafe = false
   139  
   140  # Maximum number of simultaneous connections (including WebSocket).
   141  # Does not include gRPC connections. See grpc_max_open_connections
   142  # If you want to accept a larger number than the default, make sure
   143  # you increase your OS limits.
   144  # 0 - unlimited.
   145  # Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files}
   146  # 1024 - 40 - 10 - 50 = 924 = ~900
   147  max_open_connections = 900
   148  
   149  # Maximum number of unique clientIDs that can /subscribe
   150  # If you're using /broadcast_tx_commit, set to the estimated maximum number
   151  # of broadcast_tx_commit calls per block.
   152  max_subscription_clients = 100
   153  
   154  # Maximum number of unique queries a given client can /subscribe to
   155  # If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to
   156  # the estimated # maximum number of broadcast_tx_commit calls per block.
   157  max_subscriptions_per_client = 5
   158  
   159  # Experimental parameter to specify the maximum number of events a node will
   160  # buffer, per subscription, before returning an error and closing the
   161  # subscription. Must be set to at least 100, but higher values will accommodate
   162  # higher event throughput rates (and will use more memory).
   163  experimental_subscription_buffer_size = 200
   164  
   165  # Experimental parameter to specify the maximum number of RPC responses that
   166  # can be buffered per WebSocket client. If clients cannot read from the
   167  # WebSocket endpoint fast enough, they will be disconnected, so increasing this
   168  # parameter may reduce the chances of them being disconnected (but will cause
   169  # the node to use more memory).
   170  #
   171  # Must be at least the same as "experimental_subscription_buffer_size",
   172  # otherwise connections could be dropped unnecessarily. This value should
   173  # ideally be somewhat higher than "experimental_subscription_buffer_size" to
   174  # accommodate non-subscription-related RPC responses.
   175  experimental_websocket_write_buffer_size = 200
   176  
   177  # If a WebSocket client cannot read fast enough, at present we may
   178  # silently drop events instead of generating an error or disconnecting the
   179  # client.
   180  #
   181  # Enabling this experimental parameter will cause the WebSocket connection to
   182  # be closed instead if it cannot read fast enough, allowing for greater
   183  # predictability in subscription behaviour.
   184  experimental_close_on_slow_client = false
   185  
   186  # How long to wait for a tx to be committed during /broadcast_tx_commit.
   187  # WARNING: Using a value larger than 10s will result in increasing the
   188  # global HTTP write timeout, which applies to all connections and endpoints.
   189  # See https://github.com/cometbft/cometbft/issues/3435
   190  timeout_broadcast_tx_commit = "10s"
   191  
   192  # Maximum size of request body, in bytes
   193  max_body_bytes = 1000000
   194  
   195  # Maximum size of request header, in bytes
   196  max_header_bytes = 1048576
   197  
   198  # The path to a file containing certificate that is used to create the HTTPS server.
   199  # Might be either absolute path or path related to CometBFT's config directory.
   200  # If the certificate is signed by a certificate authority,
   201  # the certFile should be the concatenation of the server's certificate, any intermediates,
   202  # and the CA's certificate.
   203  # NOTE: both tls_cert_file and tls_key_file must be present for CometBFT to create HTTPS server.
   204  # Otherwise, HTTP server is run.
   205  tls_cert_file = ""
   206  
   207  # The path to a file containing matching private key that is used to create the HTTPS server.
   208  # Might be either absolute path or path related to CometBFT's config directory.
   209  # NOTE: both tls-cert-file and tls-key-file must be present for CometBFT to create HTTPS server.
   210  # Otherwise, HTTP server is run.
   211  tls_key_file = ""
   212  
   213  # pprof listen address (https://golang.org/pkg/net/http/pprof)
   214  pprof_laddr = ""
   215  
   216  #######################################################
   217  ###           P2P Configuration Options             ###
   218  #######################################################
   219  [p2p]
   220  
   221  # Address to listen for incoming connections
   222  laddr = "tcp://0.0.0.0:26656"
   223  
   224  # Address to advertise to peers for them to dial
   225  # If empty, will use the same port as the laddr,
   226  # and will introspect on the listener or use UPnP
   227  # to figure out the address. ip and port are required
   228  # example: 159.89.10.97:26656
   229  external_address = ""
   230  
   231  # Comma separated list of seed nodes to connect to
   232  seeds = ""
   233  
   234  # Comma separated list of nodes to keep persistent connections to
   235  persistent_peers = ""
   236  
   237  # UPNP port forwarding
   238  upnp = false
   239  
   240  # Path to address book
   241  addr_book_file = "config/addrbook.json"
   242  
   243  # Set true for strict address routability rules
   244  # Set false for private or local networks
   245  addr_book_strict = true
   246  
   247  # Maximum number of inbound peers
   248  max_num_inbound_peers = 40
   249  
   250  # Maximum number of outbound peers to connect to, excluding persistent peers
   251  max_num_outbound_peers = 10
   252  
   253  # List of node IDs, to which a connection will be (re)established ignoring any existing limits
   254  unconditional_peer_ids = ""
   255  
   256  # Maximum pause when redialing a persistent peer (if zero, exponential backoff is used)
   257  persistent_peers_max_dial_period = "0s"
   258  
   259  # Time to wait before flushing messages out on the connection
   260  flush_throttle_timeout = "100ms"
   261  
   262  # Maximum size of a message packet payload, in bytes
   263  max_packet_msg_payload_size = 1024
   264  
   265  # Rate at which packets can be sent, in bytes/second
   266  send_rate = 5120000
   267  
   268  # Rate at which packets can be received, in bytes/second
   269  recv_rate = 5120000
   270  
   271  # Set true to enable the peer-exchange reactor
   272  pex = true
   273  
   274  # Seed mode, in which node constantly crawls the network and looks for
   275  # peers. If another node asks it for addresses, it responds and disconnects.
   276  #
   277  # Does not work if the peer-exchange reactor is disabled.
   278  seed_mode = false
   279  
   280  # Comma separated list of peer IDs to keep private (will not be gossiped to other peers)
   281  private_peer_ids = ""
   282  
   283  # Toggle to disable guard against peers connecting from the same ip.
   284  allow_duplicate_ip = false
   285  
   286  # Peer connection configuration.
   287  handshake_timeout = "20s"
   288  dial_timeout = "3s"
   289  
   290  #######################################################
   291  ###          Mempool Configuration Option          ###
   292  #######################################################
   293  [mempool]
   294  
   295  # Mempool version to use:
   296  #   1) "v0" - (default) FIFO mempool.
   297  #   2) "v1" - prioritized mempool.
   298  #   3) "v2" - CAT
   299  version = "v2"
   300  
   301  # Recheck (default: true) defines whether CometBFT should recheck the
   302  # validity for all remaining transaction in the mempool after a block.
   303  # Since a block affects the application state, some transactions in the
   304  # mempool may become invalid. If this does not apply to your application,
   305  # you can disable rechecking.
   306  recheck = true
   307  broadcast = true
   308  wal_dir = ""
   309  
   310  # Maximum number of transactions in the mempool
   311  size = 5000
   312  
   313  # Limit the total size of all txs in the mempool.
   314  # This only accounts for raw transactions (e.g. given 1MB transactions and
   315  # max_txs_bytes=5MB, mempool will only accept 5 transactions).
   316  max_txs_bytes = 1073741824
   317  
   318  # Size of the cache (used to filter transactions we saw earlier) in transactions
   319  cache_size = 10000
   320  
   321  # Do not remove invalid transactions from the cache (default: false)
   322  # Set to true if it's not possible for any invalid transaction to become valid
   323  # again in the future.
   324  keep-invalid-txs-in-cache = false
   325  
   326  # Maximum size of a single transaction.
   327  # NOTE: the max size of a tx transmitted over the network is {max_tx_bytes}.
   328  max_tx_bytes = 1048576
   329  
   330  # Maximum size of a batch of transactions to send to a peer
   331  # Including space needed by encoding (one varint per transaction).
   332  # XXX: Unused due to https://github.com/cometbft/cometbft/issues/5796
   333  max_batch_bytes = 0
   334  
   335  # ttl-duration, if non-zero, defines the maximum amount of time a transaction
   336  # can exist for in the mempool.
   337  #
   338  # Note, if ttl-num-blocks is also defined, a transaction will be removed if it
   339  # has existed in the mempool at least ttl-num-blocks number of blocks or if it's
   340  # insertion time into the mempool is beyond ttl-duration.
   341  ttl-duration = "0s"
   342  
   343  # ttl-num-blocks, if non-zero, defines the maximum number of blocks a transaction
   344  # can exist for in the mempool.
   345  #
   346  # Note, if ttl-duration is also defined, a transaction will be removed if it
   347  # has existed in the mempool at least ttl-num-blocks number of blocks or if
   348  # it's insertion time into the mempool is beyond ttl-duration.
   349  ttl-num-blocks = 0
   350  
   351  #######################################################
   352  ###         State Sync Configuration Options        ###
   353  #######################################################
   354  [statesync]
   355  # State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine
   356  # snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in
   357  # the network to take and serve state machine snapshots. State sync is not attempted if the node
   358  # has any local state (LastBlockHeight > 0). The node will have a truncated block history,
   359  # starting from the height of the snapshot.
   360  enable = false
   361  
   362  # RPC servers (comma-separated) for light client verification of the synced state machine and
   363  # retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding
   364  # header hash obtained from a trusted source, and a period during which validators can be trusted.
   365  #
   366  # For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2
   367  # weeks) during which they can be financially punished (slashed) for misbehavior.
   368  rpc_servers = ""
   369  trust_height = 0
   370  trust_hash = ""
   371  trust_period = "168h0m0s"
   372  
   373  # Time to spend discovering snapshots before initiating a restore.
   374  discovery_time = "15s"
   375  
   376  # Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp).
   377  # Will create a new, randomly named directory within, and remove it when done.
   378  temp_dir = ""
   379  
   380  # The timeout duration before re-requesting a chunk, possibly from a different
   381  # peer (default: 1 minute).
   382  chunk_request_timeout = "10s"
   383  
   384  # The number of concurrent chunk fetchers to run (default: 1).
   385  chunk_fetchers = "4"
   386  
   387  #######################################################
   388  ###       Fast Sync Configuration Connections       ###
   389  #######################################################
   390  [fastsync]
   391  
   392  # Fast Sync version to use:
   393  #   1) "v0" (default) - the legacy fast sync implementation
   394  #   2) "v1" - refactor of v0 version for better testability
   395  #   2) "v2" - complete redesign of v0, optimized for testability & readability
   396  version = "v0"
   397  
   398  #######################################################
   399  ###         Consensus Configuration Options         ###
   400  #######################################################
   401  [consensus]
   402  
   403  wal_file = "data/cs.wal/wal"
   404  
   405  # How long we wait for a proposal block before prevoting nil
   406  timeout_propose = "3s"
   407  # How much timeout_propose increases with each round
   408  timeout_propose_delta = "500ms"
   409  # How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil)
   410  timeout_prevote = "1s"
   411  # How much the timeout_prevote increases with each round
   412  timeout_prevote_delta = "500ms"
   413  # How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil)
   414  timeout_precommit = "1s"
   415  # How much the timeout_precommit increases with each round
   416  timeout_precommit_delta = "500ms"
   417  # How long we wait after committing a block, before starting on the new
   418  # height (this gives us a chance to receive some more precommits, even
   419  # though we already have +2/3).
   420  timeout_commit = "1s"
   421  
   422  # How many blocks to look back to check existence of the node's consensus votes before joining consensus
   423  # When non-zero, the node will panic upon restart
   424  # if the same consensus key was used to sign {double_sign_check_height} last blocks.
   425  # So, validators should stop the state machine, wait for some blocks, and then restart the state machine to avoid panic.
   426  double_sign_check_height = 0
   427  
   428  # Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
   429  skip_timeout_commit = false
   430  
   431  # EmptyBlocks mode and possible interval between empty blocks
   432  create_empty_blocks = true
   433  create_empty_blocks_interval = "0s"
   434  
   435  # Reactor sleep duration parameters
   436  peer_gossip_sleep_duration = "100ms"
   437  peer_query_maj23_sleep_duration = "2s"
   438  
   439  #######################################################
   440  ###         Storage Configuration Options           ###
   441  #######################################################
   442  [storage]
   443  
   444  # Set to true to discard ABCI responses from the state store, which can save a
   445  # considerable amount of disk space. Set to false to ensure ABCI responses are
   446  # persisted. ABCI responses are required for /block_results RPC queries, and to
   447  # reindex events in the command-line tool.
   448  discard_abci_responses = false
   449  
   450  #######################################################
   451  ###   Transaction Indexer Configuration Options     ###
   452  #######################################################
   453  [tx_index]
   454  
   455  # What indexer to use for transactions
   456  #
   457  # The application will set which txs to index. In some cases a node operator will be able
   458  # to decide which txs to index based on configuration set in the application.
   459  #
   460  # Options:
   461  #   1) "null"
   462  #   2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend).
   463  # 		- When "kv" is chosen "tx.height" and "tx.hash" will always be indexed.
   464  #   3) "psql" - the indexer services backed by PostgreSQL.
   465  # When "kv" or "psql" is chosen "tx.height" and "tx.hash" will always be indexed.
   466  indexer = "kv"
   467  
   468  # The PostgreSQL connection configuration, the connection format:
   469  #   postgresql://<user>:<password>@<host>:<port>/<db>?<opts>
   470  psql-conn = ""
   471  
   472  #######################################################
   473  ###       Instrumentation Configuration Options     ###
   474  #######################################################
   475  [instrumentation]
   476  
   477  # When true, Prometheus metrics are served under /metrics on
   478  # PrometheusListenAddr.
   479  # Check out the documentation for the list of available metrics.
   480  prometheus = false
   481  
   482  # Address to listen for Prometheus collector(s) connections
   483  prometheus_listen_addr = ":26660"
   484  
   485  # Maximum number of simultaneous connections.
   486  # If you want to accept a larger number than the default, make sure
   487  # you increase your OS limits.
   488  # 0 - unlimited.
   489  max_open_connections = 3
   490  
   491  # Instrumentation namespace
   492  namespace = "cometbft"
   493   ```
   494  
   495  ## Empty blocks VS no empty blocks
   496  ### create_empty_blocks = true
   497  
   498  If `create_empty_blocks` is set to `true` in your config, blocks will be created ~ every second (with default consensus parameters). You can regulate the delay between blocks by changing the `timeout_commit`. E.g. `timeout_commit = "10s"` should result in ~ 10 second blocks.
   499  
   500  ### create_empty_blocks = false
   501  
   502  In this setting, blocks are created when transactions received.
   503  
   504  Note after the block H, CometBFT creates something we call a "proof block"
   505  (only if the application hash changed) H+1. The reason for this is to support
   506  proofs. If you have a transaction in block H that changes the state to X, the
   507  new application hash will only be included in block H+1. If after your
   508  transaction is committed, you want to get a light-client proof for the new state
   509  (X), you need the new block to be committed in order to do that because the new
   510  block has the new application hash for the state X. That's why we make a new
   511  (empty) block if the application hash changes. Otherwise, you won't be able to
   512  make a proof for the new state.
   513  
   514  Plus, if you set `create_empty_blocks_interval` to something other than the
   515  default (`0`), CometBFT will be creating empty blocks even in the absence of
   516  transactions every `create_empty_blocks_interval`. For instance, with
   517  `create_empty_blocks = false` and `create_empty_blocks_interval = "30s"`,
   518  CometBFT will only create blocks if there are transactions, or after waiting
   519  30 seconds without receiving any transactions.
   520  
   521  Plus, if you set `create_empty_blocks_interval` to something other than the default (`0`), CometBFT will be creating empty blocks even in the absence of transactions every `create_empty_blocks_interval.` For instance, with `create_empty_blocks = false` and `create_empty_blocks_interval = "30s"`, CometBFT will only create blocks if there are transactions, or after waiting 30 seconds without receiving any transactions.
   522  
   523  ## Consensus timeouts explained
   524  There's a variety of information about timeouts in [Running in
   525  production](./running-in-production.md#configuration-parameters).
   526  You can also find more detailed explanation in the paper describing
   527  the Tendermint consensus algorithm, adopted by CometBFT: [The latest
   528  gossip on BFT consensus](https://arxiv.org/abs/1807.04938).
   529  
   530  ```toml
   531  [consensus]
   532  ...
   533  
   534  timeout_propose = "3s"
   535  timeout_propose_delta = "500ms"
   536  timeout_prevote = "1s"
   537  timeout_prevote_delta = "500ms"
   538  timeout_precommit = "1s"
   539  timeout_precommit_delta = "500ms"
   540  timeout_commit = "1s"
   541  ```
   542  
   543  Note that in a successful round, the only timeout that we absolutely wait no
   544  matter what is `timeout_commit`.
   545  
   546  Here's a brief summary of the timeouts:
   547  
   548  - `timeout_propose` = how long we wait for a proposal block before prevoting nil
   549  - `timeout_propose_delta` = how much  `timeout_propose` increases with each round
   550  - `timeout_prevote` = how long we wait after receiving +2/3 prevotes for
   551    anything (ie. not a single block or nil)
   552  - `timeout_prevote_delta` = how much the `timeout_prevote` increases with each round
   553  - `timeout_precommit` = how long we wait after receiving +2/3 precommits for
   554    anything (ie. not a single block or nil)
   555  - `timeout_precommit_delta` = how much the `timeout_precommit` increases with each round
   556  - `timeout_commit` = how long we wait after committing a block, before starting
   557    on the new height (this gives us a chance to receive some more precommits,
   558    even though we already have +2/3)