Hyperledger Fabric 1.4.6网络搭建实例(raft)

Hyperledger Fabric 1.4.6网络搭建实例(raft)

近期在帮其他部门搭建fabric测试网络,采用1.4.1的配置文件、1.4.6的核心模块,在创建通道的时候爆出了以下错误:

Error: got unexpected status: BAD_REQUEST -- error validating channel creation transaction for new channel 'mychannel', could not succesfully apply update to template configuration: error authorizing update: error validating DeltaSet: policy for [Group]  /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied

在网上查询的时候,很多帖子说是历史数据没有清理干净,但是我可以保证我的历史数据绝对是清理干净了。
但是,当我把bin目录下的核心模块换回1.4.1时,就没有这个问题,因此,错误的原因可以确定为版本问题,即1.4.6修改了某些功能和策略.
于是开始研读fabric1.4.1之后的版本文档,发现在1.4.3的时候进行了以下更新
在这里插入图片描述
可以确定,在configtx.yaml文件的Capabilities模块的配置发生了变化,而Capabilities功能模块定义了fabric二进制核心模块必须提供的特性。

经过修改,搭建起fabric1.4.6区块链网络实例,此实例采用raft共识机制。

本实例采用java chaincode ,从本地加载依赖。部署过程没有做特别详细的说明,建议有一定fabric基础的同学食用,基础较薄弱的同学可百度博客园博主灵龙,他写的fabric入门博客十分详细,可读性很高。

由于家境贫寒,笔记本内存只有8G,所以只有三台虚拟机,部署策略如下:

1192.168.43.167 orderer0 peer0org1 peer1org2 2192.168.43.91 orderer1 peer1org1 3192.168.43.241 orderer2 peer0org2

配置文件

各虚拟机配置文件如下:

192.168.43.167

configtx.yaml

