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