创建具有多个组织

时间:2018-02-21 07:12:49

标签: hyperledger-fabric hyperledger

我使用Hyperledger结构来创建区块链网络。我试用了一个同行,单个订货人等教程。它工作正常。但我需要建立一个这样的网络:enter image description here

即有多个组织。至少2个组织。我如何指定crypto-config.yaml,configtx.yaml等。 现在我像这样使用:

加密config.yaml

    OrdererOrgs:
      - Name: Orderer1
        Domain: healthcare1.com
        Specs:
          - Hostname: orderer1
      - Name: Orderer2
        Domain: healthcare2.com
        Specs:
          - Hostname: orderer2

configtx.yaml

配置文件:

TwoOrgsOrdererGenesis:
    Orderer:
        <<: *OrdererDefaults
        Organizations:
            - *Orderer1
            - *Orderer2
    Consortiums:
        SampleConsortium:
            Organizations:
                - *Hospital1
                - *Hospital2
TwoOrgsChannel:
    Consortium: SampleConsortium
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Hospital1
            - *Hospital2
Organizations:
# SampleOrg defines an MSP using the sampleconfig.  It should never be used
# in production but may be used as a template for other definitions
- &Orderer1
    # DefaultOrg defines the organization which is used in the sampleconfig
    # of the fabric.git development environment
    Name: Orderer1

    # ID to load the MSP definition as
    ID: Orderer1MSP

    # MSPDir is the filesystem path which contains the MSP configuration
    MSPDir: crypto-config/ordererOrganizations/healthcare1.com/msp

- &Orderer2
        # DefaultOrg defines the organization which is used in the sampleconfig
        # of the fabric.git development environment
        Name: Orderer2

        # ID to load the MSP definition as
        ID: Orderer2MSP

        # MSPDir is the filesystem path which contains the MSP configuration
        MSPDir: crypto-config/ordererOrganizations/healthcare2.com/msp

- &Hospital1
    # DefaultOrg defines the organization which is used in the sampleconfig
    # of the fabric.git development environment
    Name: Hospital1MSP

    # ID to load the MSP definition as
    ID: Hospital1MSP

    MSPDir: crypto-config/peerOrganizations/hospital1.healthcare1.com/msp

    AnchorPeers:
        # AnchorPeers defines the location of peers which can be used
        # for cross org gossip communication.  Note, this value is only
        # encoded in the genesis block in the Application section context
        - Host: peer0.hospital1.healthcare1.com
          Port: 7051

- &Hospital2
        # DefaultOrg defines the organization which is used in the sampleconfig
        # of the fabric.git development environment
        Name: Hospital2MSP

        # ID to load the MSP definition as
        ID: Hospital2MSP

        MSPDir: crypto-config/peerOrganizations/hospital2.healthcare2.com/msp

        AnchorPeers:
            # AnchorPeers defines the location of peers which can be used
            # for cross org gossip communication.  Note, this value is only
            # encoded in the genesis block in the Application section context
            - Host: peer0.hospital2.healthcare2.com
              Port: 7051
Orderer: &OrdererDefaults
# Orderer Type: The orderer implementation to start
# Available types are "solo" and "kafka"
OrdererType: solo

Addresses:
    - orderer1.healthcare1.com:7050
    - orderer2.healthcare2.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: 99 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

Kafka:
    # Brokers: A list of Kafka brokers to which the orderer connects
    # NOTE: Use IP:port notation
    Brokers:
        - 127.0.0.1:9092

# Organizations is the list of orgs which are defined as participants on
# the orderer side of the network
Organizations:

但我被困在docker-compose.yaml文件中。我还需要知道我是否正确的方式或上述文件中是否有任何错误。

非常感谢官方文档以外的任何其他链接。

1 个答案:

答案 0 :(得分:0)

AFAIK,目前无法在多个组织中分发订购者。至少不使用需要作为单个订货人节点的solo订货人;也不是kafka orderer系统,它取决于单个Kafka集群。

多组织订购可能需要等到BFT订购解决方案可用。