1# Copyright IBM Corp. All Rights Reserved. 2# 3# SPDX-License-Identifier: Apache-2.0 4# 5 6--- 7################################################################################ 8# 9# Section: Organizations 10# 11# - This section defines the different organizational identities which will 12# be referenced later in the configuration. 13# 14################################################################################ 15Organizations: 16 17 # SampleOrg defines an MSP using the sampleconfig. It should never be used 18 # in production but may be used as a template for other definitions 19 - &OrdererOrg 20 # DefaultOrg defines the organization which is used in the sampleconfig 21 # of the fabric.git development environment 22 Name: OrdererOrg 23 24 # ID to load the MSP definition as 25 ID: OrdererMSP 26 27 # MSPDir is the filesystem path which contains the MSP configuration 28 MSPDir: crypto-config/ordererOrganizations/example.com/msp 29 30 # Policies defines the set of policies at this level of the config tree 31 # For organization policies, their canonical path is usually 32 # /Channel/<Application|Orderer>/<OrgName>/<PolicyName> 33 Policies: 34 Readers: 35 Type: Signature 36 Rule: "OR('OrdererMSP.member')" 37 Writers: 38 Type: Signature 39 Rule: "OR('OrdererMSP.member')" 40 Admins: 41 Type: Signature 42 Rule: "OR('OrdererMSP.admin')" 43 44 - &Org1 45 # DefaultOrg defines the organization which is used in the sampleconfig 46 # of the fabric.git development environment 47 Name: Org1MSP 48 49 # ID to load the MSP definition as 50 ID: Org1MSP 51 52 MSPDir: crypto-config/peerOrganizations/org1.example.com/msp 53 54 # Policies defines the set of policies at this level of the config tree 55 # For organization policies, their canonical path is usually 56 # /Channel/<Application|Orderer>/<OrgName>/<PolicyName> 57 Policies: 58 Readers: 59 Type: Signature 60 Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')" 61 Writers: 62 Type: Signature 63 Rule: "OR('Org1MSP.admin', 'Org1MSP.client')" 64 Admins: 65 Type: Signature 66 Rule: "OR('Org1MSP.admin')" 67 68 # leave this flag set to true. 69 AnchorPeers: 70 # AnchorPeers defines the location of peers which can be used 71 # for cross org gossip communication. Note, this value is only 72 # encoded in the genesis block in the Application section context 73 - Host: peer0.org1.example.com 74 Port: 7051 75 76 - &Org2 77 # DefaultOrg defines the organization which is used in the sampleconfig 78 # of the fabric.git development environment 79 Name: Org2MSP 80 81 # ID to load the MSP definition as 82 ID: Org2MSP 83 84 MSPDir: crypto-config/peerOrganizations/org2.example.com/msp 85 86 # Policies defines the set of policies at this level of the config tree 87 # For organization policies, their canonical path is usually 88 # /Channel/<Application|Orderer>/<OrgName>/<PolicyName> 89 Policies: 90 Readers: 91 Type: Signature 92 Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')" 93 Writers: 94 Type: Signature 95 Rule: "OR('Org2MSP.admin', 'Org2MSP.client')" 96 Admins: 97 Type: Signature 98 Rule: "OR('Org2MSP.admin')" 99 100 AnchorPeers: 101 # AnchorPeers defines the location of peers which can be used 102 # for cross org gossip communication. Note, this value is only 103 # encoded in the genesis block in the Application section context 104 - Host: peer0.org2.example.com 105 Port: 7051 106 107################################################################################ 108# 109# SECTION: Capabilities 110# 111# - This section defines the capabilities of fabric network. This is a new 112# concept as of v1.1.0 and should not be utilized in mixed networks with 113# v1.0.x peers and orderers. Capabilities define features which must be 114# present in a fabric binary for that binary to safely participate in the 115# fabric network. For instance, if a new MSP type is added, newer binaries 116# might recognize and validate the signatures from this type, while older 117# binaries without this support would be unable to validate those 118# transactions. This could lead to different versions of the fabric binaries 119# having different world states. Instead, defining a capability for a channel 120# informs those binaries without this capability that they must cease 121# processing transactions until they have been upgraded. For v1.0.x if any 122# capabilities are defined (including a map with all capabilities turned off) 123# then the v1.0.x peer will deliberately crash. 124# 125################################################################################ 126Capabilities: 127 # Channel capabilities apply to both the orderers and the peers and must be 128 # supported by both. 129 # Set the value of the capability to true to require it. 130 Channel: &ChannelCapabilities 131 # V1.4.3 for Channel is a catchall flag for behavior which has been 132 # determined to be desired for all orderers and peers running at the v1.4.3 133 # level, but which would be incompatible with orderers and peers from 134 # prior releases. 135 # Prior to enabling V1.4.3 channel capabilities, ensure that all 136 # orderers and peers on a channel are at v1.4.3 or later. 137 V1_4_3: true 138 # V1.3 for Channel enables the new non-backwards compatible 139 # features and fixes of fabric v1.3 140 V1_3: false 141 # V1.1 for Channel enables the new non-backwards compatible 142 # features and fixes of fabric v1.1 143 V1_1: false 144 145 # Orderer capabilities apply only to the orderers, and may be safely 146 # used with prior release peers. 147 # Set the value of the capability to true to require it. 148 Orderer: &OrdererCapabilities 149 # V1.4.2 for Orderer is a catchall flag for behavior which has been 150 # determined to be desired for all orderers running at the v1.4.2 151 # level, but which would be incompatible with orderers from prior releases. 152 # Prior to enabling V1.4.2 orderer capabilities, ensure that all 153 # orderers on a channel are at v1.4.2 or later. 154 V1_4_2: true 155 # V1.1 for Orderer enables the new non-backwards compatible 156 # features and fixes of fabric v1.1 157 V1_1: false 158 159 # Application capabilities apply only to the peer network, and may be safely 160 # used with prior release orderers. 161 # Set the value of the capability to true to require it. 162 Application: &ApplicationCapabilities 163 # V1.4.2 for Application enables the new non-backwards compatible 164 # features and fixes of fabric v1.4.2. 165 V1_4_2: true 166 # V1.3 for Application enables the new non-backwards compatible 167 # features and fixes of fabric v1.3. 168 V1_3: false 169 # V1.2 for Application enables the new non-backwards compatible 170 # features and fixes of fabric v1.2 (note, this need not be set if 171 # later version capabilities are set) 172 V1_2: false 173 # V1.1 for Application enables the new non-backwards compatible 174 # features and fixes of fabric v1.1 (note, this need not be set if 175 # later version capabilities are set). 176 V1_1: false 177 178################################################################################ 179# 180# SECTION: Application 181# 182# - This section defines the values to encode into a config transaction or 183# genesis block for application related parameters 184# 185################################################################################ 186Application: &ApplicationDefaults 187 188 # Organizations is the list of orgs which are defined as participants on 189 # the application side of the network 190 Organizations: 191 192 # Policies defines the set of policies at this level of the config tree 193 # For Application policies, their canonical path is 194 # /Channel/Application/<PolicyName> 195 Policies: 196 Readers: 197 Type: ImplicitMeta 198 Rule: "ANY Readers" 199 Writers: 200 Type: ImplicitMeta 201 Rule: "ANY Writers" 202 Admins: 203 Type: ImplicitMeta 204 Rule: "MAJORITY Admins" 205 206 Capabilities: 207 <<: *ApplicationCapabilities 208################################################################################ 209# 210# SECTION: Orderer 211# 212# - This section defines the values to encode into a config transaction or 213# genesis block for orderer related parameters 214# 215################################################################################ 216Orderer: &OrdererDefaults 217 218 # Orderer Type: The orderer implementation to start 219 # Available types are "solo","kafka" and "etcdraft" 220 OrdererType: solo 221 222 Addresses: 223 - orderer0.example.com:7050 224 225 # Batch Timeout: The amount of time to wait before creating a batch 226 BatchTimeout: 2s 227 228 # Batch Size: Controls the number of messages batched into a block 229 BatchSize: 230 231 # Max Message Count: The maximum number of messages to permit in a batch 232 MaxMessageCount: 10 233 234 # Absolute Max Bytes: The absolute maximum number of bytes allowed for 235 # the serialized messages in a batch. 236 AbsoluteMaxBytes: 99 MB 237 238 # Preferred Max Bytes: The preferred maximum number of bytes allowed for 239 # the serialized messages in a batch. A message larger than the preferred 240 # max bytes will result in a batch larger than preferred max bytes. 241 PreferredMaxBytes: 512 KB 242 243 Kafka: 244 # Brokers: A list of Kafka brokers to which the orderer connects 245 # NOTE: Use IP:port notation 246 Brokers: 247 - 127.0.0.1:9092 248 249 # EtcdRaft defines configuration which must be set when the "etcdraft" 250 # orderertype is chosen. 251 EtcdRaft: 252 # The set of Raft replicas for this network. For the etcd/raft-based 253 # implementation, we expect every replica to also be an OSN. Therefore, 254 # a subset of the host:port items enumerated in this list should be 255 # replicated under the Orderer.Addresses key above. 256 Consenters: 257 - Host: orderer0.example.com 258 Port: 7050 259 ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/server.crt 260 ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/server.crt 261 - Host: orderer1.example.com 262 Port: 7050 263 ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt 264 ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt 265 - Host: orderer2.example.com 266 Port: 7050 267 ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt 268 ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt 269 #- Host: orderer3.example.com 270 #Port: 7050 271 #ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt 272 #ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt 273 #- Host: orderer4.example.com 274 #Port: 7050 275 #ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt 276 #ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt 277 278 # Organizations is the list of orgs which are defined as participants on 279 # the orderer side of the network 280 Organizations: 281 282 # Policies defines the set of policies at this level of the config tree 283 # For Orderer policies, their canonical path is 284 # /Channel/Orderer/<PolicyName> 285 Policies: 286 Readers: 287 Type: ImplicitMeta 288 Rule: "ANY Readers" 289 Writers: 290 Type: ImplicitMeta 291 Rule: "ANY Writers" 292 Admins: 293 Type: ImplicitMeta 294 Rule: "MAJORITY Admins" 295 # BlockValidation specifies what signatures must be included in the block 296 # from the orderer for the peer to validate it. 297 BlockValidation: 298 Type: ImplicitMeta 299 Rule: "ANY Writers" 300 301################################################################################ 302# 303# CHANNEL 304# 305# This section defines the values to encode into a config transaction or 306# genesis block for channel related parameters. 307# 308################################################################################ 309Channel: &ChannelDefaults 310 # Policies defines the set of policies at this level of the config tree 311 # For Channel policies, their canonical path is 312 # /Channel/<PolicyName> 313 Policies: 314 # Who may invoke the 'Deliver' API 315 Readers: 316 Type: ImplicitMeta 317 Rule: "ANY Readers" 318 # Who may invoke the 'Broadcast' API 319 Writers: 320 Type: ImplicitMeta 321 Rule: "ANY Writers" 322 # By default, who may modify elements at this config level 323 Admins: 324 Type: ImplicitMeta 325 Rule: "MAJORITY Admins" 326 327 # Capabilities describes the channel level capabilities, see the 328 # dedicated Capabilities section elsewhere in this file for a full 329 # description 330 Capabilities: 331 <<: *ChannelCapabilities 332 333################################################################################ 334# 335# Profile 336# 337# - Different configuration profiles may be encoded here to be specified 338# as parameters to the configtxgen tool 339# 340################################################################################ 341Profiles: 342 343 TwoOrgsOrdererGenesis: 344 <<: *ChannelDefaults 345 Orderer: 346 <<: *OrdererDefaults 347 Organizations: 348 - *OrdererOrg 349 Capabilities: 350 <<: *OrdererCapabilities 351 Consortiums: 352 SampleConsortium: 353 Organizations: 354 - *Org1 355 - *Org2 356 TwoOrgsChannel: 357 Consortium: SampleConsortium 358 <<: *ChannelDefaults 359 Application: 360 <<: *ApplicationDefaults 361 Organizations: 362 - *Org1 363 - *Org2 364 Capabilities: 365 <<: *ApplicationCapabilities 366 367 SampleDevModeKafka: 368 <<: *ChannelDefaults 369 Capabilities: 370 <<: *ChannelCapabilities 371 Orderer: 372 <<: *OrdererDefaults 373 OrdererType: kafka 374 Kafka: 375 Brokers: 376 - kafka.example.com:9092 377 378 Organizations: 379 - *OrdererOrg 380 Capabilities: 381 <<: *OrdererCapabilities 382 Application: 383 <<: *ApplicationDefaults 384 Organizations: 385 - <<: *OrdererOrg 386 Consortiums: 387 SampleConsortium: 388 Organizations: 389 - *Org1 390 - *Org2 391 392 SampleMultiNodeEtcdRaft: 393 <<: *ChannelDefaults 394 Capabilities: 395 <<: *ChannelCapabilities 396 Orderer: 397 <<: *OrdererDefaults 398 OrdererType: etcdraft 399 EtcdRaft: 400 Consenters: 401 - Host: orderer0.example.com 402 Port: 7050 403 ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/server.crt 404 ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/server.crt 405 - Host: orderer1.example.com 406 Port: 7050 407 ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt 408 ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/server.crt 409 - Host: orderer2.example.com 410 Port: 7050 411 ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt 412 ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt 413 #- Host: orderer3.example.com 414 #Port: 7050 415 #ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt 416 #ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt 417 #- Host: orderer4.example.com 418 #Port: 7050 419 #ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt 420 #ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt 421 Addresses: 422 - orderer0.example.com:7050 423 - orderer1.example.com:7050 424 - orderer2.example.com:7050 425 #- orderer3.example.com:7050 426 #- orderer4.example.com:7050 427 428 Organizations: 429 - *OrdererOrg 430 Capabilities: 431 <<: *OrdererCapabilities 432 Application: 433 <<: *ApplicationDefaults 434 Organizations: 435 - <<: *OrdererOrg 436 Consortiums: 437 SampleConsortium: 438 Organizations: 439 - *Org1 440 - *Org2

