Hyperledger Fabric1.4 manually set up

1, generate a certificate:

# Need to change the path for their own path 
cd ~ / Go / src / github.com / hyperledger / Fabric / scripts / Fabric-the Samples / First-Network / # here may be error, usually a permissions problem, you can add sudo re-run the generate --config = cryptogen / crypto. config.yaml
 # after the implementation, there will be a new folder under the current folder: crypto-config, is just created in the folder certificate.  



2, generates creation block, channel configuration, anchor node configuration file

# Need to change the path for their own path 
cd ~ / go / src / github.com / hyperledger / fabric / scripts / fabric-samples / first-network /
Creation generating block 
configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block

  Generates channel mapping information

export CHANNEL_NAME=mychannel
configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME

  Anchor node generates two organizations Profiles

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

3, start the network fabric

sudo docker-compose -f docker-compose-cli.yaml up -d

4, create a channel

CHANNEL_NAME = Export mychannel 
Export ORDERER_CA = / opt / GOPATH / the src / github.com / hyperledger / Fabric / Use the peer / Crypto / ordererOrganizations / the example.com / orderers / orderer.example.com / MSP / tlscacerts / tlsca.example.com- cert.pem 
the peer Channel orderer.example.com:7050 the create -o -c -f $ CHANNEL_NAME ./channel-artifacts/channel.tx below. --tls to true --cafile $ ORDERER_CA 

-o Orderer specified node address
-c you want to create application channel name
when creating applications -f specify the channel used by the application channel transaction profiles
--tls open tls verify
the path specified tls_ca certificate --cafile

5, the node will join the application channel

peer channel join -b mychannel.block 

6, update anchor node

 

Guess you like

Origin www.cnblogs.com/zhanghh/p/11595923.html