Skip to content

Commit 66bdcf2

Browse files
committed
fix bug
1 parent 17ff75e commit 66bdcf2

12 files changed

+127
-412
lines changed

doc/1.1.hyperledger1.0分布式环境搭建.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# hyperledger1.0分布式环境搭建
22

3-
本篇主要介绍`hyperledger1.0`基本环境的搭建,看了一些现有的教程啥的,都是基于官方的一键脚本运行的,脚本里面基本都已经写好了如何配置参数,甚至自动组建区块链的环境都已经使用脚本做好的,本篇笔者通过阅读官方的脚本逐步搭建出一个多个节点参与非容器环境的超级账本环境。至于相关区块链的原理以及超级账本所使用的组件功能配置,在后面的学习笔记中会进行记录与解释。
3+
本篇主要介绍`hyperledger1.0`基本环境的搭建,看了一些现有的教程啥的,都是基于官方的一键脚本运行的,脚本里面基本都已经写好了如何配置参数,甚至自动组建区块链的环境都已经使用脚本做好的,本篇笔者通过阅读官方的脚本逐步搭建出一个多个节点参与非容器环境的超级账本环境,以及使用`Fabric-CA`模块实现用户注册等等。至于相关区块链的原理以及超级账本所使用的组件功能配置,在后面的学习笔记中会进行记录与解释。
44

55
## 一、基本环境简介
66

@@ -34,7 +34,22 @@ Shell> git clone https://github.com/hyperledger/fabric-samples.git # 下载演
3434
## 三、分布式环境搭建步骤
3535

3636

37-
### 3.1、
37+
### 3.1、准备联盟链模板以及配置文件
38+
39+
`Fabric`的认证以组织机构的身份验证管理依靠证书实现,即组织机构的层级关系是通过证书实现的,节点的加入与控制基于`CA`签发的证书,比较的严格。首先官方给我们提供了一个工具`cryptogen`来自动生成组织机构关系,该工具依赖于`crypto-config.yaml`配置文件,在本工程的示例文件中给出了一个配置文件模板,笔者也是基于该配置文件的组织机构构建超级账本的组织机构,笔者会根据在实际的调用过程中使用到的配置加以解释,其他配置会不断的丰富完善。模板配置文件`crypto-config.yaml`如下:
40+
41+
```bash
42+
```
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
3853

3954

4055
## 四、线上增加Peer或者Orderer节点
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash -
2+
#===============================================================================
3+
#
4+
# FILE: configtxgen_genesisblock.sh
5+
#
6+
# USAGE: ./configtxgen_genesisblock.sh
7+
#
8+
# DESCRIPTION:
9+
#
10+
# OPTIONS: ---
11+
# REQUIREMENTS: ---
12+
# BUGS: ---
13+
# NOTES: ---
14+
# AUTHOR: YOUR NAME (),
15+
# ORGANIZATION:
16+
# CREATED: 04/03/2018 11:33
17+
# REVISION: ---
18+
#===============================================================================
19+
20+
set -o nounset # Treat unset variables as an error
21+
22+
export FABRIC_CFG_PATH=$PWD/../
23+
24+
configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./genesis.block

doc/hyperledger1.0.6_conf/channel_op_script/create_channel.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,5 @@ set -o nounset # Treat unset variables as an error
2121

2222
export CHANNELNAME=epointchannel
2323
export CORE_PEER_LOCALMSPID=city1MSP
24-
export CORE_PEER_MSPCONFIGPATH=/root/epoint-hyperledger/crypto-config/peerOrganizations/city1.epoint.com.cn/users/Admin@city1.epoint.com.cn/msp
25-
26-
27-
28-
peer channel create -o order1.epoint.com.cn:7050 -c ${CHANNELNAME} -f ./epointchannel.tx
24+
export CORE_PEER_MSPCONFIGPATH=/root/hyperledger1.0.6_conf/crypto-config/peerOrganizations/city1.epoint.com.cn/users/Admin\@city1.epoint.com.cn/msp
25+
peer channel create -o orderer1.epoint.com.cn:7050 -c ${CHANNELNAME} -f ../${CHANNELNAME}.tx
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash -
2+
#===============================================================================
3+
#
4+
# FILE: generate.sh
5+
#
6+
# USAGE: ./generate.sh
7+
#
8+
# DESCRIPTION:
9+
#
10+
# OPTIONS: ---
11+
# REQUIREMENTS: ---
12+
# BUGS: ---
13+
# NOTES: ---
14+
# AUTHOR: YOUR NAME (),
15+
# ORGANIZATION:
16+
# CREATED: 04/03/2018 11:31
17+
# REVISION: ---
18+
#===============================================================================
19+
20+
set -o nounset # Treat unset variables as an error
21+
22+
23+
cryptogen generate --config=../crypto-config.yaml
24+