crypto-config.yaml

1# Copyright IBM Corp. All Rights Reserved. 2# 3# SPDX-License-Identifier: Apache-2.0 4# 5 6# --------------------------------------------------------------------------- 7# "OrdererOrgs" - Definition of organizations managing orderer nodes 8# --------------------------------------------------------------------------- 9OrdererOrgs: 10 # --------------------------------------------------------------------------- 11 # Orderer 12 # --------------------------------------------------------------------------- 13 - Name: Orderer 14 Domain: example.com 15 EnableNodeOUs: true 16 # --------------------------------------------------------------------------- 17 # "Specs" - See PeerOrgs below for complete description 18 # --------------------------------------------------------------------------- 19 Specs: 20 - Hostname: orderer0 21 - Hostname: orderer1 22 - Hostname: orderer2 23 #- Hostname: orderer3 24 #- Hostname: orderer4 25 26# --------------------------------------------------------------------------- 27# "PeerOrgs" - Definition of organizations managing peer nodes 28# --------------------------------------------------------------------------- 29PeerOrgs: 30 # --------------------------------------------------------------------------- 31 # Org1 32 # --------------------------------------------------------------------------- 33 - Name: Org1 34 Domain: org1.example.com 35 EnableNodeOUs: true 36 # --------------------------------------------------------------------------- 37 # "Specs" 38 # --------------------------------------------------------------------------- 39 # Uncomment this section to enable the explicit definition of hosts in your 40 # configuration. Most users will want to use Template, below 41 # 42 # Specs is an array of Spec entries. Each Spec entry consists of two fields: 43 # - Hostname: (Required) The desired hostname, sans the domain. 44 # - CommonName: (Optional) Specifies the template or explicit override for 45 # the CN. By default, this is the template: 46 # 47 # "{{.Hostname}}.{{.Domain}}" 48 # 49 # which obtains its values from the Spec.Hostname and 50 # Org.Domain, respectively. 51 # --------------------------------------------------------------------------- 52 # Specs: 53 # - Hostname: foo # implicitly "foo.org1.example.com" 54 # CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above 55 # - Hostname: bar 56 # - Hostname: baz 57 # --------------------------------------------------------------------------- 58 # "Template" 59 # --------------------------------------------------------------------------- 60 # Allows for the definition of 1 or more hosts that are created sequentially 61 # from a template. By default, this looks like "peer%d" from 0 to Count-1. 62 # You may override the number of nodes (Count), the starting index (Start) 63 # or the template used to construct the name (Hostname). 64 # 65 # Note: Template and Specs are not mutually exclusive. You may define both 66 # sections and the aggregate nodes will be created for you. Take care with 67 # name collisions 68 # --------------------------------------------------------------------------- 69 Template: 70 Count: 2 71 # Start: 5 72 # Hostname: {{.Prefix}}{{.Index}} # default 73 # --------------------------------------------------------------------------- 74 # "Users" 75 # --------------------------------------------------------------------------- 76 # Count: The number of user accounts _in addition_ to Admin 77 # --------------------------------------------------------------------------- 78 Users: 79 Count: 1 80 # --------------------------------------------------------------------------- 81 # Org2: See "Org1" for full specification 82 # --------------------------------------------------------------------------- 83 - Name: Org2 84 Domain: org2.example.com 85 EnableNodeOUs: true 86 Template: 87 Count: 2 88 Users: 89 Count: 1

