前面的安装不写具体了,需要安装go,node,docker,docker-compose,git
1.拉取Fabric源码:git clone https://gitee.com/hyperledger/fabric.git,并将版本切换到1.4.4。
git clone https://gitee.com/hyperledger/fabric.git
进入目录
cd fabric
运行以下命令来查看可用的版本:
git tag -l
在版本列表中,查找并选择Fabric 1.4.4的版本标签。例如,如果版本标签是v1.4.4,则可以运行以下命令来切换到该版本:
git checkout v1.4.4
2.fabric-samples,正常进入scripts文件夹运行./bootstrap.sh就可以生成,但是1.4.4版本的我拉不下来,显示
所以确认您已成功切换到1.4.4版本后,导航回fabric
目录的上一级目录。
运行以下命令来克隆fabric-samples存储库:
git clone https://gitee.com/hyperledger/fabric-samples.git
运行以下命令来查看可用的版本列表
git tag -l
选择1.4.4
git checkout v1.4.4
现在,您已经成功将fabric-samples存储库切换到1.4.4版本。
显示
但是正常./bootstrap.sh拉下来三部分,参考这篇文章关于区块链Fabric中执行./bootstrap.sh之后出错的解决方案-CSDN博客
1.fabric的二进制文件
2.fabric-samples文件夹
3.fabric的镜像文件
现在只有2,
要拉1的话执行sudo ./bootstrap.sh -b
下图是过程中
下载结束
[root@localhost hyperledger]# sudo ./bootstrap.sh -b
Installing hyperledger/fabric-samples repo
===> Cloning hyperledger/fabric-samples repo and checkout v1.4.4
正克隆到 'fabric-samples'...
fatal: 远程分支 master 在上游 origin 未发现
Installing Hyperledger Fabric docker images
===> Pulling fabric Images
==> FABRIC IMAGE: peer
1.4.4: Pulling from hyperledger/fabric-peer
b8f262c62ec6: Pull complete
9c2dad781fe8: Pull complete
7e48a048d895: Pull complete
4b5f2a9ec0f7: Pull complete
9332c2443003: Pull complete
f8823b03421b: Pull complete
Digest: sha256:92c2bef91e80f54f6d73a89b796eab1b616f372e2258431f17d50dd0c2ce316b
Status: Downloaded newer image for hyperledger/fabric-peer:1.4.4
docker.io/hyperledger/fabric-peer:1.4.4
==> FABRIC IMAGE: orderer
1.4.4: Pulling from hyperledger/fabric-orderer
b8f262c62ec6: Already exists
9c2dad781fe8: Already exists
7e48a048d895: Already exists
4b5f2a9ec0f7: Already exists
a38d313ebb74: Pull complete
391a02b02202: Pull complete
Digest: sha256:f7715923e2ca67cee526c21638d86b21480e179419e9d6c20078caabb241b20e
Status: Downloaded newer image for hyperledger/fabric-orderer:1.4.4
docker.io/hyperledger/fabric-orderer:1.4.4
==> FABRIC IMAGE: ccenv
1.4.4: Pulling from hyperledger/fabric-ccenv
7ddbc47eeb70: Pull complete
c1bbdc448b72: Pull complete
8c3b70e39044: Pull complete
45d437916d57: Pull complete
b5035666b1cd: Pull complete
94c898b5fdef: Pull complete
bee7bd3eb18f: Pull complete
9dc56c5637b5: Pull complete
33954343759c: Pull complete
09a5b37c7f4f: Pull complete
947f6f3dd9ef: Pull complete
d68f5147d7dd: Pull complete
Digest: sha256:a4fb800d54ace75e26736d4789af7d27552774e781cf2513a5c83756808b8441
Status: Downloaded newer image for hyperledger/fabric-ccenv:1.4.4
docker.io/hyperledger/fabric-ccenv:1.4.4
==> FABRIC IMAGE: javaenv
1.4.4: Pulling from hyperledger/fabric-javaenv
5667fdb72017: Pull complete
d83811f270d5: Pull complete
ee671aafb583: Pull complete
7fc152dfb3a6: Pull complete
3ab6e950cac5: Pull complete
5376778093d1: Pull complete
43a7285ac27f: Pull complete
67c5b361775c: Pull complete
7a9b4d622867: Pull complete
6d6187ff91b2: Pull complete
226ce6507c2d: Pull complete
3b5744e9eb4a: Pull complete
612ae6bdb688: Pull complete
2c0af2fc994a: Pull complete
594ab6cf73a0: Pull complete
9a77075403a7: Pull complete
3a153e9e6bcb: Pull complete
b2e75a1b75e5: Pull complete
32055256389b: Pull complete
03e36de7e531: Pull complete
d8515073d6bd: Pull complete
ae113aae7b23: Pull complete
0b7aba7b70e9: Pull complete
dba5f7f27672: Pull complete
e187107a4f2d: Pull complete
7092dcf5ae00: Pull complete
d825619a86d2: Pull complete
aeee0a2c59db: Pull complete
76a0bd84f506: Pull complete
80a98336b964: Pull complete
7d6ee8a0058b: Pull complete
cf18382c2cf7: Pull complete
75a167f9814e: Pull complete
cb5809320473: Pull complete
41d39db8657e: Pull complete
Digest: sha256:9eee210e4874b6e1a6d6a7594f0659ef37686ad572bc6273466b93b61956d23f
Status: Downloaded newer image for hyperledger/fabric-javaenv:1.4.4
docker.io/hyperledger/fabric-javaenv:1.4.4
==> FABRIC IMAGE: tools
1.4.4: Pulling from hyperledger/fabric-tools
7ddbc47eeb70: Already exists
c1bbdc448b72: Already exists
8c3b70e39044: Already exists
45d437916d57: Already exists
b5035666b1cd: Already exists
94c898b5fdef: Already exists
bee7bd3eb18f: Already exists
9dc56c5637b5: Already exists
31f2b9e8b256: Pull complete
89c4701a4f5f: Pull complete
18467825df3e: Pull complete
Digest: sha256:822418c5ad61473ecfa911dfe4b100264500c504c78def52730106a717be71cb
Status: Downloaded newer image for hyperledger/fabric-tools:1.4.4
docker.io/hyperledger/fabric-tools:1.4.4
===> Pulling fabric ca Image
==> FABRIC CA IMAGE
1.4.4: Pulling from hyperledger/fabric-ca
b8f262c62ec6: Already exists
9c2dad781fe8: Already exists
7e48a048d895: Already exists
9d96ace3877c: Pull complete
a2d035916e73: Pull complete
998b88105ae5: Pull complete
ecca03945551: Pull complete
0eea958ac479: Pull complete
Digest: sha256:e506e3ce041fd6c4fca5d12492caf44597818d425a8ecc73cf2b135303365244
Status: Downloaded newer image for hyperledger/fabric-ca:1.4.4
docker.io/hyperledger/fabric-ca:1.4.4
===> Pulling thirdparty docker images
==> THIRDPARTY DOCKER IMAGE: couchdb
0.4.18: Pulling from hyperledger/fabric-couchdb
8f91359f1fff: Pull complete
d99273889f3e: Pull complete
3a248732f3d2: Pull complete
941ee2be0fa2: Pull complete
991f59ffd446: Pull complete
f22ab95319bb: Pull complete
29334908bdc9: Pull complete
63e8abdcb623: Pull complete
83c77489c2cf: Pull complete
9fc4375990c7: Pull complete
348abe1ba56c: Pull complete
Digest: sha256:048b7c44c1deaabd0f3d84fbf2f7b649d7b10c54a3241c7354f078ee2eff077c
Status: Downloaded newer image for hyperledger/fabric-couchdb:0.4.18
docker.io/hyperledger/fabric-couchdb:0.4.18
==> THIRDPARTY DOCKER IMAGE: kafka
0.4.18: Pulling from hyperledger/fabric-kafka
7ddbc47eeb70: Already exists
c1bbdc448b72: Already exists
8c3b70e39044: Already exists
45d437916d57: Already exists
b5035666b1cd: Already exists
454f364fa8f9: Pull complete
0f71dc83554e: Pull complete
bed0281cb779: Pull complete
73033e3a7473: Pull complete
Digest: sha256:b043b8b91fe858bfd51ad662e5816f9471f120e5ec3e77d29bf6c70bcec5c917
Status: Downloaded newer image for hyperledger/fabric-kafka:0.4.18
docker.io/hyperledger/fabric-kafka:0.4.18
==> THIRDPARTY DOCKER IMAGE: zookeeper
0.4.18: Pulling from hyperledger/fabric-zookeeper
7ddbc47eeb70: Already exists
c1bbdc448b72: Already exists
8c3b70e39044: Already exists
45d437916d57: Already exists
b5035666b1cd: Already exists
454f364fa8f9: Already exists
8d2edf9568d6: Pull complete
34539f6faa69: Pull complete
ce8d3daa1c23: Pull complete
aa613546ea7a: Pull complete
8fad74705649: Pull complete
f942fd545d8a: Pull complete
6dddb55bad94: Pull complete
Digest: sha256:ff5f9893355a56ac7dbc53d0b6a68c18cf7adfcc0c34a55a717866cb9c00a442
Status: Downloaded newer image for hyperledger/fabric-zookeeper:0.4.18
docker.io/hyperledger/fabric-zookeeper:0.4.18
===> List out hyperledger docker images
hyperledger/fabric-ca 1.5 0f07bbee6fb8 6 weeks ago 223MB
hyperledger/fabric-ca 1.5.7 0f07bbee6fb8 6 weeks ago 223MB
hyperledger/fabric-tools 2.5 b2f3af4021be 2 months ago 551MB
hyperledger/fabric-tools 2.5.4 b2f3af4021be 2 months ago 551MB
hyperledger/fabric-peer 2.5 4f8d1b54d8b0 2 months ago 135MB
hyperledger/fabric-peer 2.5.4 4f8d1b54d8b0 2 months ago 135MB
hyperledger/fabric-orderer 2.5 7a73187b5c49 2 months ago 106MB
hyperledger/fabric-orderer 2.5.4 7a73187b5c49 2 months ago 106MB
hyperledger/fabric-ccenv 2.5 6dac93f94c87 2 months ago 656MB
hyperledger/fabric-ccenv 2.5.4 6dac93f94c87 2 months ago 656MB
hyperledger/fabric-baseos 2.5 3854817b987d 2 months ago 122MB
hyperledger/fabric-baseos 2.5.4 3854817b987d 2 months ago 122MB
hyperledger/fabric-baseos latest 3854817b987d 2 months ago 122MB
hyperledger/fabric-javaenv 1.4.4 4648059d209e 3 years ago 1.7GB
hyperledger/fabric-javaenv latest 4648059d209e 3 years ago 1.7GB
hyperledger/fabric-ca 1.4.4 62a60c5459ae 3 years ago 150MB
hyperledger/fabric-ca latest 62a60c5459ae 3 years ago 150MB
hyperledger/fabric-tools 1.4.4 7552e1968c0b 3 years ago 1.49GB
hyperledger/fabric-tools latest 7552e1968c0b 3 years ago 1.49GB
hyperledger/fabric-ccenv 1.4.4 ca4780293e4c 3 years ago 1.37GB
hyperledger/fabric-ccenv latest ca4780293e4c 3 years ago 1.37GB
hyperledger/fabric-orderer 1.4.4 dbc9f65443aa 3 years ago 120MB
hyperledger/fabric-orderer latest dbc9f65443aa 3 years ago 120MB
hyperledger/fabric-peer 1.4.4 9756aed98c6b 3 years ago 128MB
hyperledger/fabric-peer latest 9756aed98c6b 3 years ago 128MB
hyperledger/fabric-zookeeper 0.4.18 ede9389347db 3 years ago 276MB
hyperledger/fabric-zookeeper latest ede9389347db 3 years ago 276MB
hyperledger/fabric-kafka 0.4.18 caaae0474ef2 3 years ago 270MB
hyperledger/fabric-kafka latest caaae0474ef2 3 years ago 270MB
hyperledger/fabric-couchdb 0.4.18 d369d4eaa0fd 3 years ago 261MB
hyperledger/fabric-couchdb latest d369d4eaa0fd 3 years ago 261MB
在前前的文件夹会生成fabric(我不明白为什么我已经设置了1.4.4版本的还算是会下到2.5版本,过后在看吧)
fabric下载完成
二进制文件下载:
下载hyperledger-fabric-linux-amd64-1.4.4.tar.gz
[root@localhost go]# rz -E
rz waiting to receive.
[root@localhost go]# ls
fabric fabric-samples github hyperledger-fabric-linux-amd64-1.4.4.tar.gz
[root@localhost go]# tar -xvf hyperledger-fabric-linux-amd64-1.4.4.tar.gz
bin/
bin/orderer
bin/peer
bin/configtxlator
bin/discover
bin/idemixgen
bin/cryptogen
bin/configtxgen
config/
config/orderer.yaml
config/core.yaml
config/configtx.yaml
[root@localhost go]#
此时执行./bootstrap.sh要下载下来的文件就全部完毕。
[root@localhost first-network]# ./byfn.sh -m generate
输入后显示:
最终
[root@localhost first-network]# ./byfn.sh -m generate
Generating certs and genesis block for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] Y
proceeding ...
/root/go/src/github/hyperledger/fabric-samples/bin/cryptogen##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
+ cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com
+ res=0
+ set +xGenerate CCP files for Org1 and Org2
/root/go/src/github/hyperledger/fabric-samples/bin/configtxgen
##########################################################
######### Generating Orderer Genesis block ##############
##########################################################
CONSENSUS_TYPE=solo
+ '[' solo == solo ']'
+ configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
2023-10-12 13:56:12.991 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2023-10-12 13:56:13.098 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: solo
2023-10-12 13:56:13.098 CST [common.tools.configtxgen.localconfig] Load -> INFO 003 Loaded configuration: /root/go/src/github/hyperledger/fabric-samples/first-network/configtx.yaml
2023-10-12 13:56:13.228 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 004 orderer type: solo
2023-10-12 13:56:13.228 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 005 Loaded configuration: /root/go/src/github/hyperledger/fabric-samples/first-network/configtx.yaml
2023-10-12 13:56:13.229 CST [common.tools.configtxgen] doOutputBlock -> INFO 006 Generating genesis block
2023-10-12 13:56:13.230 CST [common.tools.configtxgen] doOutputBlock -> INFO 007 Writing genesis block
+ res=0
+ set +x#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel
2023-10-12 13:56:13.262 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2023-10-12 13:56:13.408 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/go/src/github/hyperledger/fabric-samples/first-network/configtx.yaml
2023-10-12 13:56:13.557 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2023-10-12 13:56:13.557 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /root/go/src/github/hyperledger/fabric-samples/first-network/configtx.yaml
2023-10-12 13:56:13.557 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 005 Generating new channel configtx
2023-10-12 13:56:13.560 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 006 Writing new channel tx
+ res=0
+ set +x#################################################################
####### Generating anchor peer update for Org1MSP ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP
2023-10-12 13:56:13.598 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2023-10-12 13:56:13.697 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/go/src/github/hyperledger/fabric-samples/first-network/configtx.yaml
2023-10-12 13:56:13.811 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2023-10-12 13:56:13.811 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /root/go/src/github/hyperledger/fabric-samples/first-network/configtx.yaml
2023-10-12 13:56:13.811 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 005 Generating anchor peer update
2023-10-12 13:56:13.811 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 006 Writing anchor peer update
+ res=0
+ set +x#################################################################
####### Generating anchor peer update for Org2MSP ##########
#################################################################
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
2023-10-12 13:56:13.847 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2023-10-12 13:56:13.973 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /root/go/src/github/hyperledger/fabric-samples/first-network/configtx.yaml
2023-10-12 13:56:14.098 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2023-10-12 13:56:14.098 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /root/go/src/github/hyperledger/fabric-samples/first-network/configtx.yaml
2023-10-12 13:56:14.098 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 005 Generating anchor peer update
2023-10-12 13:56:14.098 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 006 Writing anchor peer update
+ res=0
+ set +x
此时生成证书信息
创世区块及通道信息