hyperldger结构上默认块的大小是多少?

时间:2018-05-14 18:07:31

标签: block hyperledger-fabric hyperledger

如果我使用hyperldger创建新的区块链,我会尝试创建链的大小估计。

为了了解磁盘空间使用情况,我想知道这是超高层结构中默认块的平均大小。

先谢谢你, 最诚挚的问候

2 个答案:

答案 0 :(得分:5)

Bellow您可以找到为订购服务提供的默认配置。您实际上可以使用BatchTimeoutBatchSize参数来控制块大小,同时请注意,这是依赖于事务大小(即链代码的逻辑)的依赖于用例。

################################################################################
#
#   SECTION: Orderer
#
#   - This section defines the values to encode into a config transaction or
#   genesis block for orderer related parameters
#
################################################################################
Orderer: &OrdererDefaults

    # Orderer Type: The orderer implementation to start
    # Available types are "solo" and "kafka"
    OrdererType: solo

    Addresses:
        - orderer.example.com:7050

    # Batch Timeout: The amount of time to wait before creating a batch
    BatchTimeout: 2s

    # Batch Size: Controls the number of messages batched into a block
    BatchSize:

        # Max Message Count: The maximum number of messages to permit in a batch
        MaxMessageCount: 10

        # Absolute Max Bytes: The absolute maximum number of bytes allowed for
        # the serialized messages in a batch.
        AbsoluteMaxBytes: 98 MB

        # Preferred Max Bytes: The preferred maximum number of bytes allowed for
        # the serialized messages in a batch. A message larger than the preferred
        # max bytes will result in a batch larger than preferred max bytes.
        PreferredMaxBytes: 512 KB

答案 1 :(得分:1)

该值已配置:

################################################################################
#   SECTION: Orderer
################################################################################
Orderer: &OrdererDefaults
    OrdererType: solo
    Addresses:
        #- orderer0.ordererorg:7050
        - orderer0:7050
    Kafka:
        Brokers:
    BatchTimeout: 2s
    BatchSize:
        MaxMessageCount: 10
        AbsoluteMaxBytes: 98 MB
        PreferredMaxBytes: 512 KB
    Organizations:

该文件位于configtx.yaml中,并且在config.go中定义。

// BatchSize contains configuration affecting the size of batches.
type BatchSize struct {
    MaxMessageCount   uint32 `yaml:"MaxMessageSize"`
    AbsoluteMaxBytes  uint32 `yaml:"AbsoluteMaxBytes"`
    PreferredMaxBytes uint32 `yaml:"PreferredMaxBytes"`
}

根据上面的configtx.yaml文件设置值。