Fabric二进制添加排序节点

目录

书接上回,在 Fabric二进制建链Fabric二进制添加对等节点 的基础上,继续通过二进制命令行的方式,添加一个新的排序节点orderer1。

一、准备orderer1

新增orderer1的目录:

mkdir -p ~/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com

1.1、注册orderer1

注册新排序节点orderer1:

fabric-ca-client register --caname ca-org1 --id.name orderer1 --id.secret orderer1pw --id.type orderer --tls.certfiles /home/songzehao/fabric/ca-cert.pem

日志:

2023/11/01 15:05:06 [INFO] Configuration file location: /home/songzehao/fabric/fabric-ca-client/fabric-ca-client-config.yaml
2023/11/01 15:05:06 [INFO] TLS Enabled
2023/11/01 15:05:06 [INFO] TLS Enabled
Password: orderer1pw

1.2、登记orderer1

登记新排序节点orderer1:

fabric-ca-client enroll -u https://orderer1:orderer1pw@192.168.3.128:7054 --caname ca-org1 -M /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp --tls.certfiles /home/songzehao/fabric/ca-cert.pem

日志:

2023/11/01 15:07:48 [INFO] TLS Enabled
2023/11/01 15:07:48 [INFO] generating key: &{A:ecdsa S:256}
2023/11/01 15:07:48 [INFO] encoded CSR
2023/11/01 15:07:48 [INFO] Stored client certificate at /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp/signcerts/cert.pem
2023/11/01 15:07:48 [INFO] Stored root CA certificate at /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp/cacerts/192-168-3-128-7054-ca-org1.pem
2023/11/01 15:07:48 [INFO] Stored Issuer public key at /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp/IssuerPublicKey
2023/11/01 15:07:48 [INFO] Stored Issuer revocation public key at /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp/IssuerRevocationPublicKey

为orderer1拷贝msp配置:

cp /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/msp/config.yaml /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp/config.yaml

1.3、登记orderer1的tls

登记orderer1的tls:

fabric-ca-client enroll -u https://orderer1:orderer1pw@192.168.3.128:7054 --caname ca-org1 -M /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls --enrollment.profile tls --csr.hosts orderer1.org1.example.com --csr.hosts 192.168.3.128 --tls.certfiles /home/songzehao/fabric/ca-cert.pem

日志:

2023/11/01 15:08:30 [INFO] TLS Enabled
2023/11/01 15:08:30 [INFO] generating key: &{A:ecdsa S:256}
2023/11/01 15:08:30 [INFO] encoded CSR
2023/11/01 15:08:30 [INFO] Stored client certificate at /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/signcerts/cert.pem
2023/11/01 15:08:30 [INFO] Stored TLS root CA certificate at /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/tlscacerts/tls-192-168-3-128-7054-ca-org1.pem
2023/11/01 15:08:30 [INFO] Stored Issuer public key at /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/IssuerPublicKey
2023/11/01 15:08:30 [INFO] Stored Issuer revocation public key at /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/IssuerRevocationPublicKey

为方便查看名称,重命名tls相关文件名:

