Desarrollo de Fabric (3) Ubuntu 20.04.1 para construir rápidamente Fabric 1.4.3 (versión de desminado)

En el último artículo, lanzamos con éxito la red Fabric1.0.0 y la probamos con éxito , pero 1.0.0 es de hecho un poco antiguo . Sigamos los pasos del artículo de referencia anterior para comenzar un intento 1.4.3. El funcionamiento es el siguiente:

1. Primero cambie la rama a 1.4.3 para ejecutar la secuencia de comandos de la imagen de la tela de descarga

Debido a que eliminamos la imagen de Fabric descargada en el artículo anterior, después de cambiar a la rama 1.4.3, debe descargar la imagen nuevamente. Aquí también hay un comando de descarga con un solo clic. (La rama V1.0.0 ha cambiado algo, por lo que debe enviarla y luego cambiar de rama)
Inserte la descripción de la imagen aquí
Cambie al scriptsdirectorio y ejecute el scriptbootstrap.sh

cd ~/go/src/github.com/hyperledger/fabric/scripts
./bootstrap.sh

1. Informar del
Inserte la descripción de la imagen aquí
error después de la ejecución: Razón del error:
nexus.hyperledger.org这个网站不再维护了,需要把脚本中nexus.hyperledger.org位置替换一下
Solución:
ejecutar vim bootstrap.sh, buscar nexus.hyperledger.org y modificar

#改造前:
binariesInstall() {
    
    
  echo "===> Downloading version ${FABRIC_TAG} platform specific fabric binaries"
  binaryDownload ${BINARY_FILE} https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${VERSION}/${BINARY_FILE}
  if [ $? -eq 22 ]; then
     echo
     echo "------> ${FABRIC_TAG} platform specific fabric binary is not available to download <----"
     echo
   fi

  echo "===> Downloading version ${CA_TAG} platform specific fabric-ca-client binary"
  binaryDownload ${CA_BINARY_FILE} https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric-ca/hyperledger-fabric-ca/${ARCH}-${CA_VERSION}/${CA_BINARY_FILE}
  if [ $? -eq 22 ]; then
     echo
     echo "------> ${CA_TAG} fabric-ca-client binary is not available to download  (Available from 1.1.0-rc1) <----"
     echo
   fi
}
#改造后:
binariesInstall() {
    
    
  echo "===> Downloading version ${FABRIC_TAG} platform specific fabric binaries"  binaryDownload ${BINARY_FILE} https://github.com/hyperledger/fabric/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${VERSION}/${BINARY_FILE}
  if [ $? -eq 22 ]; then
     echo
     echo "------> ${FABRIC_TAG} platform specific fabric binary is not available to download <----"
     echo
   fi

  echo "===> Downloading version ${CA_TAG} platform specific fabric-ca-client binary"  binaryDownload ${CA_BINARY_FILE} https://github.com/hyperledger/fabric/releases/org/hyperledger/fabric-ca/hyperledger-fabric-ca/${ARCH}-${CA_VERSION}/${CA_BINARY_FILE}
  if [ $? -eq 22 ]; then
     echo
     echo "------> ${CA_TAG} fabric-ca-client binary is not available to download  (Available from 1.1.0-rc1) <----"
     echo
   fi
}

Ejecutar de nuevo ./bootstrap.sh,

halfape@halfape-VirtualBox:~/go/src/github.com/hyperledger/fabric/scripts$ ./bootstrap.sh 

Descubrí que el archivo espejo se puede descargar normalmente.
Inserte la descripción de la imagen aquí

2. Crea un canal

Cambiar al first-networkdirectorio

cd fabric-samples/first-network/

Cree el primer canal (mychannel es el nombre del canal, si no lo escribe, el predeterminado es mychannel, puede definirlo usted mismo):

./byfn.sh -m generate -c mychannel

Error de nuevo: la
Inserte la descripción de la imagen aquí
respuesta se da en línea:

在启动fabric中first-network网络时,需要执行一个自动化脚本:
./byfn.sh -m generate
该脚本需要自动生成相关证书信息,fabric官方提供了两款工具:configtxgen、cryptogen。在脚本执行中会从fabric-simple/bin中取查找并调用两者。初次启动时没有这个工具的。
解决方法:
进入fabric目录,看见make* 文件,使用make configtxgen、make cryptogen两个指令生成工具(如果之前搭建过fabric-1.0环境,直接进fabric/build将bin文件夹直接移动到fabric-sample目录即可)。生成后的文件再fabric/build/bin里面,移动到相关位置即可。