orderer0.yaml

1version: '2' 2 3services: 4 orderer0.example.com: 5 container_name: orderer0.example.com 6 image: hyperledger/fabric-orderer 7 environment: 8 - FABRIC_LOGGING_SPEC=INFO 9 - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 10 - ORDERER_GENERAL_GENESISMETHOD=file 11 - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block 12 - ORDERER_GENERAL_LOCALMSPID=OrdererMSP 13 - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp 14 # enabled TLS 15 - ORDERER_GENERAL_TLS_ENABLED=true 16 - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key 17 - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt 18 - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] 19 - ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1 20 - ORDERER_KAFKA_VERBOSE=true 21 - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt 22 - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key 23 - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] 24 working_dir: /opt/gopath/src/github.com/hyperledger/fabric 25 command: orderer 26 volumes: 27 - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block 28 - ./crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp:/var/hyperledger/orderer/msp 29 - ./crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/:/var/hyperledger/orderer/tls 30 ports: 31 - 7050:7050 32 extra_hosts: 33 - "orderer0.example.com:192.168.43.167" 34 - "orderer1.example.com:192.168.43.91" 35 - "orderer2.example.com:192.168.43.241"

peer0org1.yaml

1version: '2' 2 3services: 4 couchdb0: 5 image: hyperledger/fabric-couchdb 6 container_name: couchdb0 7 environment: 8 - COUCHDB_USER=admin 9 - COUCHDB_PASSWORD=123456 10 ports: 11 - 5984:5984 12 13 peer0.org1.example.com: 14 image: hyperledger/fabric-peer 15 container_name: peer0.org1.example.com 16 environment: 17 - CORE_PEER_ID=peer0.org1.example.com 18 - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 19 - CORE_PEER_LISTENADDRESS=0.0.0.0:7051 20 - CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052 21 - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052 22 #- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:8051 23 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 24 - CORE_PEER_LOCALMSPID=Org1MSP 25 - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock 26 # the following setting starts chaincode containers on the same 27 # bridge network as the peers 28 # https://docs.docker.com/compose/networking/ 29 - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=raft-cluster_default 30 - FABRIC_LOGGING_SPEC=INFO 31 #- FABRIC_LOGGING_SPEC=DEBUG 32 - CORE_PEER_TLS_ENABLED=true 33 - CORE_PEER_GOSSIP_USELEADERELECTION=true 34 - CORE_PEER_GOSSIP_ORGLEADER=false 35 - CORE_PEER_PROFILE_ENABLED=true 36 - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt 37 - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key 38 - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt 39 - CORE_LEDGER_STATE_STATEDATABASE=CouchDB 40 - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984 41 # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD 42 # provide the credentials for ledger to connect to CouchDB. The username and password must 43 # match the username and password set for the associated CouchDB. 44 - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin 45 - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=123456 46 depends_on: 47 - couchdb0 48 volumes: 49 - /var/run/:/host/var/run/ 50 - ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp 51 - ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls 52 ports: 53 - 7051:7051 54 - 7052:7052 55 - 7053:7053 56 extra_hosts: 57 - "orderer0.example.com:192.168.43.167" 58 - "orderer1.example.com:192.168.43.91" 59 - "orderer2.example.com:192.168.43.241" 60 61 62 cli0: 63 container_name: cli0 64 image: hyperledger/fabric-tools 65 tty: true 66 stdin_open: true 67 environment: 68 #- SYS_CHANNEL=$SYS_CHANNEL 69 - GOPATH=/opt/gopath 70 - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock 71 #- FABRIC_LOGGING_SPEC=DEBUG 72 - FABRIC_LOGGING_SPEC=INFO 73 - CORE_PEER_ID=cli0 74 - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 75 - CORE_PEER_LOCALMSPID=Org1MSP 76 - CORE_PEER_TLS_ENABLED=true 77 - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt 78 - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key 79 - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt 80 - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp 81 working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer 82 command: /bin/bash 83 volumes: 84 - /var/run/:/host/var/run/ 85 - ./chaincode/:/opt/gopath/src/github.com/chaincode 86 - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ 87 - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts 88 - ./peer:/opt/gopath/src/github.com/hyperledger/fabric/peer/ 89 extra_hosts: 90 - "orderer0.example.com:192.168.43.167" 91 - "orderer1.example.com:192.168.43.91" 92 - "orderer2.example.com:192.168.43.241" 93 #- "peer0.org1.richfit.com:11.11.54.172" 94 - "peer1.org1.example.com:192.168.43.91" 95 - "peer0.org2.example.com:192.168.43.241" 96 #- "peer1.org2.richfit.com:11.11.54.172"