cp /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/tlscacerts/* /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/ca.crt
cp /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/signcerts/* /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.crt
cp /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/keystore/* /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.key

拷贝该tlsca证书到orderer1节点目录下msp/tlscacerts目录:

mkdir -p /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp/tlscacerts
cp /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/tlscacerts/* /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

配置环境变量,下面需要使用orderer0节点的身份信息:

export CORE_PEER_LOCALMSPID="OrdererOrg1MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem
export CORE_PEER_MSPCONFIGPATH=/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/users/Admin@org1.example.com/msp

二、添加orderer1的tls到系统通道

获取系统通道的最新配置:

peer channel fetch config /home/songzehao/fabric/config/channel-artifacts/config_block_v3.pb -o 192.168.3.128:7050 -c system-channel --tls --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

日志:

2023-11-01 15:09:33.701 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-11-01 15:09:33.703 CST [cli.common] readBlock -> INFO 002 Received block: 1
2023-11-01 15:09:33.703 CST [channelCmd] fetch -> INFO 003 Retrieving last config block: 0
2023-11-01 15:09:33.704 CST [cli.common] readBlock -> INFO 004 Received block: 0

将系统通道配置转为json格式:

configtxlator proto_decode --input /home/songzehao/fabric/config/channel-artifacts/config_block_v3.pb --type common.Block | jq .data.data[0].payload.data.config > /home/songzehao/fabric/config/channel-artifacts/config_v3.json

抽取orderer1的endpoint和tls证书内容:

echo '{"client_tls_cert":"'$(cat /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.crt | base64 -w 0)'","host":"192.168.3.128","port":7057,"server_tls_cert":"'$(cat /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.crt | base64 -w 0)'"}' > /home/songzehao/fabric/config/channel-artifacts/org1consenter_v3.json

将其追加到json配置中:

jq --argfile consenterFile /home/songzehao/fabric/config/channel-artifacts/org1consenter_v3.json '.channel_group.groups.Orderer.values.ConsensusType.value.metadata.consenters += [$consenterFile]' /home/songzehao/fabric/config/channel-artifacts/config_v3.json > /home/songzehao/fabric/config/channel-artifacts/modified_config_v3.json

原配置转化为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/config_v3.json --type common.Config --output /home/songzehao/fabric/config/channel-artifacts/config_v3.pb

更改后的配置转化为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/modified_config_v3.json --type common.Config --output /home/songzehao/fabric/config/channel-artifacts/modified_config_v3.pb

计算更新配置pb:

configtxlator compute_update --channel_id system-channel --original /home/songzehao/fabric/config/channel-artifacts/config_v3.pb --updated /home/songzehao/fabric/config/channel-artifacts/modified_config_v3.pb --output /home/songzehao/fabric/config/channel-artifacts/config_update_v3.pb

更新配置转化为json格式:

configtxlator proto_decode --input /home/songzehao/fabric/config/channel-artifacts/config_update_v3.pb --type common.ConfigUpdate --output /home/songzehao/fabric/config/channel-artifacts/config_update_v3.json

包装更新配置文件:

echo '{"payload":{"header":{"channel_header":{"channel_id":"system-channel", "type":2}},"data":{"config_update":'$(cat /home/songzehao/fabric/config/channel-artifacts/config_update_v3.json)'}}}' | jq . > /home/songzehao/fabric/config/channel-artifacts/config_update_v3_in_envelope.json

再次转为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/config_update_v3_in_envelope.json --type common.Envelope --output /home/songzehao/fabric/config/channel-artifacts/config_update_v3_in_envelope.pb

提交配置更新:

peer channel update -f /home/songzehao/fabric/config/channel-artifacts/config_update_v3_in_envelope.pb -c system-channel -o 192.168.3.128:7050 --tls true --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

日志:

2023-11-01 15:12:04.967 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-11-01 15:12:04.979 CST [channelCmd] update -> INFO 002 Successfully submitted channel update

三、获取最新的系统通道配置

仍旧保持上一节的环境变量不变,获取最新的系统通道配置:

peer channel fetch config /home/songzehao/fabric/config/system-genesis-block/latest_config.block -o 192.168.3.128:7050 -c system-channel --tls --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

日志:

2023-11-01 15:12:26.289 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-11-01 15:12:26.292 CST [cli.common] readBlock -> INFO 002 Received block: 2
2023-11-01 15:12:26.292 CST [channelCmd] fetch -> INFO 003 Retrieving last config block: 2
2023-11-01 15:12:26.293 CST [cli.common] readBlock -> INFO 004 Received block: 2

四、启动orderer1

更改orderer1的节点配置文件,注意设置General.BootstrapFile: /home/songzehao/fabric/config/system-genesis-block/latest_config.block。最终的orderer.yaml:

# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

---
################################################################################
#
#   Orderer Configuration
#
#   - This controls the type and configuration of the orderer.
#
################################################################################
General:
    # Listen address: The IP on which to bind to listen.
    ListenAddress: 192.168.3.128

    # Listen port: The port on which to bind to listen.
    ListenPort: 7057

    # TLS: TLS settings for the GRPC server.
    TLS:
        Enabled: true
        # PrivateKey governs the file location of the private key of the TLS certificate.
        PrivateKey: /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.key
        # Certificate governs the file location of the server TLS certificate.
        Certificate: /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.crt
        RootCAs:
          - /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/ca.crt
        ClientAuthRequired: false
        ClientRootCAs:
    # Keepalive settings for the GRPC server.
    Keepalive:
        # ServerMinInterval is the minimum permitted time between client pings.
        # If clients send pings more frequently, the server will
        # disconnect them.
        ServerMinInterval: 60s
        # ServerInterval is the time between pings to clients.
        ServerInterval: 7200s
        # ServerTimeout is the duration the server waits for a response from
        # a client before closing the connection.
        ServerTimeout: 20s
    # Cluster settings for ordering service nodes that communicate with other ordering service nodes
    # such as Raft based ordering service.
    Cluster:
        # SendBufferSize is the maximum number of messages in the egress buffer.
        # Consensus messages are dropped if the buffer is full, and transaction
        # messages are waiting for space to be freed.
        SendBufferSize: 10
        # ClientCertificate governs the file location of the client TLS certificate
        # used to establish mutual TLS connections with other ordering service nodes.
        ClientCertificate: /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.crt
        # ClientPrivateKey governs the file location of the private key of the client TLS certificate.
        ClientPrivateKey: /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.key
        # The below 4 properties should be either set together, or be unset together.
        # If they are set, then the orderer node uses a separate listener for intra-cluster
        # communication. If they are unset, then the general orderer listener is used.
        # This is useful if you want to use a different TLS server certificates on the
        # client-facing and the intra-cluster listeners.

        # ListenPort defines the port on which the cluster listens to connections.
        ListenPort:
        # ListenAddress defines the IP on which to listen to intra-cluster communication.
        ListenAddress:
        # ServerCertificate defines the file location of the server TLS certificate used for intra-cluster
        # communication.
        ServerCertificate:
        # ServerPrivateKey defines the file location of the private key of the TLS certificate.
        ServerPrivateKey:

    # Bootstrap method: The method by which to obtain the bootstrap block
    # system channel is specified. The option can be one of:
    #   "file" - path to a file containing the genesis block or config block of system channel
    #   "none" - allows an orderer to start without a system channel configuration
    BootstrapMethod: file

    # Bootstrap file: The file containing the bootstrap block to use when
    # initializing the orderer system channel and BootstrapMethod is set to
    # "file".  The bootstrap file can be the genesis block, and it can also be
    # a config block for late bootstrap of some consensus methods like Raft.
    # Generate a genesis block by updating $FABRIC_CFG_PATH/configtx.yaml and
    # using configtxgen command with "-outputBlock" option.
    # Defaults to file "genesisblock" (in $FABRIC_CFG_PATH directory) if not specified.
    BootstrapFile: /home/songzehao/fabric/config/system-genesis-block/latest_config.block

    # LocalMSPDir is where to find the private crypto material needed by the
    # orderer. It is set relative here as a default for dev environments but
    # should be changed to the real location in production.
    LocalMSPDir: /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp

    # LocalMSPID is the identity to register the local MSP material with the MSP
    # manager. IMPORTANT: The local MSP ID of an orderer needs to match the MSP
    # ID of one of the organizations defined in the orderer system channel's
    # /Channel/Orderer configuration. The sample organization defined in the
    # sample configuration provided has an MSP ID of "SampleOrg".
    LocalMSPID: OrdererOrg1MSP

    # Enable an HTTP service for Go "pprof" profiling as documented at:
    # https://golang.org/pkg/net/http/pprof
    Profile:
        Enabled: false
        Address: 0.0.0.0:6067

    # BCCSP configures the blockchain crypto service providers.
    BCCSP:
        # Default specifies the preferred blockchain crypto service provider
        # to use. If the preferred provider is not available, the software
        # based provider ("SW") will be used.
        # Valid providers are:
        #  - SW: a software based crypto provider
        #  - PKCS11: a CA hardware security module crypto provider.
        Default: SW

        # SW configures the software based blockchain crypto provider.
        SW:
            # TODO: The default Hash and Security level needs refactoring to be
            # fully configurable. Changing these defaults requires coordination
            # SHA2 is hardcoded in several places, not only BCCSP
            Hash: SHA2
            Security: 256
            # Location of key store. If this is unset, a location will be
            # chosen using: 'LocalMSPDir'/keystore
            FileKeyStore:
                KeyStore:

        # Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11)
        PKCS11:
            # Location of the PKCS11 module library
            Library:
            # Token Label
            Label:
            # User PIN
            Pin:
            Hash:
            Security:
            FileKeyStore:
                KeyStore:

    # Authentication contains configuration parameters related to authenticating
    # client messages
    Authentication:
        # the acceptable difference between the current server time and the
        # client's time as specified in a client request message
        TimeWindow: 15m


################################################################################
#
#   SECTION: File Ledger
#
#   - This section applies to the configuration of the file or json ledgers.
#
################################################################################
FileLedger:

    # Location: The directory to store the blocks in.
    # NOTE: If this is unset, a new temporary location will be chosen every time
    # the orderer is restarted, using the prefix specified by Prefix.
    Location: /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/hyperledger/production/orderer

    # The prefix to use when generating a ledger directory in temporary space.
    # Otherwise, this value is ignored.
    Prefix: hyperledger-fabric-ordererledger

################################################################################
#
#   SECTION: Kafka
#
#   - This section applies to the configuration of the Kafka-based orderer, and
#     its interaction with the Kafka cluster.
#
################################################################################
Kafka:

    # Retry: What do if a connection to the Kafka cluster cannot be established,
    # or if a metadata request to the Kafka cluster needs to be repeated.
    Retry:
        # When a new channel is created, or when an existing channel is reloaded
        # (in case of a just-restarted orderer), the orderer interacts with the
        # Kafka cluster in the following ways:
        # 1. It creates a Kafka producer (writer) for the Kafka partition that
        # corresponds to the channel.
        # 2. It uses that producer to post a no-op CONNECT message to that
        # partition
        # 3. It creates a Kafka consumer (reader) for that partition.
        # If any of these steps fail, they will be re-attempted every
        # <ShortInterval> for a total of <ShortTotal>, and then every
        # <LongInterval> for a total of <LongTotal> until they succeed.
        # Note that the orderer will be unable to write to or read from a
        # channel until all of the steps above have been completed successfully.
        ShortInterval: 5s
        ShortTotal: 10m
        LongInterval: 5m
        LongTotal: 12h
        # Affects the socket timeouts when waiting for an initial connection, a
        # response, or a transmission. See Config.Net for more info:
        # https://godoc.org/github.com/Shopify/sarama#Config
        NetworkTimeouts:
            DialTimeout: 10s
            ReadTimeout: 10s
            WriteTimeout: 10s
        # Affects the metadata requests when the Kafka cluster is in the middle
        # of a leader election.See Config.Metadata for more info:
        # https://godoc.org/github.com/Shopify/sarama#Config
        Metadata:
            RetryBackoff: 250ms
            RetryMax: 3
        # What to do if posting a message to the Kafka cluster fails. See
        # Config.Producer for more info:
        # https://godoc.org/github.com/Shopify/sarama#Config
        Producer:
            RetryBackoff: 100ms
            RetryMax: 3
        # What to do if reading from the Kafka cluster fails. See
        # Config.Consumer for more info:
        # https://godoc.org/github.com/Shopify/sarama#Config
        Consumer:
            RetryBackoff: 2s
    # Settings to use when creating Kafka topics.  Only applies when
    # Kafka.Version is v0.10.1.0 or higher
    Topic:
        # The number of Kafka brokers across which to replicate the topic
        ReplicationFactor: 3
    # Verbose: Enable logging for interactions with the Kafka cluster.
    Verbose: false

    # TLS: TLS settings for the orderer's connection to the Kafka cluster.
    TLS:

      # Enabled: Use TLS when connecting to the Kafka cluster.
      Enabled: false

      # PrivateKey: PEM-encoded private key the orderer will use for
      # authentication.
      PrivateKey:
        # As an alternative to specifying the PrivateKey here, uncomment the
        # following "File" key and specify the file name from which to load the
        # value of PrivateKey.
        #File: path/to/PrivateKey

      # Certificate: PEM-encoded signed public key certificate the orderer will
      # use for authentication.
      Certificate:
        # As an alternative to specifying the Certificate here, uncomment the
        # following "File" key and specify the file name from which to load the
        # value of Certificate.
        #File: path/to/Certificate

      # RootCAs: PEM-encoded trusted root certificates used to validate
      # certificates from the Kafka cluster.
      RootCAs:
        # As an alternative to specifying the RootCAs here, uncomment the
        # following "File" key and specify the file name from which to load the
        # value of RootCAs.
        #File: path/to/RootCAs

    # SASLPlain: Settings for using SASL/PLAIN authentication with Kafka brokers
    SASLPlain:
      # Enabled: Use SASL/PLAIN to authenticate with Kafka brokers
      Enabled: false
      # User: Required when Enabled is set to true
      User:
      # Password: Required when Enabled is set to true
      Password:

    # Kafka protocol version used to communicate with the Kafka cluster brokers
    # (defaults to 0.10.2.0 if not specified)
    Version:

################################################################################
#
#   Debug Configuration
#
#   - This controls the debugging options for the orderer
#
################################################################################
Debug:

    # BroadcastTraceDir when set will cause each request to the Broadcast service
    # for this orderer to be written to a file in this directory
    BroadcastTraceDir:

    # DeliverTraceDir when set will cause each request to the Deliver service
    # for this orderer to be written to a file in this directory
    DeliverTraceDir:

################################################################################
#
#   Operations Configuration
#
#   - This configures the operations server endpoint for the orderer
#
################################################################################
Operations:
    # host and port for the operations server
    ListenAddress: 192.168.3.128:8447

    # TLS configuration for the operations endpoint
    TLS:
        # TLS enabled
        Enabled: false

        # Certificate is the location of the PEM encoded TLS certificate
        Certificate:

        # PrivateKey points to the location of the PEM-encoded key
        PrivateKey:

        # Most operations service endpoints require client authentication when TLS
        # is enabled. ClientAuthRequired requires client certificate authentication
        # at the TLS layer to access all resources.
        ClientAuthRequired: false

        # Paths to PEM encoded ca certificates to trust for client authentication
        ClientRootCAs: []

################################################################################
#
#   Metrics  Configuration
#
#   - This configures metrics collection for the orderer
#
################################################################################
Metrics:
    # The metrics provider is one of statsd, prometheus, or disabled
    Provider: disabled

    # The statsd configuration
    Statsd:
      # network type: tcp or udp
      Network: udp

      # the statsd server address
      Address: 192.168.3.128:8127

      # The interval at which locally cached counters and gauges are pushed
      # to statsd; timings are pushed immediately
      WriteInterval: 30s

      # The prefix is prepended to all emitted statsd metrics
      Prefix:


################################################################################
#
#   Consensus Configuration
#
#   - This section contains config options for a consensus plugin. It is opaque
#     to orderer, and completely up to consensus implementation to make use of.
#
################################################################################
Consensus:
    # The allowed key-value pairs here depend on consensus plugin. For etcd/raft,
    # we use following options:

    # WALDir specifies the location at which Write Ahead Logs for etcd/raft are
    # stored. Each channel will have its own subdir named after channel ID.
    WALDir: /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/hyperledger/production/orderer/etcdraft/wal

    # SnapDir specifies the location at which snapshots for etcd/raft are
    # stored. Each channel will have its own subdir named after channel ID.
    SnapDir: /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/hyperledger/production/orderer/etcdraft/snapshot

启动orderer1:

orderer start

日志:

2023-11-01 15:15:23.688 CST [localconfig] completeInitialization -> INFO 001 Kafka.Version unset, setting to 0.10.2.0
2023-11-01 15:15:23.688 CST [orderer.common.server] prettyPrintStruct -> INFO 002 Orderer config values:
	General.ListenAddress = "192.168.3.128"
	General.ListenPort = 7057
	General.TLS.Enabled = true
	General.TLS.PrivateKey = "/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.key"
	General.TLS.Certificate = "/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.crt"
	General.TLS.RootCAs = [/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/ca.crt]
	General.TLS.ClientAuthRequired = false
	General.TLS.ClientRootCAs = []
	General.Cluster.ListenAddress = ""
	General.Cluster.ListenPort = 0
	General.Cluster.ServerCertificate = ""
	General.Cluster.ServerPrivateKey = ""
	General.Cluster.ClientCertificate = "/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.crt"
	General.Cluster.ClientPrivateKey = "/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.key"
	General.Cluster.RootCAs = []
	General.Cluster.DialTimeout = 5s
	General.Cluster.RPCTimeout = 7s
	General.Cluster.ReplicationBufferSize = 20971520
	General.Cluster.ReplicationPullTimeout = 5s
	General.Cluster.ReplicationRetryTimeout = 5s
	General.Cluster.ReplicationBackgroundRefreshInterval = 5m0s
	General.Cluster.ReplicationMaxRetries = 12
	General.Cluster.SendBufferSize = 10
	General.Cluster.CertExpirationWarningThreshold = 168h0m0s
	General.Cluster.TLSHandshakeTimeShift = 0s
	General.Keepalive.ServerMinInterval = 1m0s
	General.Keepalive.ServerInterval = 2h0m0s
	General.Keepalive.ServerTimeout = 20s
	General.ConnectionTimeout = 0s
	General.GenesisMethod = ""
	General.GenesisFile = ""
	General.BootstrapMethod = "file"
	General.BootstrapFile = "/home/songzehao/fabric/config/system-genesis-block/latest_config.block"
	General.Profile.Enabled = false
	General.Profile.Address = "0.0.0.0:6067"
	General.LocalMSPDir = "/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp"
	General.LocalMSPID = "OrdererOrg1MSP"
	General.BCCSP.ProviderName = "SW"
	General.BCCSP.SwOpts.SecLevel = 256
	General.BCCSP.SwOpts.HashFamily = "SHA2"
	General.BCCSP.SwOpts.Ephemeral = true
	General.BCCSP.SwOpts.FileKeystore.KeyStorePath = ""
	General.BCCSP.SwOpts.DummyKeystore =
	General.BCCSP.SwOpts.InmemKeystore =
	General.Authentication.TimeWindow = 15m0s
	General.Authentication.NoExpirationChecks = false
	FileLedger.Location = "/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/hyperledger/production/orderer"
	FileLedger.Prefix = "hyperledger-fabric-ordererledger"
	Kafka.Retry.ShortInterval = 5s
	Kafka.Retry.ShortTotal = 10m0s
	Kafka.Retry.LongInterval = 5m0s
	Kafka.Retry.LongTotal = 12h0m0s
	Kafka.Retry.NetworkTimeouts.DialTimeout = 10s
	Kafka.Retry.NetworkTimeouts.ReadTimeout = 10s
	Kafka.Retry.NetworkTimeouts.WriteTimeout = 10s
	Kafka.Retry.Metadata.RetryMax = 3
	Kafka.Retry.Metadata.RetryBackoff = 250ms
	Kafka.Retry.Producer.RetryMax = 3
	Kafka.Retry.Producer.RetryBackoff = 100ms
	Kafka.Retry.Consumer.RetryBackoff = 2s
	Kafka.Verbose = false
	Kafka.Version = 0.10.2.0
	Kafka.TLS.Enabled = false
	Kafka.TLS.PrivateKey = ""
	Kafka.TLS.Certificate = ""
	Kafka.TLS.RootCAs = []
	Kafka.TLS.ClientAuthRequired = false
	Kafka.TLS.ClientRootCAs = []
	Kafka.SASLPlain.Enabled = false
	Kafka.SASLPlain.User = ""
	Kafka.SASLPlain.Password = ""
	Kafka.Topic.ReplicationFactor = 3
	Debug.BroadcastTraceDir = ""
	Debug.DeliverTraceDir = ""
	Consensus = map[SnapDir:/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/hyperledger/production/orderer/etcdraft/snapshot WALDir:/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/hyperledger/production/orderer/etcdraft/wal]
	Operations.ListenAddress = "192.168.3.128:8447"
	Operations.TLS.Enabled = false
	Operations.TLS.PrivateKey = ""
	Operations.TLS.Certificate = ""
	Operations.TLS.RootCAs = []
	Operations.TLS.ClientAuthRequired = false
	Operations.TLS.ClientRootCAs = []
	Metrics.Provider = "disabled"
	Metrics.Statsd.Network = "udp"
	Metrics.Statsd.Address = "192.168.3.128:8127"
	Metrics.Statsd.WriteInterval = 30s
	Metrics.Statsd.Prefix = ""
	ChannelParticipation.Enabled = false
	ChannelParticipation.RemoveStorage = false
2023-11-01 15:15:23.699 CST [orderer.common.server] initializeServerConfig -> INFO 003 Starting orderer with TLS enabled
2023-11-01 15:15:23.705 CST [blkstorage] NewProvider -> INFO 004 Creating new file ledger directory at /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/hyperledger/production/orderer/chains
2023-11-01 15:15:23.707 CST [orderer.common.server] Main -> INFO 005 Not bootstrapping the system channel because the bootstrap block number is 2 (>0), replication is needed
2023-11-01 15:15:23.708 CST [orderer.common.server] Main -> INFO 006 Starting with system channel: system-channel, consensus type: etcdraft
2023-11-01 15:15:23.708 CST [orderer.common.server] Main -> INFO 007 Setting up cluster
2023-11-01 15:15:23.708 CST [orderer.common.server] reuseListener -> INFO 008 Cluster listener is not configured, defaulting to use the general listener on port 7057
2023-11-01 15:15:23.710 CST [blkstorage] newBlockfileMgr -> INFO 009 Getting block information from block storage
2023-11-01 15:15:23.711 CST [orderer.common.cluster] replicateNeededChannels -> INFO 00a Will now replicate chains
2023-11-01 15:15:23.717 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 00b 192.168.3.128:7050 is at block sequence of 2 channel=system-channel
2023-11-01 15:15:23.717 CST [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 00c Connected to 192.168.3.128:7050 with last block seq of 2 channel=system-channel
2023-11-01 15:15:23.718 CST [orderer.common.cluster.replication] obtainStream -> INFO 00d Sending request for block [0] to 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.720 CST [orderer.common.cluster.replication] pullBlocks -> INFO 00e Got block [0] of size 13 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.720 CST [orderer.common.cluster.replication] pullBlocks -> INFO 00f Got block [1] of size 19 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.720 CST [orderer.common.cluster.replication] pullBlocks -> INFO 010 Got block [2] of size 24 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.721 CST [orderer.common.cluster] Channels -> INFO 011 Block 0 doesn't contain a new channel
2023-11-01 15:15:23.721 CST [orderer.common.cluster] Channels -> INFO 012 Block 1 contains channel channel1
2023-11-01 15:15:23.721 CST [orderer.common.cluster] discoverChannels -> INFO 013 Discovered 1 channels: [channel1]
2023-11-01 15:15:23.721 CST [orderer.common.cluster] channelsToPull -> INFO 014 Evaluating channels to pull: [channel1]
2023-11-01 15:15:23.721 CST [orderer.common.cluster] channelsToPull -> INFO 015 Probing whether I should pull channel channel1
2023-11-01 15:15:23.726 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 016 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:15:23.727 CST [orderer.common.cluster.replication] HeightsByEndpoints -> INFO 017 Returning the heights of OSNs mapped by endpoints map[192.168.3.128:7050:15] channel=system-channel
2023-11-01 15:15:23.731 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 018 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:15:23.731 CST [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 019 Connected to 192.168.3.128:7050 with last block seq of 14 channel=system-channel
2023-11-01 15:15:23.731 CST [orderer.common.cluster.replication] obtainStream -> INFO 01a Sending request for block [14] to 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.733 CST [orderer.common.cluster.replication] pullBlocks -> INFO 01b Got block [14] of size 5 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.738 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 01c 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:15:23.738 CST [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 01d Connected to 192.168.3.128:7050 with last block seq of 14 channel=system-channel
2023-11-01 15:15:23.739 CST [orderer.common.cluster.replication] obtainStream -> INFO 01e Sending request for block [8] to 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.740 CST [orderer.common.cluster.replication] pullBlocks -> INFO 01f Got block [8] of size 18 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.742 CST [orderer.common.cluster] channelsToPull -> INFO 020 I do not belong to channel channel1 or am forbidden pulling it (not in the channel), skipping chain retrieval
2023-11-01 15:15:23.742 CST [orderer.common.cluster] ReplicateChains -> INFO 021 Found myself in 0 channels out of 1 : {[] [{channel1 0xc0000bf500}]}
2023-11-01 15:15:23.743 CST [blkstorage] newBlockfileMgr -> INFO 022 Getting block information from block storage
2023-11-01 15:15:23.748 CST [orderer.common.cluster] appendBlock -> INFO 023 Committed block [0] for channel channel1
2023-11-01 15:15:23.748 CST [orderer.common.cluster] PullChannel -> INFO 024 Pulling channel system-channel
2023-11-01 15:15:23.752 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 025 192.168.3.128:7050 is at block sequence of 2 channel=system-channel
2023-11-01 15:15:23.752 CST [orderer.common.cluster.replication] HeightsByEndpoints -> INFO 026 Returning the heights of OSNs mapped by endpoints map[192.168.3.128:7050:3] channel=system-channel
2023-11-01 15:15:23.752 CST [orderer.common.cluster] PullChannel -> INFO 027 Latest block height for channel system-channel is 3
2023-11-01 15:15:23.757 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 028 192.168.3.128:7050 is at block sequence of 2 channel=system-channel
2023-11-01 15:15:23.757 CST [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 029 Connected to 192.168.3.128:7050 with last block seq of 2 channel=system-channel
2023-11-01 15:15:23.757 CST [orderer.common.cluster.replication] obtainStream -> INFO 02a Sending request for block [0] to 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.759 CST [orderer.common.cluster.replication] pullBlocks -> INFO 02b Got block [0] of size 13 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.760 CST [orderer.common.cluster.replication] pullBlocks -> INFO 02c Got block [1] of size 19 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.760 CST [orderer.common.cluster.replication] pullBlocks -> INFO 02d Got block [2] of size 24 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:23.763 CST [orderer.common.cluster] appendBlock -> INFO 02e Committed block [0] for channel system-channel
2023-11-01 15:15:23.765 CST [orderer.common.cluster] appendBlock -> INFO 02f Committed block [1] for channel system-channel
2023-11-01 15:15:23.767 CST [orderer.common.cluster] appendBlock -> INFO 030 Committed block [2] for channel system-channel
2023-11-01 15:15:23.771 CST [orderer.consensus.etcdraft] detectSelfID -> WARN 031 Could not find -----BEGIN CERTIFICATE-----
MIIC4DCCAoagAwIBAgIUKVTS7CLoIzKbcsz64RAkgaPPel4wCgYIKoZIzj0EAwIw
cDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMQ8wDQYDVQQH
EwZEdXJoYW0xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMjMxMTAxMDcwNDAwWhcNMjQxMDMxMDcwOTAw
WjBhMQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGggQ2Fyb2xpbmExFDASBgNV
BAoTC0h5cGVybGVkZ2VyMRAwDgYDVQQLEwdvcmRlcmVyMREwDwYDVQQDEwhvcmRl
cmVyMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABIumaxt0nP75HwHrYggr7iV4
ZxVHevJ1Oi7gNvKLTCR9wTPeKP5jxTFLWdtic4EsWw9m3ozdzCo+YNN/N4/BKKqj
ggELMIIBBzAOBgNVHQ8BAf8EBAMCA6gwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsG
AQUFBwMCMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFOGJiaQgrzPfKJoMzMxcq6wp
ZPPkMB8GA1UdIwQYMBaAFP9/nIinRvdeboVtu6g6s7OBjNWiMCoGA1UdEQQjMCGC
GW9yZGVyZXIxLm9yZzEuZXhhbXBsZS5jb22HBMCoA4AwXAYIKgMEBQYHCAEEUHsi
YXR0cnMiOnsiaGYuQWZmaWxpYXRpb24iOiIiLCJoZi5FbnJvbGxtZW50SUQiOiJv
cmRlcmVyMSIsImhmLlR5cGUiOiJvcmRlcmVyIn19MAoGCCqGSM49BAMCA0gAMEUC
IQDupdU3UrDYL1zUuBhWWQ9H8uIdo9MfUvUOlzCZz8ZHDwIgKXTerdk4ZRiffTol
MgFtMrLA+uaqb05/xS0Ctu6p9gE=
-----END CERTIFICATE-----
 among [-----BEGIN CERTIFICATE-----
MIICwzCCAmmgAwIBAgIUDyHjRyRQAKRBmANka44MQqxhb5UwCgYIKoZIzj0EAwIw
cDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMQ8wDQYDVQQH
EwZEdXJoYW0xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMjMxMTAxMDMxMTAwWhcNMjQxMDMxMDMxNjAw
WjBhMQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGggQ2Fyb2xpbmExFDASBgNV
BAoTC0h5cGVybGVkZ2VyMRAwDgYDVQQLEwdvcmRlcmVyMREwDwYDVQQDEwhvcmRl
cmVyMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ/8BDSyIwgsGhBm707HfKPH
YXX386THlAsgrLpeX5hODg/WCT88iNg9LGXuIkDyKReeZrfOKxhvqU8ia0s3m92j
ge8wgewwDgYDVR0PAQH/BAQDAgOoMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEF
BQcDAjAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBQv/xyhe7uAZgQBaTMAbcYJ8Odq
WzAfBgNVHSMEGDAWgBT/f5yIp0b3Xm6FbbuoOrOzgYzVojAPBgNVHREECDAGhwTA
qAOAMFwGCCoDBAUGBwgBBFB7ImF0dHJzIjp7ImhmLkFmZmlsaWF0aW9uIjoiIiwi
aGYuRW5yb2xsbWVudElEIjoib3JkZXJlcjAiLCJoZi5UeXBlIjoib3JkZXJlciJ9
fTAKBggqhkjOPQQDAgNIADBFAiEA8lsW64U+m4h7J3f4LhvuoZK5wLAfhxmid5Sy
JBw/NucCIBgOpDoiRK9keWr3WxJf0hasAqCY2yR/PeZ0lGFnmlcn
-----END CERTIFICATE-----
]
2023-11-01 15:15:23.772 CST [orderer.common.onboarding] TrackChain -> INFO 032 Adding channel1 to the set of chains to track
2023-11-01 15:15:23.775 CST [orderer.consensus.etcdraft] HandleChain -> INFO 033 EvictionSuspicion not set, defaulting to 10m0s
2023-11-01 15:15:23.775 CST [orderer.consensus.etcdraft] createOrReadWAL -> INFO 034 No WAL data found, creating new WAL at path '/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/hyperledger/production/orderer/etcdraft/wal/system-channel' channel=system-channel node=2
2023-11-01 15:15:23.778 CST [orderer.commmon.multichannel] Initialize -> INFO 035 Starting system channel 'system-channel' with genesis block hash cf0eea12e3ad0e100746fab436a756f291a683dd76e17d4b63b1eb2ce40fe407 and orderer type etcdraft
2023-11-01 15:15:23.779 CST [orderer.consensus.etcdraft] Start -> INFO 036 Starting Raft node channel=system-channel node=2
2023-11-01 15:15:23.779 CST [orderer.common.cluster] Configure -> INFO 037 Entering, channel: system-channel, nodes: [ID: 1,
Endpoint: 192.168.3.128:7050,
ServerTLSCert:-----BEGIN CERTIFICATE-----
MIICwzCCAmmgAwIBAgIUDyHjRyRQAKRBmANka44MQqxhb5UwCgYIKoZIzj0EAwIw
cDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMQ8wDQYDVQQH
EwZEdXJoYW0xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMjMxMTAxMDMxMTAwWhcNMjQxMDMxMDMxNjAw
WjBhMQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGggQ2Fyb2xpbmExFDASBgNV
BAoTC0h5cGVybGVkZ2VyMRAwDgYDVQQLEwdvcmRlcmVyMREwDwYDVQQDEwhvcmRl
cmVyMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ/8BDSyIwgsGhBm707HfKPH
YXX386THlAsgrLpeX5hODg/WCT88iNg9LGXuIkDyKReeZrfOKxhvqU8ia0s3m92j
ge8wgewwDgYDVR0PAQH/BAQDAgOoMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEF
BQcDAjAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBQv/xyhe7uAZgQBaTMAbcYJ8Odq
WzAfBgNVHSMEGDAWgBT/f5yIp0b3Xm6FbbuoOrOzgYzVojAPBgNVHREECDAGhwTA
qAOAMFwGCCoDBAUGBwgBBFB7ImF0dHJzIjp7ImhmLkFmZmlsaWF0aW9uIjoiIiwi
aGYuRW5yb2xsbWVudElEIjoib3JkZXJlcjAiLCJoZi5UeXBlIjoib3JkZXJlciJ9
fTAKBggqhkjOPQQDAgNIADBFAiEA8lsW64U+m4h7J3f4LhvuoZK5wLAfhxmid5Sy
JBw/NucCIBgOpDoiRK9keWr3WxJf0hasAqCY2yR/PeZ0lGFnmlcn
-----END CERTIFICATE-----
, ClientTLSCert:-----BEGIN CERTIFICATE-----
MIICwzCCAmmgAwIBAgIUDyHjRyRQAKRBmANka44MQqxhb5UwCgYIKoZIzj0EAwIw
cDELMAkGA1UEBhMCVVMxFzAVBgNVBAgTDk5vcnRoIENhcm9saW5hMQ8wDQYDVQQH
EwZEdXJoYW0xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMjMxMTAxMDMxMTAwWhcNMjQxMDMxMDMxNjAw
WjBhMQswCQYDVQQGEwJVUzEXMBUGA1UECBMOTm9ydGggQ2Fyb2xpbmExFDASBgNV
BAoTC0h5cGVybGVkZ2VyMRAwDgYDVQQLEwdvcmRlcmVyMREwDwYDVQQDEwhvcmRl
cmVyMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ/8BDSyIwgsGhBm707HfKPH
YXX386THlAsgrLpeX5hODg/WCT88iNg9LGXuIkDyKReeZrfOKxhvqU8ia0s3m92j
ge8wgewwDgYDVR0PAQH/BAQDAgOoMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEF
BQcDAjAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBQv/xyhe7uAZgQBaTMAbcYJ8Odq
WzAfBgNVHSMEGDAWgBT/f5yIp0b3Xm6FbbuoOrOzgYzVojAPBgNVHREECDAGhwTA
qAOAMFwGCCoDBAUGBwgBBFB7ImF0dHJzIjp7ImhmLkFmZmlsaWF0aW9uIjoiIiwi
aGYuRW5yb2xsbWVudElEIjoib3JkZXJlcjAiLCJoZi5UeXBlIjoib3JkZXJlciJ9
fTAKBggqhkjOPQQDAgNIADBFAiEA8lsW64U+m4h7J3f4LhvuoZK5wLAfhxmid5Sy
JBw/NucCIBgOpDoiRK9keWr3WxJf0hasAqCY2yR/PeZ0lGFnmlcn
-----END CERTIFICATE-----
]
2023-11-01 15:15:23.779 CST [orderer.common.cluster] updateStubInMapping -> INFO 038 Allocating a new stub for node 1 with endpoint of 192.168.3.128:7050 for channel system-channel
2023-11-01 15:15:23.779 CST [orderer.common.cluster] updateStubInMapping -> INFO 039 Deactivating node 1 in channel system-channel with endpoint of 192.168.3.128:7050 due to TLS certificate change
2023-11-01 15:15:23.779 CST [orderer.common.cluster] applyMembershipConfig -> INFO 03a 1 exists in both old and new membership for channel system-channel , skipping its deactivation
2023-11-01 15:15:23.780 CST [orderer.common.cluster] Configure -> INFO 03b Exiting
2023-11-01 15:15:23.780 CST [orderer.consensus.etcdraft] start -> INFO 03c Starting raft node to join an existing channel channel=system-channel node=2
2023-11-01 15:15:23.780 CST [orderer.consensus.etcdraft] becomeFollower -> INFO 03d 2 became follower at term 0 channel=system-channel node=2
2023-11-01 15:15:23.780 CST [orderer.consensus.etcdraft] newRaft -> INFO 03e newRaft 2 [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0] channel=system-channel node=2
2023-11-01 15:15:23.780 CST [orderer.consensus.etcdraft] becomeFollower -> INFO 03f 2 became follower at term 1 channel=system-channel node=2
2023-11-01 15:15:23.780 CST [orderer.common.server] Main -> INFO 040 Starting orderer:
 Version: 2.2.0
 Commit SHA: 5ea85bc54
 Go version: go1.14.4
 OS/Arch: linux/amd64
2023-11-01 15:15:23.780 CST [orderer.common.server] Main -> INFO 041 Beginning to serve requests
2023-11-01 15:15:33.771 CST [orderer.common.onboarding] replicateDisabledChains -> INFO 042 Found 1 inactive chains: [channel1]
2023-11-01 15:15:33.771 CST [orderer.common.cluster] ReplicateChains -> INFO 043 Will now replicate chains [channel1]
2023-11-01 15:15:33.773 CST [orderer.common.cluster] discoverChannels -> INFO 044 Discovered 1 channels: [channel1]
2023-11-01 15:15:33.773 CST [orderer.common.cluster] channelsToPull -> INFO 045 Evaluating channels to pull: [channel1]
2023-11-01 15:15:33.773 CST [orderer.common.cluster] channelsToPull -> INFO 046 Probing whether I should pull channel channel1
2023-11-01 15:15:33.780 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 047 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:15:33.780 CST [orderer.common.cluster.replication] HeightsByEndpoints -> INFO 048 Returning the heights of OSNs mapped by endpoints map[192.168.3.128:7050:15] channel=system-channel
2023-11-01 15:15:33.787 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 049 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:15:33.787 CST [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 04a Connected to 192.168.3.128:7050 with last block seq of 14 channel=system-channel
2023-11-01 15:15:33.787 CST [orderer.common.cluster.replication] obtainStream -> INFO 04b Sending request for block [14] to 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:33.789 CST [orderer.common.cluster.replication] pullBlocks -> INFO 04c Got block [14] of size 5 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:33.793 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 04d 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:15:33.793 CST [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 04e Connected to 192.168.3.128:7050 with last block seq of 14 channel=system-channel
2023-11-01 15:15:33.793 CST [orderer.common.cluster.replication] obtainStream -> INFO 04f Sending request for block [8] to 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:33.795 CST [orderer.common.cluster.replication] pullBlocks -> INFO 050 Got block [8] of size 18 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:33.797 CST [orderer.common.cluster] channelsToPull -> INFO 051 I do not belong to channel channel1 or am forbidden pulling it (not in the channel), skipping chain retrieval
2023-11-01 15:15:33.797 CST [orderer.common.cluster] ReplicateChains -> INFO 052 Found myself in 0 channels out of 1 : {[] [{channel1 0xc000616080}]}
2023-11-01 15:15:33.797 CST [orderer.common.cluster] appendBlock -> INFO 053 Skipping commit of block [0] for channel channel1 because height is at 1
2023-11-01 15:15:33.797 CST [orderer.common.cluster] PullChannel -> INFO 054 Channel system-channel shouldn't be pulled. Skipping it
2023-11-01 15:15:33.797 CST [orderer.common.onboarding] replicateDisabledChains -> INFO 055 Successfully replicated 0 chains: []
2023-11-01 15:15:53.772 CST [orderer.common.onboarding] replicateDisabledChains -> INFO 056 Found 1 inactive chains: [channel1]
2023-11-01 15:15:53.772 CST [orderer.common.cluster] ReplicateChains -> INFO 057 Will now replicate chains [channel1]
2023-11-01 15:15:53.773 CST [orderer.common.cluster] discoverChannels -> INFO 058 Discovered 1 channels: [channel1]
2023-11-01 15:15:53.773 CST [orderer.common.cluster] channelsToPull -> INFO 059 Evaluating channels to pull: [channel1]
2023-11-01 15:15:53.773 CST [orderer.common.cluster] channelsToPull -> INFO 05a Probing whether I should pull channel channel1
2023-11-01 15:15:53.776 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 05b 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:15:53.776 CST [orderer.common.cluster.replication] HeightsByEndpoints -> INFO 05c Returning the heights of OSNs mapped by endpoints map[192.168.3.128:7050:15] channel=system-channel
2023-11-01 15:15:53.780 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 05d 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:15:53.780 CST [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 05e Connected to 192.168.3.128:7050 with last block seq of 14 channel=system-channel
2023-11-01 15:15:53.780 CST [orderer.common.cluster.replication] obtainStream -> INFO 05f Sending request for block [14] to 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:53.781 CST [orderer.common.cluster.replication] pullBlocks -> INFO 060 Got block [14] of size 5 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:53.785 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 061 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:15:53.785 CST [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 062 Connected to 192.168.3.128:7050 with last block seq of 14 channel=system-channel
2023-11-01 15:15:53.785 CST [orderer.common.cluster.replication] obtainStream -> INFO 063 Sending request for block [8] to 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:53.786 CST [orderer.common.cluster.replication] pullBlocks -> INFO 064 Got block [8] of size 18 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:15:53.787 CST [orderer.common.cluster] channelsToPull -> INFO 065 I do not belong to channel channel1 or am forbidden pulling it (not in the channel), skipping chain retrieval
2023-11-01 15:15:53.787 CST [orderer.common.cluster] ReplicateChains -> INFO 066 Found myself in 0 channels out of 1 : {[] [{channel1 0xc000616080}]}
2023-11-01 15:15:53.787 CST [orderer.common.cluster] appendBlock -> INFO 067 Skipping commit of block [0] for channel channel1 because height is at 1
2023-11-01 15:15:53.787 CST [orderer.common.cluster] PullChannel -> INFO 068 Channel system-channel shouldn't be pulled. Skipping it
2023-11-01 15:15:53.787 CST [orderer.common.onboarding] replicateDisabledChains -> INFO 069 Successfully replicated 0 chains: []
2023-11-01 15:16:33.772 CST [orderer.common.onboarding] replicateDisabledChains -> INFO 06a Found 1 inactive chains: [channel1]
2023-11-01 15:16:33.772 CST [orderer.common.cluster] ReplicateChains -> INFO 06b Will now replicate chains [channel1]
2023-11-01 15:16:33.774 CST [orderer.common.cluster] discoverChannels -> INFO 06c Discovered 1 channels: [channel1]
2023-11-01 15:16:33.774 CST [orderer.common.cluster] channelsToPull -> INFO 06d Evaluating channels to pull: [channel1]
2023-11-01 15:16:33.774 CST [orderer.common.cluster] channelsToPull -> INFO 06e Probing whether I should pull channel channel1
2023-11-01 15:16:33.777 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 06f 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:16:33.777 CST [orderer.common.cluster.replication] HeightsByEndpoints -> INFO 070 Returning the heights of OSNs mapped by endpoints map[192.168.3.128:7050:15] channel=system-channel
2023-11-01 15:16:33.780 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 071 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:16:33.780 CST [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 072 Connected to 192.168.3.128:7050 with last block seq of 14 channel=system-channel
2023-11-01 15:16:33.780 CST [orderer.common.cluster.replication] obtainStream -> INFO 073 Sending request for block [14] to 192.168.3.128:7050 channel=system-channel
2023-11-01 15:16:33.781 CST [orderer.common.cluster.replication] pullBlocks -> INFO 074 Got block [14] of size 5 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:16:33.786 CST [orderer.common.cluster.replication] fetchLastBlockSeq -> INFO 075 192.168.3.128:7050 is at block sequence of 14 channel=system-channel
2023-11-01 15:16:33.786 CST [orderer.common.cluster.replication] connectToSomeEndpoint -> INFO 076 Connected to 192.168.3.128:7050 with last block seq of 14 channel=system-channel
2023-11-01 15:16:33.786 CST [orderer.common.cluster.replication] obtainStream -> INFO 077 Sending request for block [8] to 192.168.3.128:7050 channel=system-channel
2023-11-01 15:16:33.787 CST [orderer.common.cluster.replication] pullBlocks -> INFO 078 Got block [8] of size 18 KB from 192.168.3.128:7050 channel=system-channel
2023-11-01 15:16:33.789 CST [orderer.common.cluster] channelsToPull -> INFO 079 I do not belong to channel channel1 or am forbidden pulling it (not in the channel), skipping chain retrieval
2023-11-01 15:16:33.790 CST [orderer.common.cluster] ReplicateChains -> INFO 07a Found myself in 0 channels out of 1 : {[] [{channel1 0xc000616080}]}
2023-11-01 15:16:33.790 CST [orderer.common.cluster] appendBlock -> INFO 07b Skipping commit of block [0] for channel channel1 because height is at 1
2023-11-01 15:16:33.790 CST [orderer.common.cluster] PullChannel -> INFO 07c Channel system-channel shouldn't be pulled. Skipping it
2023-11-01 15:16:33.790 CST [orderer.common.onboarding] replicateDisabledChains -> INFO 07d Successfully replicated 0 chains: []
2023-11-01 15:17:22.793 CST [orderer.consensus.etcdraft] Step -> INFO 07e 2 [logterm: 0, index: 0, vote: 0] cast MsgPreVote for 1 [logterm: 2, index: 5] at term 1 channel=system-channel node=2
2023-11-01 15:17:22.794 CST [orderer.consensus.etcdraft] Step -> INFO 07f 2 [term: 1] received a MsgVote message with higher term from 1 [term: 3] channel=system-channel node=2
2023-11-01 15:17:22.794 CST [orderer.consensus.etcdraft] becomeFollower -> INFO 080 2 became follower at term 3 channel=system-channel node=2
2023-11-01 15:17:22.794 CST [orderer.consensus.etcdraft] Step -> INFO 081 2 [logterm: 0, index: 0, vote: 0] cast MsgVote for 1 [logterm: 2, index: 5] at term 3 channel=system-channel node=2
2023-11-01 15:17:22.796 CST [orderer.consensus.etcdraft] run -> INFO 082 raft.node: 2 elected leader 1 at term 3 channel=system-channel node=2
2023-11-01 15:17:22.797 CST [orderer.consensus.etcdraft] run -> INFO 083 Raft leader changed: 0 -> 1 channel=system-channel node=2
2023-11-01 15:17:22.801 CST [orderer.consensus.etcdraft] apply -> INFO 084 Applied config change to add node 1, current nodes in channel: [1] channel=system-channel node=2
2023-11-01 15:17:22.801 CST [orderer.consensus.etcdraft] writeBlock -> INFO 085 Got block [2], expect block [3], this node was forced to catch up channel=system-channel node=2
2023-11-01 15:17:22.801 CST [orderer.consensus.etcdraft] apply -> INFO 086 Applied config change to add node 2, current nodes in channel: [1 2] channel=system-channel node=2

注意到此时已经有应用通道channel1的目录:

/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/hyperledger/production/orderer/chains/
├── channel1
│   └── blockfile_000000
└── system-channel
    └── blockfile_000000

2 directories, 2 files

五、添加orderer1的endpoint到系统通道

配置环境变量,下面需要使用orderer0节点的身份信息:

export CORE_PEER_LOCALMSPID="OrdererOrg1MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem
export CORE_PEER_MSPCONFIGPATH=/home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/users/Admin@org1.example.com/msp

获取最新的系统通道配置:

peer channel fetch config /home/songzehao/fabric/config/channel-artifacts/config_block_v4.pb -o 192.168.3.128:7050 -c system-channel --tls --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

日志:

2023-11-01 15:21:47.259 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-11-01 15:21:47.260 CST [cli.common] readBlock -> INFO 002 Received block: 2
2023-11-01 15:21:47.260 CST [channelCmd] fetch -> INFO 003 Retrieving last config block: 2
2023-11-01 15:21:47.262 CST [cli.common] readBlock -> INFO 004 Received block: 2

将系统通道配置转为json格式:

configtxlator proto_decode --input /home/songzehao/fabric/config/channel-artifacts/config_block_v4.pb --type common.Block | jq .data.data[0].payload.data.config > /home/songzehao/fabric/config/channel-artifacts/config_v4.json

追加orderer1的endpoint到排序节点地址列表:

jq '.channel_group.values.OrdererAddresses.value.addresses += ["192.168.3.128:7057"]' /home/songzehao/fabric/config/channel-artifacts/config_v4.json > /home/songzehao/fabric/config/channel-artifacts/modified_config_v4.json

原配置转化为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/config_v4.json --type common.Config --output /home/songzehao/fabric/config/channel-artifacts/config_v4.pb

更改后的配置转化为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/modified_config_v4.json --type common.Config --output /home/songzehao/fabric/config/channel-artifacts/modified_config_v4.pb

计算更新配置pb:

configtxlator compute_update --channel_id system-channel --original /home/songzehao/fabric/config/channel-artifacts/config_v4.pb --updated /home/songzehao/fabric/config/channel-artifacts/modified_config_v4.pb --output /home/songzehao/fabric/config/channel-artifacts/config_update_v4.pb

更新配置转化为json格式:

configtxlator proto_decode --input /home/songzehao/fabric/config/channel-artifacts/config_update_v4.pb --type common.ConfigUpdate --output /home/songzehao/fabric/config/channel-artifacts/config_update_v4.json

包装更新配置文件:

echo '{"payload":{"header":{"channel_header":{"channel_id":"system-channel", "type":2}},"data":{"config_update":'$(cat /home/songzehao/fabric/config/channel-artifacts/config_update_v4.json)'}}}' | jq . > /home/songzehao/fabric/config/channel-artifacts/config_update_v4_in_envelope.json

再次转为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/config_update_v4_in_envelope.json --type common.Envelope --output /home/songzehao/fabric/config/channel-artifacts/config_update_v4_in_envelope.pb

提交配置更新:

peer channel update -f /home/songzehao/fabric/config/channel-artifacts/config_update_v4_in_envelope.pb -c system-channel -o 192.168.3.128:7050 --tls true --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

日志:

2023-11-01 15:23:45.634 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-11-01 15:23:45.641 CST [channelCmd] update -> INFO 002 Successfully submitted channel update

六、添加orderer1的tls到应用通道

获取应用通道的最新配置:

peer channel fetch config /home/songzehao/fabric/config/channel-artifacts/config_block_v5.pb -o 192.168.3.128:7050 -c channel1 --tls --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

日志:

2023-11-01 15:24:03.635 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-11-01 15:24:03.639 CST [cli.common] readBlock -> INFO 002 Received block: 14
2023-11-01 15:24:03.639 CST [channelCmd] fetch -> INFO 003 Retrieving last config block: 8
2023-11-01 15:24:03.641 CST [cli.common] readBlock -> INFO 004 Received block: 8

将应用通道配置转为json格式:

configtxlator proto_decode --input /home/songzehao/fabric/config/channel-artifacts/config_block_v5.pb --type common.Block | jq .data.data[0].payload.data.config > /home/songzehao/fabric/config/channel-artifacts/config_v5.json

抽取orderer1的endpoint和tls证书内容:

echo '{"client_tls_cert":"'$(cat /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.crt | base64 -w 0)'","host":"192.168.3.128","port":7057,"server_tls_cert":"'$(cat /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/tls/server.crt | base64 -w 0)'"}' > /home/songzehao/fabric/config/channel-artifacts/org1consenter_v5.json

将其追加到json配置中:

jq --argfile consenterFile /home/songzehao/fabric/config/channel-artifacts/org1consenter_v5.json '.channel_group.groups.Orderer.values.ConsensusType.value.metadata.consenters += [$consenterFile]' /home/songzehao/fabric/config/channel-artifacts/config_v5.json > /home/songzehao/fabric/config/channel-artifacts/modified_config_v5.json

原配置转化为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/config_v5.json --type common.Config --output /home/songzehao/fabric/config/channel-artifacts/config_v5.pb

更改后的配置转化为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/modified_config_v5.json --type common.Config --output /home/songzehao/fabric/config/channel-artifacts/modified_config_v5.pb

计算更新配置pb:

configtxlator compute_update --channel_id channel1 --original /home/songzehao/fabric/config/channel-artifacts/config_v5.pb --updated /home/songzehao/fabric/config/channel-artifacts/modified_config_v5.pb --output /home/songzehao/fabric/config/channel-artifacts/config_update_v5.pb

更新配置转化为json格式:

configtxlator proto_decode --input /home/songzehao/fabric/config/channel-artifacts/config_update_v5.pb --type common.ConfigUpdate --output /home/songzehao/fabric/config/channel-artifacts/config_update_v5.json

包装更新配置文件:

echo '{"payload":{"header":{"channel_header":{"channel_id":"channel1", "type":2}},"data":{"config_update":'$(cat /home/songzehao/fabric/config/channel-artifacts/config_update_v5.json)'}}}' | jq . > /home/songzehao/fabric/config/channel-artifacts/config_update_v5_in_envelope.json

再次转为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/config_update_v5_in_envelope.json --type common.Envelope --output /home/songzehao/fabric/config/channel-artifacts/config_update_v5_in_envelope.pb

提交配置更新:

peer channel update -f /home/songzehao/fabric/config/channel-artifacts/config_update_v5_in_envelope.pb -c channel1 -o 192.168.3.128:7050 --tls true --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

日志:

2023-11-01 15:25:52.446 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-11-01 15:25:52.455 CST [channelCmd] update -> INFO 002 Successfully submitted channel update

七、添加orderer1的endpoint到应用通道

获取应用通道的最新配置:

peer channel fetch config /home/songzehao/fabric/config/channel-artifacts/config_block_v6.pb -o 192.168.3.128:7050 -c channel1 --tls --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

日志:

2023-11-01 15:26:15.084 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-11-01 15:26:15.086 CST [cli.common] readBlock -> INFO 002 Received block: 15
2023-11-01 15:26:15.086 CST [channelCmd] fetch -> INFO 003 Retrieving last config block: 15
2023-11-01 15:26:15.087 CST [cli.common] readBlock -> INFO 004 Received block: 15

将应用通道配置转为json格式:

configtxlator proto_decode --input /home/songzehao/fabric/config/channel-artifacts/config_block_v6.pb --type common.Block | jq .data.data[0].payload.data.config > /home/songzehao/fabric/config/channel-artifacts/config_v6.json

追加orderer1的endpoint到排序节点地址列表:

jq '.channel_group.values.OrdererAddresses.value.addresses += ["192.168.3.128:7057"]' /home/songzehao/fabric/config/channel-artifacts/config_v6.json > /home/songzehao/fabric/config/channel-artifacts/modified_config_v6.json

原配置转化为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/config_v6.json --type common.Config --output /home/songzehao/fabric/config/channel-artifacts/config_v6.pb

更改后的配置转化为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/modified_config_v6.json --type common.Config --output /home/songzehao/fabric/config/channel-artifacts/modified_config_v6.pb

计算更新配置pb:

configtxlator compute_update --channel_id channel1 --original /home/songzehao/fabric/config/channel-artifacts/config_v6.pb --updated /home/songzehao/fabric/config/channel-artifacts/modified_config_v6.pb --output /home/songzehao/fabric/config/channel-artifacts/config_update_v6.pb

更新配置转化为json格式:

configtxlator proto_decode --input /home/songzehao/fabric/config/channel-artifacts/config_update_v6.pb --type common.ConfigUpdate --output /home/songzehao/fabric/config/channel-artifacts/config_update_v6.json

包装更新配置文件:

echo '{"payload":{"header":{"channel_header":{"channel_id":"channel1", "type":2}},"data":{"config_update":'$(cat /home/songzehao/fabric/config/channel-artifacts/config_update_v6.json)'}}}' | jq . > /home/songzehao/fabric/config/channel-artifacts/config_update_v6_in_envelope.json

再次转为pb:

configtxlator proto_encode --input /home/songzehao/fabric/config/channel-artifacts/config_update_v6_in_envelope.json --type common.Envelope --output /home/songzehao/fabric/config/channel-artifacts/config_update_v6_in_envelope.pb

提交配置更新:

peer channel update -f /home/songzehao/fabric/config/channel-artifacts/config_update_v6_in_envelope.pb -c channel1 -o 192.168.3.128:7050 --tls true --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer0.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem

日志:

2023-11-01 15:30:51.973 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2023-11-01 15:30:51.982 CST [channelCmd] update -> INFO 002 Successfully submitted channel update

**注意:**根据官方文档(https://hyperledger-fabric.readthedocs.io/en/release-2.2/raft_configuration.html?highlight=five minutes#reconfiguration)说明,可能需要等待默认的5min,要么需要重启节点,才能保证检测到新通道:

It is possible to add a node that is already running (and participates in some channels already) to a channel while the node itself is running. To do this, simply add the node's certificate to the channel config of the channel. The node will autonomously detect its addition to the new channel (the default value here is five minutes, but if you want the node to detect the new channel more quickly, reboot the node) and will pull the channel blocks from an orderer in the channel, and then start the Raft instance for that chain.

八、请求orderer1发交易

配置环境变量,连接peer0或者peer1节点,这里举例连接peer0:

export FABRIC_CA_CLIENT_HOME=/home/songzehao/fabric/fabric-ca-client
export PATH=/home/songzehao/fabric/bin:$PATH
export FABRIC_CFG_PATH=/home/songzehao/fabric/config
#export FABRIC_LOGGING_SPEC=DEBUG

export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_LOCALMSPID="Org1MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=/home/songzehao/fabric/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export CORE_PEER_MSPCONFIGPATH=/home/songzehao/fabric/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
export CORE_PEER_ADDRESS="192.168.3.128:7051"
export CORE_PEER_GOSSIP_EXTERNALENDPOINT="192.168.3.128:7051"

请求orderer1来查询:

peer chaincode invoke -o 192.168.3.128:7057 -C channel1 -n basic --peerAddresses 192.168.3.128:7051 --tlsRootCertFiles /home/songzehao/fabric/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --tls --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem -c '{"function":"GetAllAssets","Args":[]}'

日志:

2023-11-01 15:46:58.733 CST [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 payload:"[{\"appraisedValue\":300,\"assetID\":\"asset1\",\"color\":\"blue\",\"owner\":\"Tomoko\",\"size\":5},{\"appraisedValue\":400,\"assetID\":\"asset2\",\"color\":\"red\",\"owner\":\"Brad\",\"size\":5},{\"appraisedValue\":500,\"assetID\":\"asset3\",\"color\":\"green\",\"owner\":\"Jin Soo\",\"size\":10},{\"appraisedValue\":600,\"assetID\":\"asset4\",\"color\":\"yellow\",\"owner\":\"Max\",\"size\":10},{\"appraisedValue\":700,\"assetID\":\"asset5\",\"color\":\"black\",\"owner\":\"Adrian\",\"size\":15},{\"appraisedValue\":700,\"assetID\":\"asset6\",\"color\":\"white\",\"owner\":\"Michel\",\"size\":15},{\"appraisedValue\":800,\"assetID\":\"asset7\",\"color\":\"pink\",\"owner\":\"Jay\",\"size\":18},{\"appraisedValue\":127,\"assetID\":\"asset8\",\"color\":\"gold\",\"owner\":\"Song\",\"size\":27}]"

请求orderer1来发交易:

peer chaincode invoke -o 192.168.3.128:7057 -C channel1 -n basic --peerAddresses 192.168.3.128:7051 --tlsRootCertFiles /home/songzehao/fabric/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --tls --cafile /home/songzehao/fabric/organizations/ordererOrganizations/org1.example.com/orderers/orderer1.org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem -c '{"function":"CreateAsset","Args":["asset9", "silver", "28", "Foo", "700"]}'

日志:

2023-11-01 15:54:17.814 CST [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 payload:"{\"owner\":\"Foo\",\"color\":\"silver\",\"size\":28,\"appraisedValue\":700,\"assetID\":\"asset9\"}"
相关推荐
SunsPlanter9 小时前
02 ETH
区块链
yunteng52116 小时前
零知识证明-ZK-SNARKs基础(七)
区块链·零知识证明·zk-snarks·ricp·qap
山师第一深情18 小时前
solidity-19-fallback
区块链
zhuqiyua18 小时前
TVM和EVM的比较
区块链·智能合约·ton
sino_sound18 小时前
伦敦金的交易差价意味着什么?
人工智能·金融·区块链
黑色叉腰丶大魔王1 天前
什么是区块链,以及应用场景
去中心化·区块链·分布式账本
qiquandong1 天前
场外期权或成暴利工具?!应该怎么做场外期权?
区块链
链科天下1 天前
全球国家比特币持有量排名!各国政府合谋能否推翻比特币?数字货币的时代已经来临!
区块链
电报号dapp1191 天前
TON基金会与Curve Finance合作:推出基于TON的新型稳定币互换项目
区块链
BeepCrypto2 天前
Base 社区见面会 | 新加坡站
区块链