La operación es la siguiente:
Inserte la descripción de la imagen aquí
Dios mío, no sé si el tipo grande que publicó la solución anterior realmente resolvió el archivo de esa manera. He encontrado que después de un tiempo difícil encontrar build
que 隐藏文件. . Literalmente me caí. Probé todas las soluciones en Internet, pero no funcionó. Pero la idea general es correcta, eso es
该脚本需要自动生成相关证书信息,fabric官方提供了两款工具:configtxgen、cryptogen。在脚本执行中会从fabric-simple/bin中取查找并调用两者。初次启动时没有这个工具的。.

y entonces:

cd ~/go/src/github.com/hyperledger/fabric/.build
sudo cp ./bin/* ../scripts/fabric-samples/bin/

Luego ejecute de nuevo:

cd ~/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network
./byfn.sh -m generate -c mychannel

poder. poder. poder. Finalmente lo logró.

halfape@halfape-VirtualBox:~/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network$ ./byfn.sh -m generate -c mychannel
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 ...
/home/halfape/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/../bin/cryptogen

##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
+ cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com
+ res=0
+ set +x

Generate CCP files for Org1 and Org2
/home/halfape/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/../bin/configtxgen
##########################################################
#########  Generating Orderer Genesis block ##############
##########################################################
CONSENSUS_TYPE=solo
+ '[' solo == solo ']'
+ configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block
2020-09-24 18:50:53.179 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-09-24 18:50:53.301 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: solo
2020-09-24 18:50:53.301 CST [common.tools.configtxgen.localconfig] Load -> INFO 003 Loaded configuration: /home/halfape/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2020-09-24 18:50:53.427 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 004 orderer type: solo
2020-09-24 18:50:53.427 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 005 Loaded configuration: /home/halfape/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2020-09-24 18:50:53.428 CST [common.tools.configtxgen] doOutputBlock -> INFO 006 Generating genesis block
2020-09-24 18:50:53.429 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
2020-09-24 18:50:53.467 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-09-24 18:50:53.590 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/halfape/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2020-09-24 18:50:53.738 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2020-09-24 18:50:53.738 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /home/halfape/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2020-09-24 18:50:53.738 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 005 Generating new channel configtx
2020-09-24 18:50:53.740 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
2020-09-24 18:50:53.777 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-09-24 18:50:53.901 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/halfape/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2020-09-24 18:50:54.029 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2020-09-24 18:50:54.029 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /home/halfape/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2020-09-24 18:50:54.029 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 005 Generating anchor peer update
2020-09-24 18:50:54.029 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
2020-09-24 18:50:54.067 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-09-24 18:50:54.195 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/halfape/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2020-09-24 18:50:54.321 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 orderer type: solo
2020-09-24 18:50:54.321 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 004 Loaded configuration: /home/halfape/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/configtx.yaml
2020-09-24 18:50:54.321 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 005 Generating anchor peer update
2020-09-24 18:50:54.321 CST [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 006 Writing anchor peer update
+ res=0
+ set +x

halfape@halfape-VirtualBox:~/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network$ 

3. Inicio de la primera red

Especifique el nombre del canal e inicie la red:

./byfn.sh -m up -c mychannel

Si tiene éxito, habrá un gran comienzo y final En cuanto al orden informado en el medio pero no encontrado, también estoy muy desconcertado.

halfape@halfape-VirtualBox:~/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network$ ./byfn.sh -m up -c mychannel
Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
./byfn.sh: line 124: configtxlator: command not found
LOCAL_VERSION=
DOCKER_IMAGE_VERSION=1.4.3
=================== WARNING ===================
  Local fabric binaries and docker images are  
  out of  sync. This may cause problems.       
===============================================
Creating network "net_byfn" with the default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_peer1.org2.example.com" with default driver
Creating volume "net_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_orderer.example.com" with default driver
Creating peer0.org1.example.com ... 
Creating peer1.org2.example.com ... 
Creating peer1.org1.example.com ... 
Creating peer0.org1.example.com
Creating orderer.example.com ... 
Creating peer0.org2.example.com ... 
Creating orderer.example.com
Creating peer1.org2.example.com
Creating peer1.org1.example.com
Creating orderer.example.com ... done
Creating cli ... 
Creating cli ... done
CONTAINER ID        IMAGE                               COMMAND             CREATED             STATUS              PORTS                      NAMES
3e21e1b30504        hyperledger/fabric-tools:latest     "/bin/bash"         4 seconds ago       Up 2 seconds                                   cli
59db1504493a        hyperledger/fabric-peer:latest      "peer node start"   10 seconds ago      Up 4 seconds        0.0.0.0:9051->9051/tcp     peer0.org2.example.com
d159d2a1ea36        hyperledger/fabric-orderer:latest   "orderer"           10 seconds ago      Up 4 seconds        0.0.0.0:7050->7050/tcp     orderer.example.com
6d43e8708a68        hyperledger/fabric-peer:latest      "peer node start"   10 seconds ago      Up 4 seconds        0.0.0.0:10051->10051/tcp   peer1.org2.example.com
604251517f0c        hyperledger/fabric-peer:latest      "peer node start"   10 seconds ago      Up 4 seconds        0.0.0.0:8051->8051/tcp     peer1.org1.example.com
604b3b0157dc        hyperledger/fabric-peer:latest      "peer node start"   10 seconds ago      Up 4 seconds        0.0.0.0:7051->7051/tcp     peer0.org1.example.com

 ____    _____      _      ____    _____ 
/ ___|  |_   _|    / \    |  _ \  |_   _|
\___ \    | |     / _ \   | |_) |   | |  
 ___) |   | |    / ___ \  |  _ <    | |  
|____/    |_|   /_/   \_\ |_| \_\   |_|  

Build your first network (BYFN) end-to-end test

Channel name : mychannel
Creating channel...
+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-09-24 11:02:38.037 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-09-24 11:02:38.099 UTC [cli.common] readBlock -> INFO 002 Received block: 0
===================== Channel 'mychannel' created ===================== 

Having all peers join the channel...
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-09-24 11:02:38.257 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-09-24 11:02:38.383 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org1 joined channel 'mychannel' ===================== 

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-09-24 11:02:41.526 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-09-24 11:02:41.597 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org1 joined channel 'mychannel' ===================== 

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-09-24 11:02:44.740 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-09-24 11:02:44.820 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org2 joined channel 'mychannel' ===================== 

+ peer channel join -b mychannel.block
+ res=0
+ set +x
2020-09-24 11:02:47.928 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-09-24 11:02:47.988 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org2 joined channel 'mychannel' ===================== 

Updating anchor peers for org1...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org1MSPanchors.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-09-24 11:02:51.069 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-09-24 11:02:51.118 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org1MSP' on channel 'mychannel' ===================== 

Updating anchor peers for org2...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org2MSPanchors.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-09-24 11:02:54.203 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-09-24 11:02:54.217 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org2MSP' on channel 'mychannel' ===================== 

Installing chaincode on peer0.org1...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-09-24 11:02:57.325 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-09-24 11:02:57.325 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-09-24 11:02:58.911 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org1 ===================== 

Install chaincode on peer0.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-09-24 11:02:59.045 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-09-24 11:02:59.045 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-09-24 11:02:59.249 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org2 ===================== 

Instantiating chaincode on peer0.org2...
+ peer chaincode instantiate -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -l golang -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P 'AND ('\''Org1MSP.peer'\'','\''Org2MSP.peer'\'')'
+ res=0
+ set +x
2020-09-24 11:02:59.332 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-09-24 11:02:59.332 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
===================== Chaincode is instantiated on peer0.org2 on channel 'mychannel' ===================== 

Querying chaincode on peer0.org1...
===================== Querying on peer0.org1 on channel 'mychannel'... ===================== 
Attempting to Query peer0.org1 ...3 secs
+ peer chaincode query -C mychannel -n mycc -c '{
    
    "Args":["query","a"]}'
+ res=0
+ set +x

100
===================== Query successful on peer0.org1 on channel 'mychannel' ===================== 
Sending invoke transaction on peer0.org1 peer0.org2...
+ peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{
    
    "Args":["invoke","a","b","10"]}'
+ res=0
+ set +x
2020-09-24 11:04:10.235 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 
===================== Invoke transaction successful on peer0.org1 peer0.org2 on channel 'mychannel' ===================== 

Installing chaincode on peer1.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2020-09-24 11:04:10.365 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-09-24 11:04:10.365 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-09-24 11:04:11.184 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer1.org2 ===================== 

Querying chaincode on peer1.org2...
===================== Querying on peer1.org2 on channel 'mychannel'... ===================== 
Attempting to Query peer1.org2 ...3 secs
+ peer chaincode query -C mychannel -n mycc -c '{
    
    "Args":["query","a"]}'
^[OQ+ res=0
+ set +x

90
===================== Query successful on peer1.org2 on channel 'mychannel' ===================== 

========= All GOOD, BYFN execution completed =========== 


 _____   _   _   ____   
| ____| | \ | | |  _ \  
|  _|   |  \| | | | | | 
| |___  | |\  | | |_| | 
|_____| |_| \_| |____/  

4. La operación del cliente
ingresa al contenedor cli

docker exec -it cli bash

Consultar el saldo de un

peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'

La pantalla es normal, el resultado es 90
Inserte la descripción de la imagen aquí
, el saldo de la consulta b es 210

peer chaincode query -C mychannel -n mycc -c '{"Args":["query","b"]}'

a transferir 20 ab y consultar sus respectivos saldos:

peer chaincode invoke -o orderer.example.com:7050 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"Args":["invoke","a","b","20"]}'

Después de la ejecución, verifique los resultados de ayb, a debe ser 70 y b debe ser 230
Inserte la descripción de la imagen aquí
Bingo, lo cual es completamente correcto. Hasta ahora, Fabric V1.0.0y el Fabric V1.4.3entorno es perfecto.

4. Cierre de la primera red

Apague la red:

./byfn.sh -m down

Ejecute docker ps -a para ver la situación del contenedor:

cuijb@cuijb-VirtualBox:~/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network$ docker ps -a
CONTAINER ID        IMAGE                                                                                                  COMMAND                  CREATED             STATUS              PORTS                      NAMES
b609b3d98436        dev-peer1.org2.example.com-mycc-1.0-26c2ef32838554aac4f7ad6f100aca865e87959c9a126e86d764c8d01f8346ab   "chaincode -peer.add…"   41 minutes ago      Up 41 minutes                                  dev-peer1.org2.example.com-mycc-1.0
f24c5f7fdf6b        dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9   "chaincode -peer.add…"   42 minutes ago      Up 42 minutes                                  dev-peer0.org1.example.com-mycc-1.0
eb1dbb4a9269        dev-peer0.org2.example.com-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b   "chaincode -peer.add…"   42 minutes ago      Up 42 minutes                                  dev-peer0.org2.example.com-mycc-1.0
bad91d6708e9        hyperledger/fabric-tools:latest                                                                        "/bin/bash"              44 minutes ago      Up 43 minutes                                  cli
fde805cdd9a9        hyperledger/fabric-orderer:latest                                                                      "orderer"                44 minutes ago      Up 44 minutes       0.0.0.0:7050->7050/tcp     orderer.example.com
6d65447fb84c        hyperledger/fabric-peer:latest                                                                         "peer node start"        44 minutes ago      Up 44 minutes       0.0.0.0:9051->9051/tcp     peer0.org2.example.com
56b7e58f1374        hyperledger/fabric-peer:latest                                                                         "peer node start"        44 minutes ago      Up 44 minutes       0.0.0.0:7051->7051/tcp     peer0.org1.example.com
fb03d8e4dd2f        hyperledger/fabric-peer:latest                                                                         "peer node start"        44 minutes ago      Up 44 minutes       0.0.0.0:10051->10051/tcp   peer1.org2.example.com
96b66a7d468b        hyperledger/fabric-peer:latest                                                                         "peer node start"        44 minutes ago      Up 44 minutes       0.0.0.0:8051->8051/tcp     peer1.org1.example.com

5. Asuntos que requieren atención

Si la red no se inicia después del último cierre, el siguiente primero debe realizarse antes de iniciar la red ./byfn.sh -m down
y luego comenzar de nuevo la red, simplemente ejecutar ./byfn.sh -m up -c myfirstchannelpuede ser.
Nuevamente, el comando para cerrar todos los contenedores de la ventana acoplable (si está disponible):

docker rm -f $(docker ps -aq)

Articulo de referencia

https://blog.csdn.net/jambeau/article/details/103712408
https://blog.csdn.net/wwqcherry/article/details/107009909
https://www.pianshen.com/article/38761096450/

Escribir al final

Gracias a los casos de muchos grandes en Internet, pude construir con éxito. Si cree que este artículo es útil para usted, preste atención a la cuenta pública de WeChat 半路猿, introdúzcalo en nuestro grupo de intercambio de aprendizaje, aprendan juntos y crezcan juntos.

Supongo que te gusta

Origin blog.csdn.net/aiwaston/article/details/108777949
Recomendado
Clasificación