peer1org2.yaml

1version: '2' 2 3services: 4 couchdb3: 5 container_name: couchdb3 6 image: hyperledger/fabric-couchdb 7 # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password 8 # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. 9 environment: 10 - COUCHDB_USER=admin 11 - COUCHDB_PASSWORD=123456 12 # Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service, 13 # for example map it to utilize Fauxton User Interface in dev environments. 14 ports: 15 - 6984:5984 16 17 peer1.org2.example.com: 18 container_name: peer1.org2.example.com 19 image: hyperledger/fabric-peer 20 environment: 21 - CORE_PEER_ID=peer1.org2.example.com 22 - CORE_PEER_ADDRESS=peer1.org2.example.com:8051 23 - CORE_PEER_LISTENADDRESS=0.0.0.0:8051 24 - CORE_PEER_CHAINCODEADDRESS=peer1.org2.example.com:8052 25 - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:8052 26 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:8051 27 #- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051 28 - CORE_PEER_LOCALMSPID=Org2MSP 29 - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock 30 # the following setting starts chaincode containers on the same 31 # bridge network as the peers 32 # https://docs.docker.com/compose/networking/ 33 - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=raft-cluster_default 34 - FABRIC_LOGGING_SPEC=INFO 35 #- FABRIC_LOGGING_SPEC=DEBUG 36 - CORE_PEER_TLS_ENABLED=true 37 - CORE_PEER_GOSSIP_USELEADERELECTION=true 38 - CORE_PEER_GOSSIP_ORGLEADER=false 39 - CORE_PEER_PROFILE_ENABLED=true 40 - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt 41 - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key 42 - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt 43 - CORE_LEDGER_STATE_STATEDATABASE=CouchDB 44 - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984 45 # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD 46 # provide the credentials for ledger to connect to CouchDB. The username and password must 47 # match the username and password set for the associated CouchDB. 48 - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin 49 - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=123456 50 depends_on: 51 - couchdb3 52 volumes: 53 - /var/run/:/host/var/run/ 54 - ./crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp 55 - ./crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls 56 ports: 57 - 8051:7051 58 - 8052:7052 59 - 8053:7053 60 extra_hosts: 61 - "orderer0.example.com:192.168.43.167" 62 - "orderer1.richfit.com:192.168.43.91" 63 - "orderer2.richfit.com:192.168.43.241" 64 65 66 cli1: 67 container_name: cli1 68 image: hyperledger/fabric-tools 69 tty: true 70 stdin_open: true 71 environment: 72 #- SYS_CHANNEL=$SYS_CHANNEL 73 - GOPATH=/opt/gopath 74 - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock 75 #- FABRIC_LOGGING_SPEC=DEBUG 76 - FABRIC_LOGGING_SPEC=INFO 77 - CORE_PEER_ID=cli1 78 - CORE_PEER_ADDRESS=peer1.org2.example.com:8051 79 - CORE_PEER_LOCALMSPID=Org2MSP 80 - CORE_PEER_TLS_ENABLED=true 81 - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.crt 82 - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.key 83 - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt 84 - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp 85 working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer 86 command: /bin/bash 87 volumes: 88 - /var/run/:/host/var/run/ 89 - ./chaincode/:/opt/gopath/src/github.com/chaincode 90 - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ 91 - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts 92 - ./peer:/opt/gopath/src/github.com/hyperledger/fabric/peer/ 93 extra_hosts: 94 - "orderer0.example.com:192.168.43.167" 95 - "orderer1.example.com:192.168.43.91" 96 - "orderer2.example.com:192.168.43.241" 97 #- "peer0.org1.richfit.com:11.11.54.172" 98 - "peer1.org1.example.com:192.168.43.91" 99 - "peer0.org2.example.com:192.168.43.241" 100 #- "peer1.org2.richfit.com:11.11.54.172" 101

