标签:hub first nes yam sel bsp 信息 yaml selector
#路径需要更改为自己的路径
cd ~/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/
#在这里可能会报错,通常是权限问题,可以添加sudo重新执行
cryptogen generate --config=./crypto-config.yaml
#执行完毕后,当前文件夹下会出现一个新的文件夹:crypto-config,在该文件夹下就是刚刚生成的证书.
#路径需要更改为自己的路径 cd ~/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/
生成创世区块
configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
export CHANNEL_NAME=mychannel
configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP
成功后在channel-artifacts有四个文件:
channel.tx genesis.block Org1MSPanchors.tx Org2MSPanchors.tx
sudo docker-compose -f docker-compose-cli.yaml up -d
export CHANNEL_NAME=mychannel
export ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls true --cafile $ORDERER_CA
-o 指定Orderer节点地址
-c 指定要创建的应用通道名称
-f 指定创建应用通道时所使用的应用通道交易配置文件
--tls 开启tls验证
--cafile 指定tls_ca证书的所在路径
peer channel join -b mychannel.block
标签:hub first nes yam sel bsp 信息 yaml selector
原文地址:https://www.cnblogs.com/zhanghh/p/11595923.html