doc/hyperledger1.0.6_conf/config.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash -
2+
#===============================================================================
3+
#
4+
# FILE: config.sh
5+
#
6+
# USAGE: ./config.sh
7+
#
8+
# DESCRIPTION:
9+
#
10+
# OPTIONS: ---
11+
# REQUIREMENTS: ---
12+
# BUGS: ---
13+
# NOTES: ---
14+
# AUTHOR: YOUR NAME (),
15+
# ORGANIZATION:
16+
# CREATED: 04/03/2018 16:00
17+
# REVISION: ---
18+
#===============================================================================
19+
20+
set -o nounset # Treat unset variables as an error
21+
22+
23+
24+
export CHANNEL_NAME=epointchannel
25+
export FABRIC_CFG_PATH=$PWD
26+
configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./genesis.block
27+
configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./${CHANNEL_NAME}.tx -channelID $CHANNEL_NAME
28+
29+
30+
31+
32+
export CORE_PEER_MSPCONFIGPATH=/root/hyperledger1.0.6_conf/crypto-config/peerOrganizations/city1.epoint.com.cn/users/Admin\@city1.epoint.com.cn/msp
33+
export CORE_PEER_ADDRESS=peer0.city1.epoint.com.cn:7051
34+
export CORE_PEER_LOCALMSPID="city1MSP"
35+
peer channel create -o orderer1.epoint.com.cn:7050 -c $CHANNEL_NAME -f ./${CHANNEL_NAME}.tx
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+

doc/hyperledger1.0.6_conf/configtx.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ Organizations:
4747
- &OrdererOrg
4848
# DefaultOrg defines the organization which is used in the sampleconfig
4949
# of the fabric.git development environment
50-
Name: OrdererOrg
50+
Name: Orderer1Org
5151

5252
# ID to load the MSP definition as
53-
ID: OrdererMSP
53+
ID: Orderer1MSP
5454

5555
# MSPDir is the filesystem path which contains the MSP configuration
5656
MSPDir: crypto-config/ordererOrganizations/epoint.com.cn/msp
@@ -104,7 +104,7 @@ Orderer: &OrdererDefaults
104104
OrdererType: solo
105105

106106
Addresses:
107-
- order1.epoint.com.cn:7050
107+
- orderer1.epoint.com.cn:7050
108108

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

doc/hyperledger1.0.6_conf/crypto-config.yaml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,8 @@ OrdererOrgs:
1515
# ---------------------------------------------------------------------------
1616
# "Specs" - See PeerOrgs below for complete description
1717
# ---------------------------------------------------------------------------
18-
Specs:
19-
- Hostname: order1.epoint.com.cn
20-
- Name: Orderer2
21-
Domain: epoint.com.cn
22-
# ---------------------------------------------------------------------------
23-
# "Specs" - See PeerOrgs below for complete description
24-
# ---------------------------------------------------------------------------
25-
Specs:
26-
- Hostname: order2.epoint.com.cn
18+
Template:
19+
Count: 4
2720
# ---------------------------------------------------------------------------
2821
# "PeerOrgs" - Definition of organizations managing peer nodes
2922
# ---------------------------------------------------------------------------
@@ -33,7 +26,6 @@ PeerOrgs:
3326
# ---------------------------------------------------------------------------
3427
- Name: city1
3528
Domain: city1.epoint.com.cn
36-
EnableNodeOUs: true
3729
# ---------------------------------------------------------------------------
3830
# "Specs"
3931
# ---------------------------------------------------------------------------
@@ -68,7 +60,7 @@ PeerOrgs:
6860
# name collisions
6961
# ---------------------------------------------------------------------------
7062
Template:
71-
Count: 3
63+
Count: 2
7264
# Start: 5
7365
# Hostname: {{.Prefix}}{{.Index}} # default
7466
# ---------------------------------------------------------------------------
@@ -77,14 +69,13 @@ PeerOrgs:
7769
# Count: The number of user accounts _in addition_ to Admin
7870
# ---------------------------------------------------------------------------
7971
Users:
80-
Count: 2
72+
Count: 5
8173
# ---------------------------------------------------------------------------
8274
# Org2: See "Org1" for full specification
8375
# ---------------------------------------------------------------------------
8476
- Name: city2
8577
Domain: city2.epoint.com.cn
86-
EnableNodeOUs: true
8778
Template:
88-
Count: 3
79+
Count: 2
8980
Users:
9081
Count: 5

0 commit comments

Comments
 (0)