192.168.43.91

orderer1.yaml

1version: '2' 2 3services: 4 orderer1.example.com: 5 container_name: orderer1.example.com 6 image: hyperledger/fabric-orderer 7 environment: 8 - FABRIC_LOGGING_SPEC=INFO 9 - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 10 - ORDERER_GENERAL_GENESISMETHOD=file 11 - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block 12 - ORDERER_GENERAL_LOCALMSPID=OrdererMSP 13 - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp 14 # enabled TLS 15 - ORDERER_GENERAL_TLS_ENABLED=true 16 - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key 17 - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt 18 - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] 19 - ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1 20 - ORDERER_KAFKA_VERBOSE=true 21 - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt 22 - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key 23 - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] 24 working_dir: /opt/gopath/src/github.com/hyperledger/fabric 25 command: orderer 26 volumes: 27 - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block 28 - ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp:/var/hyperledger/orderer/msp 29 - ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/:/var/hyperledger/orderer/tls 30 ports: 31 - 7050:7050 32 extra_hosts: 33 - "orderer0.example.com:192.168.43.167" 34 - "orderer1.example.com:192.168.43.91" 35 - "orderer2.example.com:192.168.43.241" 36

peer1org1.yaml

1version: '2' 2 3services: 4 couchdb1: 5 container_name: couchdb1 6 image: hyperledger/fabric-couchdb 7 # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password 8 # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. 9 environment: 10 - COUCHDB_USER=admin 11 - COUCHDB_PASSWORD=123456 12 # Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service, 13 # for example map it to utilize Fauxton User Interface in dev environments. 14 ports: 15 - 5984:5984 16 17 peer1.org1.example.com: 18 container_name: peer1.org1.example.com 19 image: hyperledger/fabric-peer 20 environment: 21 - CORE_PEER_ID=peer1.org1.example.com 22 - CORE_PEER_ADDRESS=peer1.org1.example.com:7051 23 - CORE_PEER_LISTENADDRESS=0.0.0.0:7051 24 - CORE_PEER_CHAINCODEADDRESS=peer1.org1.example.com:7052 25 - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052 26 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051 27 #- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051 28 - CORE_PEER_LOCALMSPID=Org1MSP 29 - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock 30 # the following setting starts chaincode containers on the same 31 # bridge network as the peers 32 # https://docs.docker.com/compose/networking/ 33 - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=raft-cluster_default 34 - FABRIC_LOGGING_SPEC=INFO 35 #- FABRIC_LOGGING_SPEC=DEBUG 36 - CORE_PEER_TLS_ENABLED=true 37 - CORE_PEER_GOSSIP_USELEADERELECTION=true 38 - CORE_PEER_GOSSIP_ORGLEADER=false 39 - CORE_PEER_PROFILE_ENABLED=true 40 - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt 41 - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key 42 - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt 43 - CORE_LEDGER_STATE_STATEDATABASE=CouchDB 44 - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984 45 # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD 46 # provide the credentials for ledger to connect to CouchDB. The username and password must 47 # match the username and password set for the associated CouchDB. 48 - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin 49 - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=123456 50 depends_on: 51 - couchdb1 52 volumes: 53 - /var/run/:/host/var/run/ 54 - ./crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp 55 - ./crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls 56 ports: 57 - 7051:7051 58 - 7052:7052 59 - 7053:7053 60 extra_hosts: 61 - "orderer0.example.com:192.168.43.167" 62 - "orderer1.example.com:192.168.43.91" 63 - "orderer2.example.com:192.168.43.241" 64 65 cli1: 66 container_name: cli1 67 image: hyperledger/fabric-tools 68 tty: true 69 stdin_open: true 70 environment: 71 #- SYS_CHANNEL=$SYS_CHANNEL 72 - GOPATH=/opt/gopath 73 - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock 74 #- FABRIC_LOGGING_SPEC=DEBUG 75 - FABRIC_LOGGING_SPEC=INFO 76 - CORE_PEER_ID=cli1 77 - CORE_PEER_ADDRESS=peer1.org1.example.com:7051 78 - CORE_PEER_LOCALMSPID=Org1MSP 79 - CORE_PEER_TLS_ENABLED=true 80 - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.crt 81 - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.key 82 - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt 83 - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp 84 working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer 85 command: /bin/bash 86 volumes: 87 - /var/run/:/host/var/run/ 88 - ./chaincode/:/opt/gopath/src/github.com/chaincode 89 - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ 90 - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts 91 - ./peer:/opt/gopath/src/github.com/hyperledger/fabric/peer/ 92 extra_hosts: 93 - "orderer0.example.com:192.168.43.167" 94 - "orderer1.example.com:192.168.43.91" 95 - "orderer2.example.com:192.168.43.241" 96 - "peer0.org1.example.com:192.168.43.167" 97 - "peer1.org1.example.com:192.168.43.91" 98 - "peer0.org2.example.com:192.168.43.241" 99 - "peer1.org2.example.com:192.168.43.167" 100

