github.com/okex/exchain@v1.8.0/libs/tendermint/docs/tendermint-core/configuration.md (about) 1 --- 2 order: 3 3 --- 4 5 # Configuration 6 7 Tendermint Core can be configured via a TOML file in 8 `$TMHOME/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 `tendermint 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 `tendermint` installed: 18 19 ``` 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/.tendermint" by default, but could be changed via $TMHOME env variable 26 # or --home cmd flag. 27 28 ##### main base config options ##### 29 30 # TCP or UNIX socket address of the ABCI application, 31 # or the name of an ABCI application compiled in with the Tendermint binary 32 proxy_app = "tcp://127.0.0.1:26658" 33 34 # A custom human readable name for this node 35 moniker = "anonymous" 36 37 # If this node is many blocks behind the tip of the chain, FastSync 38 # allows them to catchup quickly by downloading blocks in parallel 39 # and verifying their commits 40 fast_sync = true 41 42 # AutoFastSync allows this node switches from consensus mode to fast-sync mode automatically 43 # when it is many blocks behind the tip of the chain. 44 auto_fast_sync = true 45 46 # Database backend: goleveldb | cleveldb | boltdb | rocksdb 47 # * goleveldb (github.com/syndtr/goleveldb - most popular implementation) 48 # - pure go 49 # - stable 50 # * cleveldb (uses levigo wrapper) 51 # - fast 52 # - requires gcc 53 # - use cleveldb build tag (go build -tags cleveldb) 54 # * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) 55 # - EXPERIMENTAL 56 # - may be faster is some use-cases (random reads - indexer) 57 # - use boltdb build tag (go build -tags boltdb) 58 # * rocksdb (uses github.com/tecbot/gorocksdb) 59 # - EXPERIMENTAL 60 # - requires gcc 61 # - use rocksdb build tag (go build -tags rocksdb) 62 db_backend = "goleveldb" 63 64 # Database directory 65 db_dir = "data" 66 67 # Output level for logging, including package level options 68 log_level = "main:info,state:info,*:error" 69 70 # Output format: 'plain' (colored text) or 'json' 71 log_format = "plain" 72 73 ##### additional base config options ##### 74 75 # Path to the JSON file containing the initial validator set and other meta data 76 genesis_file = "config/genesis.json" 77 78 # Path to the JSON file containing the private key to use as a validator in the consensus protocol 79 priv_validator_file = "config/priv_validator.json" 80 81 # TCP or UNIX socket address for Tendermint to listen on for 82 # connections from an external PrivValidator process 83 priv_validator_laddr = "" 84 85 # Path to the JSON file containing the private key to use for node authentication in the p2p protocol 86 node_key_file = "config/node_key.json" 87 88 # Mechanism to connect to the ABCI application: socket | grpc 89 abci = "socket" 90 91 # TCP or UNIX socket address for the profiling server to listen on 92 prof_laddr = "" 93 94 # If true, query the ABCI app on connecting to a new peer 95 # so the app can decide if we should keep the connection or not 96 filter_peers = false 97 98 ##### advanced configuration options ##### 99 100 ##### rpc server configuration options ##### 101 [rpc] 102 103 # TCP or UNIX socket address for the RPC server to listen on 104 laddr = "tcp://0.0.0.0:26657" 105 106 # A list of origins a cross-domain request can be executed from 107 # Default value '[]' disables cors support 108 # Use '["*"]' to allow any origin 109 cors_allowed_origins = [] 110 111 # A list of methods the client is allowed to use with cross-domain requests 112 cors_allowed_methods = ["HEAD", "GET", "POST"] 113 114 # A list of non simple headers the client is allowed to use with cross-domain requests 115 cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"] 116 117 # TCP or UNIX socket address for the gRPC server to listen on 118 # NOTE: This server only supports /broadcast_tx_commit 119 grpc_laddr = "" 120 121 # Maximum number of simultaneous connections. 122 # Does not include RPC (HTTP&WebSocket) connections. See max_open_connections 123 # If you want to accept a larger number than the default, make sure 124 # you increase your OS limits. 125 # 0 - unlimited. 126 # Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} 127 # 1024 - 40 - 10 - 50 = 924 = ~900 128 grpc_max_open_connections = 900 129 130 # Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool 131 unsafe = false 132 133 # Maximum number of simultaneous connections (including WebSocket). 134 # Does not include gRPC connections. See grpc_max_open_connections 135 # If you want to accept a larger number than the default, make sure 136 # you increase your OS limits. 137 # 0 - unlimited. 138 # Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} 139 # 1024 - 40 - 10 - 50 = 924 = ~900 140 max_open_connections = 900 141 142 # Maximum number of unique clientIDs that can /subscribe 143 # If you're using /broadcast_tx_commit, set to the estimated maximum number 144 # of broadcast_tx_commit calls per block. 145 max_subscription_clients = 100 146 147 # Maximum number of unique queries a given client can /subscribe to 148 # If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to 149 # the estimated # maximum number of broadcast_tx_commit calls per block. 150 max_subscriptions_per_client = 5 151 152 # How long to wait for a tx to be committed during /broadcast_tx_commit. 153 # WARNING: Using a value larger than 10s will result in increasing the 154 # global HTTP write timeout, which applies to all connections and endpoints. 155 # See https://github.com/tendermint/tendermint/issues/3435 156 timeout_broadcast_tx_commit = "10s" 157 158 # Maximum size of request body, in bytes 159 max_body_bytes = {{ .RPC.MaxBodyBytes }} 160 161 # Maximum size of request header, in bytes 162 max_header_bytes = {{ .RPC.MaxHeaderBytes }} 163 164 # The path to a file containing certificate that is used to create the HTTPS server. 165 # Migth be either absolute path or path related to tendermint's config directory. 166 # If the certificate is signed by a certificate authority, 167 # the certFile should be the concatenation of the server's certificate, any intermediates, 168 # and the CA's certificate. 169 # NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. Otherwise, HTTP server is run. 170 tls_cert_file = "" 171 172 # The path to a file containing matching private key that is used to create the HTTPS server. 173 # Migth be either absolute path or path related to tendermint's config directory. 174 # NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. Otherwise, HTTP server is run. 175 tls_key_file = "" 176 177 ##### peer to peer configuration options ##### 178 [p2p] 179 180 # Address to listen for incoming connections 181 laddr = "tcp://0.0.0.0:26656" 182 183 # Address to advertise to peers for them to dial 184 # If empty, will use the same port as the laddr, 185 # and will introspect on the listener or use UPnP 186 # to figure out the address. 187 external_address = "" 188 189 # Comma separated list of seed nodes to connect to 190 seeds = "" 191 192 # Comma separated list of nodes to keep persistent connections to 193 persistent_peers = "" 194 195 # UPNP port forwarding 196 upnp = false 197 198 # Path to address book 199 addr_book_file = "config/addrbook.json" 200 201 # Set true for strict address routability rules 202 # Set false for private or local networks 203 addr_book_strict = true 204 205 # Maximum number of inbound peers 206 max_num_inbound_peers = 40 207 208 # Maximum number of outbound peers to connect to, excluding persistent peers 209 max_num_outbound_peers = 10 210 211 # Time to wait before flushing messages out on the connection 212 flush_throttle_timeout = "100ms" 213 214 # Maximum size of a message packet payload, in bytes 215 max_packet_msg_payload_size = 1024 216 217 # Rate at which packets can be sent, in bytes/second 218 send_rate = 5120000 219 220 # Rate at which packets can be received, in bytes/second 221 recv_rate = 5120000 222 223 # Set true to enable the peer-exchange reactor 224 pex = true 225 226 # Seed mode, in which node constantly crawls the network and looks for 227 # peers. If another node asks it for addresses, it responds and disconnects. 228 # 229 # Does not work if the peer-exchange reactor is disabled. 230 seed_mode = false 231 232 # Comma separated list of peer IDs to keep private (will not be gossiped to other peers) 233 private_peer_ids = "" 234 235 # Toggle to disable guard against peers connecting from the same ip. 236 allow_duplicate_ip = false 237 238 # Peer connection configuration. 239 handshake_timeout = "20s" 240 dial_timeout = "3s" 241 242 ##### mempool configuration options ##### 243 [mempool] 244 245 recheck = true 246 broadcast = true 247 wal_dir = "" 248 249 # Maximum number of transactions in the mempool 250 size = 5000 251 252 # Limit the total size of all txs in the mempool. 253 # This only accounts for raw transactions (e.g. given 1MB transactions and 254 # max_txs_bytes=5MB, mempool will only accept 5 transactions). 255 max_txs_bytes = 1073741824 256 257 # Size of the cache (used to filter transactions we saw earlier) in transactions 258 cache_size = 10000 259 260 # Maximum size of a single transaction. 261 # NOTE: the max size of a tx transmitted over the network is {max_tx_bytes} + {amino overhead}. 262 max_tx_bytes = 1048576 263 264 ##### fast sync configuration options ##### 265 [fastsync] 266 267 # Fast Sync version to use: 268 # 1) "v0" (default) - the legacy fast sync implementation 269 # 2) "v1" - refactor of v0 version for better testability 270 version = "v0" 271 272 ##### consensus configuration options ##### 273 [consensus] 274 275 wal_file = "data/cs.wal/wal" 276 277 timeout_propose = "3s" 278 timeout_propose_delta = "500ms" 279 timeout_prevote = "1s" 280 timeout_prevote_delta = "500ms" 281 timeout_precommit = "1s" 282 timeout_precommit_delta = "500ms" 283 timeout_commit = "1s" 284 285 # Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) 286 skip_timeout_commit = false 287 288 # EmptyBlocks mode and possible interval between empty blocks 289 create_empty_blocks = true 290 create_empty_blocks_interval = "0s" 291 292 # Reactor sleep duration parameters 293 peer_gossip_sleep_duration = "100ms" 294 peer_query_maj23_sleep_duration = "2s" 295 296 # Block time parameters. Corresponds to the minimum time increment between consecutive blocks. 297 blocktime_iota = "1s" 298 299 ##### transactions indexer configuration options ##### 300 [tx_index] 301 302 # What indexer to use for transactions 303 # 304 # Options: 305 # 1) "null" 306 # 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). 307 indexer = "kv" 308 309 # Comma-separated list of compositeKeys to index (by default the only key is "tx.hash") 310 # Remember that Event has the following structure: type.key 311 # type: [ 312 # key: value, 313 # ... 314 # ] 315 # 316 # You can also index transactions by height by adding "tx.height" event here. 317 # 318 # It's recommended to index only a subset of keys due to possible memory 319 # bloat. This is, of course, depends on the indexer's DB and the volume of 320 # transactions. 321 index_keys = "" 322 323 # When set to true, tells indexer to index all compositeKeys (predefined keys: 324 # "tx.hash", "tx.height" and all keys from DeliverTx responses). 325 # 326 # Note this may be not desirable (see the comment above). IndexEvents has a 327 # precedence over IndexAllEvents (i.e. when given both, IndexEvents will be 328 # indexed). 329 index_all_keys = false 330 331 ##### instrumentation configuration options ##### 332 [instrumentation] 333 334 # When true, Prometheus metrics are served under /metrics on 335 # PrometheusListenAddr. 336 # Check out the documentation for the list of available metrics. 337 prometheus = false 338 339 # Address to listen for Prometheus collector(s) connections 340 prometheus_listen_addr = ":26660" 341 342 # Maximum number of simultaneous connections. 343 # If you want to accept a larger number than the default, make sure 344 # you increase your OS limits. 345 # 0 - unlimited. 346 max_open_connections = 3 347 348 # Instrumentation namespace 349 namespace = "tendermint" 350 ``` 351 352 ## Empty blocks VS no empty blocks 353 354 **create_empty_blocks = true** 355 356 If `create_empty_blocks` is set to `true` in your config, blocks will be 357 created ~ every second (with default consensus parameters). You can regulate 358 the delay between blocks by changing the `timeout_commit`. E.g. `timeout_commit = "10s"` should result in ~ 10 second blocks. 359 360 **create_empty_blocks = false** 361 362 In this setting, blocks are created when transactions received. 363 364 Note after the block H, Tendermint creates something we call a "proof block" 365 (only if the application hash changed) H+1. The reason for this is to support 366 proofs. If you have a transaction in block H that changes the state to X, the 367 new application hash will only be included in block H+1. If after your 368 transaction is committed, you want to get a lite-client proof for the new state 369 (X), you need the new block to be committed in order to do that because the new 370 block has the new application hash for the state X. That's why we make a new 371 (empty) block if the application hash changes. Otherwise, you won't be able to 372 make a proof for the new state. 373 374 Plus, if you set `create_empty_blocks_interval` to something other than the 375 default (`0`), Tendermint will be creating empty blocks even in the absence of 376 transactions every `create_empty_blocks_interval`. For instance, with 377 `create_empty_blocks = false` and `create_empty_blocks_interval = "30s"`, 378 Tendermint will only create blocks if there are transactions, or after waiting 379 30 seconds without receiving any transactions. 380 381 ## Consensus timeouts explained 382 383 There's a variety of information about timeouts in [Running in 384 production](./running-in-production.md) 385 386 You can also find more detailed technical explanation in the spec: [The latest 387 gossip on BFT consensus](https://arxiv.org/abs/1807.04938). 388 389 ``` 390 [consensus] 391 ... 392 393 timeout_propose = "3s" 394 timeout_propose_delta = "500ms" 395 timeout_prevote = "1s" 396 timeout_prevote_delta = "500ms" 397 timeout_precommit = "1s" 398 timeout_precommit_delta = "500ms" 399 timeout_commit = "1s" 400 ``` 401 402 Note that in a successful round, the only timeout that we absolutely wait no 403 matter what is `timeout_commit`. 404 405 Here's a brief summary of the timeouts: 406 407 - `timeout_propose` = how long we wait for a proposal block before prevoting 408 nil 409 - `timeout_propose_delta` = how much timeout_propose increases with each round 410 - `timeout_prevote` = how long we wait after receiving +2/3 prevotes for 411 anything (ie. not a single block or nil) 412 - `timeout_prevote_delta` = how much the timeout_prevote increases with each 413 round 414 - `timeout_precommit` = how long we wait after receiving +2/3 precommits for 415 anything (ie. not a single block or nil) 416 - `timeout_precommit_delta` = how much the timeout_precommit increases with 417 each round 418 - `timeout_commit` = how long we wait after committing a block, before starting 419 on the new height (this gives us a chance to receive some more precommits, 420 even though we already have +2/3)