创世文件是链的起点。应用会在创世文件中的 app_state 字段填入其所需的字段。CometBFT 无法校验这一部分,因为它并不知道应用状态由哪些内容组成。

创世字段

  • genesis_time:创世时间是区块链开始或将要开始的时间。如果节点在该时间之前启动,它们会保持空闲,直到到达指定时间。
  • chain_id:chain_id 是链的标识符。每条链都应具有唯一标识符。在进行基于分叉的升级时,我们建议修改 chain_id,以避免网络或共识错误。
  • initial_height:该字段是区块链的起始高度。在进行链重启时,如果希望避免从高度 1 重新开始,网络可以从指定高度启动。
  • consensus_params
    • block
      • max_bytes:区块可包含的最大字节数。
      • max_gas:区块可包含的最大 gas 数量。
      • time_iota_ms:该参数在 CometBFT 中已不再有实际取值意义。
  • evidence
    • max_age_num_blocks:超过预设的区块数量后,单条证据将被视为无效。
    • max_age_duration:超过预设的时间长度后,单条证据将被视为无效。
    • max_bytes:一个区块中可包含的全部证据的最大字节数。
注意:证据要被视为无效,必须同时超过 max_age_num_blocks 和 max_age_duration
  • validator
    • pub_key_types:定义哪些曲线可被接受为有效的验证者共识公钥。CometBFT 支持 ed25519、secp256k1 和 bls12381。
  • version
    • app_version:应用的版本号。该值由应用设置,用于标识用户应使用哪个版本的应用来运行节点。
  • validators
    • 这是一个验证者数组。该验证者集合会作为链的初始验证者集合使用。如果应用在 InitChain 中设置验证者集合,则该字段可以为空。
  • app_hash:应用状态的根哈希。该字段在链启动时不需要填写,应用可以通过 Initchain 提供所需信息。
  • app_state:这一部分由应用填写,CometBFT 并不了解其内部结构。

The genesis file is the starting point of a chain. An application will populate the app_state field in the genesis with their required fields. CometBFT is not able to validate this section because it is unaware what application state consists of.

Genesis Fields

  • genesis_time: The genesis time is the time the blockchain started or will start. If nodes are started before this time they will sit idle until the time specified.
  • chain_id: The chainid is the chain identifier. Every chain should have a unique identifier. When conducting a fork based upgrade, we recommend changing the chainid to avoid network or consensus errors.
  • initial_height: This field is the starting height of the blockchain. When conducting a chain restart to avoid restarting at height 1, the network is able to start at a specified height.
  • consensus_params
    • block
      • max_bytes: The max amount of bytes a block can be.
      • max_gas: The maximum amount of gas that a block can have.
      • time_iota_ms: This parameter has no value anymore in CometBFT.
  • evidence
    • max_age_num_blocks: After this preset amount of blocks has passed a single piece of evidence is considered invalid
    • max_age_duration: After this preset amount of time has passed a single piece of evidence is considered invalid.
    • max_bytes: The max amount of bytes of all evidence included in a block.
Note: For evidence to be considered invalid, evidence must be older than both max_age_num_blocks and max_age_duration
  • validator
    • pub_key_types: Defines which curves are to be accepted as a valid validator consensus key. CometBFT supports ed25519, secp256k1, and bls12381.
  • version
    • app_version: The version of the application. This is set by the application and is used to identify which version of the app a user should be using in order to operate a node.
  • validators
    • This is an array of validators. This validator set is used as the starting validator set of the chain. This field can be empty, if the application sets the validator set in InitChain.
  • app_hash: The applications state root hash. This field does not need to be populated at the start of the chain, the application may provide the needed information via Initchain.
  • app_state: This section is filled in by the application and is unknown to CometBFT.