192.168.43.241

orderer2.yaml

1version: '2' 2 3services: 4 orderer2.example.com: 5 container_name: orderer2.example.com 6 image: hyperledger/fabric-orderer 7 environment: 8 - FABRIC_LOGGING_SPEC=INFO 9 - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 10 - ORDERER_GENERAL_GENESISMETHOD=file 11 - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block 12 - ORDERER_GENERAL_LOCALMSPID=OrdererMSP 13 - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp 14 # enabled TLS 15 - ORDERER_GENERAL_TLS_ENABLED=true 16 - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key 17 - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt 18 - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] 19 - ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1 20 - ORDERER_KAFKA_VERBOSE=true 21 - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt 22 - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key 23 - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] 24 working_dir: /opt/gopath/src/github.com/hyperledger/fabric 25 command: orderer 26 volumes: 27 - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block 28 - ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/msp:/var/hyperledger/orderer/msp 29 - ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/:/var/hyperledger/orderer/tls 30 ports: 31 - 7050:7050 32 extra_hosts: 33 - "orderer0.example.com:192.168.43.167" 34 - "orderer1.example.com:192.168.43.91" 35 - "orderer2.example.com:192.168.43.241"

peer0org2.yaml

1version: '2' 2 3services: 4 couchdb2: 5 container_name: couchdb2 6 image: hyperledger/fabric-couchdb 7 # Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password 8 # for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode. 9 environment: 10 - COUCHDB_USER=admin 11 - COUCHDB_PASSWORD=123456 12 # Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service, 13 # for example map it to utilize Fauxton User Interface in dev environments. 14 ports: 15 - 5984:5984 16 17 peer0.org2.example.com: 18 container_name: peer0.org2.example.com 19 image: hyperledger/fabric-peer 20 environment: 21 - CORE_PEER_ID=peer0.org2.example.com 22 - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 23 - CORE_PEER_LISTENADDRESS=0.0.0.0:7051 24 - CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:7052 25 - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052 26 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051 27 #- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:8051 28 - CORE_PEER_LOCALMSPID=Org2MSP 29 - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock 30 # the following setting starts chaincode containers on the same 31 # bridge network as the peers 32 # https://docs.docker.com/compose/networking/ 33 - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=raft-cluster_default 34 - FABRIC_LOGGING_SPEC=INFO 35 #- FABRIC_LOGGING_SPEC=DEBUG 36 - CORE_PEER_TLS_ENABLED=true 37 - CORE_PEER_GOSSIP_USELEADERELECTION=true 38 - CORE_PEER_GOSSIP_ORGLEADER=false 39 - CORE_PEER_PROFILE_ENABLED=true 40 - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt 41 - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key 42 - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt 43 - CORE_LEDGER_STATE_STATEDATABASE=CouchDB 44 - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984 45 # The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD 46 # provide the credentials for ledger to connect to CouchDB. The username and password must 47 # match the username and password set for the associated CouchDB. 48 - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin 49 - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=123456 50 depends_on: 51 - couchdb2 52 volumes: 53 - /var/run/:/host/var/run/ 54 - ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp 55 - ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls 56 ports: 57 - 7051:7051 58 - 7052:7052 59 - 7053:7053 60 extra_hosts: 61 - "orderer0.example.com:192.168.43.167" 62 - "orderer1.example.com:192.168.43.91" 63 - "orderer2.example.com:192.168.43.241" 64 65 cli0: 66 container_name: cli0 67 image: hyperledger/fabric-tools 68 tty: true 69 stdin_open: true 70 environment: 71 #- SYS_CHANNEL=$SYS_CHANNEL 72 - GOPATH=/opt/gopath 73 - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock 74 #- FABRIC_LOGGING_SPEC=DEBUG 75 - FABRIC_LOGGING_SPEC=INFO 76 - CORE_PEER_ID=cli0 77 - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 78 - CORE_PEER_LOCALMSPID=Org2MSP 79 - CORE_PEER_TLS_ENABLED=true 80 - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt 81 - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key 82 - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt 83 - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp 84 working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer 85 command: /bin/bash 86 volumes: 87 - /var/run/:/host/var/run/ 88 - ./chaincode/:/opt/gopath/src/github.com/chaincode 89 - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ 90 - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts 91 - ./peer:/opt/gopath/src/github.com/hyperledger/fabric/peer/ 92 extra_hosts: 93 - "orderer0.example.com:192.168.43.167" 94 - "orderer1.example.com:192.168.43.91" 95 - "orderer2.example.com:192.168.43.241" 96 - "peer0.org1.example.com:192.168.43.167" 97 - "peer1.org1.example.com:192.168.43.91" 98 - "peer0.org2.example.com:192.168.43.241" 99 - "peer1.org2.example.com:192.168.43.167"

部署文档

1//清理环境 2docker stop $(docker ps -aq) 3 4docker rm $(docker ps -aq) 5 6rm -rf channel-artifacts/ 7 8rm -rf crypto-config 9 10sudo rm -rf peer/ 11 12//生成证书、通道配置文件、创世区块等 13./bin/cryptogen generate --config=./crypto-config.yaml 14 15mkdir channel-artifacts 16./bin/configtxgen -profile SampleMultiNodeEtcdRaft -outputBlock ./channel-artifacts/genesis.block 17 18./bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/mychannel.tx -channelID mychannel 19 20//crypto-config和channel-artifacts两个目录拷贝到其他节点 21scp -r ./crypto-config/ hao@192.168.43.91:/home/hao/Desktop/fabric/raft-cluster 22scp -r ./channel-artifacts/ hao@192.168.43.91:/home/hao/Desktop/fabric/raft-cluster 23 24scp -r ./crypto-config/ hao@192.168.43.241:/home/hao/Desktop/fabric/raft-cluster 25scp -r ./channel-artifacts/ hao@192.168.43.241:/home/hao/Desktop/fabric/raft-cluster 26 27 28//启动orderer节点 29docker-compose -f orderer0.yaml up -d 30 31docker-compose -f orderer1.yaml up -d 32 33docker-compose -f orderer2.yaml up -d 34 35 36//启动peer0org1 37docker-compose -f peer0org1.yaml up -d 38 39docker exec -it cli0 bash 40 41//创建通道 42ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem 43peer channel create -o orderer0.example.com:7050 -c mychannel -f ./channel-artifacts/mychannel.tx --tls --cafile $ORDERER_CA 44 45//节点加入通道 46peer channel join -b mychannel.block 47 48//安装智能合约 49peer chaincode install -n mycc -p /opt/gopath/src/github.com/chaincode/java/DCChainCode -l java -v 1.0 50 51//实例化是能合约 52ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem 53peer chaincode instantiate -o orderer0.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -l java -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')" 54 55//查询 56peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}' 57 58 59//交易 60ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem 61peer chaincode invoke --tls --cafile $ORDERER_CA -C mychannel -n mycc -c '{"Args":["invoke","a","b","20"]}' 62 63//启动peer1org1节点 64docker-compose -f peer1org1.yaml up -d 65 66//将peer0org1生成的通道配置区块发送到peer1org1节点 67scp -r ./mychannel.block hao@192.168.43.91:/home/hao/Desktop/fabric/raft-cluster/ 68 69sudo mv ./mychannel.block ./peer 70 71//重新启动peer1org1节点 72docker-compose -f peer1org1.yaml up -d 73 74docker exec -it cli1 bash 75 76//节点加入通道 77peer channel join -b mychannel.block 78 79//节点安装链码 80peer chaincode install -n mycc -p /opt/gopath/src/github.com/chaincode/java/DCChainCode -l java -v 1.0 81 82//启动peer0org2节点 83docker-compose -f peer0org2.yaml up -d 84 85 86//将peer0org1生成的通道配置区块发送到peer0org2节点 87scp -r ./mychannel.block hao@192.168.43.241:/home/hao/Desktop/fabric/raft-cluster/ 88 89sudo mv ./mychannel.block ./peer 90 91//重启peer0org2节点 92docker-compose -f peer0org2.yaml up -d 93 94docker exec -it cli0 bash 95 96//节点加入通道 97peer channel join -b mychannel.block 98 99//节点安装智能合约 100peer chaincode install -n mycc -p /opt/gopath/src/github.com/chaincode/java/DCChainCode -l java -v 1.0 101 102 103//启动peer1org2 104docker-compose -f peer1org2.yaml up -d 105 106docker exec -it cli1 bash 107 108peer channel join -b mychannel.block 109 110peer chaincode install -n mycc -p /opt/gopath/src/github.com/chaincode/java/DCChainCode -l java -v 1.0 111

最后,如果在部署的过程中出现问题,欢迎在本博客下留言或私信。

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )

mysql设置时区

mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0