600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > Hyperledger Fabric教程(1)--Hyperledger Fabric 老版本 1.1.0 快速部署安装

Hyperledger Fabric教程(1)--Hyperledger Fabric 老版本 1.1.0 快速部署安装

时间:2022-10-05 01:43:12

相关推荐

Hyperledger Fabric教程(1)--Hyperledger Fabric 老版本 1.1.0 快速部署安装

一. 运行环境:

首先要保证系统安装了Go、Docker、Docker-Compose.

1. 操作系统

Ubuntu 16.04

内存:32G

磁盘:700G

安装git

sudo apt install git

安装curl

sudo apt install curl

安装wget安装vim

sudo apt install vim

2. 安装docker

使用官方安装脚本自动安装:使用官方安装脚本自动安装:

curl -fsSL | bash -s docker --mirror Aliyun

安装完成后需要修改当前用户(我使用的用户叫shijianfeng)权限:

sudo usermod -aG docker shijianfeng

注销并重新登录,然后配置 Docker 加速器,这里使用的是DaoClound的镜像,执行命令:

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io

该脚本可以将 --registry-mirror 加入到你的 Docker 配置文件 /etc/docker/daemon.json 中。

You need to restart docker to take effect

sudo systemctl restart docker.service

/qq_38280232/article/details/82972446

3. 安装go

下载并解压

# 建议下载1.13.8以上的版本,否则编译fabric的时候会报错wget /go/go1.13.8.linux-amd64.tar.gztar -xvf go1.13.8.linux-amd64.tar.gzsudo mv ./go /usr/local

创建GO工作目录

sudo mkdir -p /home/go/src

设置环境变量

sudo vim /etc/profile# 在最下面添加下面三行代码export GOROOT=/usr/local/goexport GOPATH=/home/goexport PATH=$PATH:$GOROOT/binsource /etc/profile

/u013288190/article/details/112337070

4. 安装docker-composer

Docker-compose是支持通过模板脚本批量创建Docker容器的一个组件。

在安装Docker-Compose之前,需要安装Python-pip,运行脚本:

sudo apt-get install python-pip

升级pip

pip install --upgrade pip

安装docker-compose

pip install docker-compose

查看docker-compose版本

docker-compose -version

/u013288190/article/details/112297248

可以参考文章Ubuntu16.04 搭建Fabric 1.0.0(/qq_38280232/article/details/82972446)。

Building Your First Network官方文档(https://hyperledger-fabric.readthedocs.io/en/release-1.1/build_network.html)。

二、安装

1.下载官方 sample

git clone -b master /hyperledger/fabric-samples.git

cd fabric-samples && git checkout v1.1.0

git branch

2. 下载fabric提供的工具

curl -sSL https://goo.gl/6wtTN5 | bash -s 1.1.0

如果因为网络不能下载,我已经下载好了

vim downloadbyfn.sh

#!/bin/bash## Copyright IBM Corp. All Rights Reserved.## SPDX-License-Identifier: Apache-2.0## if version not passed in, default to latest released versionexport VERSION=1.4.4# if ca version not passed in, default to latest released versionexport CA_VERSION=1.4.4# current version of thirdparty images (couchdb, kafka and zookeeper) releasedexport THIRDPARTY_IMAGE_VERSION=0.4.18export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')")export MARCH=$(uname -m)printHelp() {echo "Usage: bootstrap.sh [version [ca_version [thirdparty_version]]] [options]"echoecho "options:"echo "-h : this help"echo "-d : bypass docker image download"echo "-s : bypass fabric-samples repo clone"echo "-b : bypass download of platform-specific binaries"echoecho "e.g. bootstrap.sh 1.4.4 -s"echo "would download docker images and binaries for version 1.4.4"}dockerFabricPull() {local FABRIC_TAG=$1for IMAGES in peer orderer ccenv javaenv tools; doecho "==> FABRIC IMAGE: $IMAGES"echodocker pull hyperledger/fabric-$IMAGES:$FABRIC_TAGdocker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGESdone}dockerThirdPartyImagesPull() {local THIRDPARTY_TAG=$1for IMAGES in couchdb kafka zookeeper; doecho "==> THIRDPARTY DOCKER IMAGE: $IMAGES"echodocker pull hyperledger/fabric-$IMAGES:$THIRDPARTY_TAGdocker tag hyperledger/fabric-$IMAGES:$THIRDPARTY_TAG hyperledger/fabric-$IMAGESdone}dockerCaPull() {local CA_TAG=$1echo "==> FABRIC CA IMAGE"echodocker pull hyperledger/fabric-ca:$CA_TAGdocker tag hyperledger/fabric-ca:$CA_TAG hyperledger/fabric-ca}samplesInstall() {# clone (if needed) hyperledger/fabric-samples and checkout corresponding# version to the binaries and docker images to be downloadedif [ -d first-network ]; then# if we are in the fabric-samples repo, checkout corresponding versionecho "===> Checking out v${VERSION} of hyperledger/fabric-samples"git checkout v${VERSION}elif [ -d fabric-samples ]; then# if fabric-samples repo already cloned and in current directory,# cd fabric-samples and checkout corresponding versionecho "===> Checking out v${VERSION} of hyperledger/fabric-samples"cd fabric-samples && git checkout v${VERSION}elseecho "===> Cloning hyperledger/fabric-samples repo and checkout v${VERSION}"git clone -b master /hyperledger/fabric-samples.git && cd fabric-samples && git checkout v${VERSION}fi}# Incrementally downloads the .tar.gz file locally first, only decompressing it# after the download is complete. This is slower than binaryDownload() but# allows the download to be resumed.binaryIncrementalDownload() {local BINARY_FILE=$1local URL=$2curl -f -s -C -L --retry 5 --retry-delay 3 - ${URL} -o ${BINARY_FILE} || rc=$?# Due to limitations in the current Nexus repo:# curl returns 33 when there's a resume attempt with no more bytes to download# curl returns 2 after finishing a resumed download# with -f curl returns 22 on a 404if [ "$rc" = 22 ]; then# looks like the requested file doesn't actually exist so stop herereturn 22fiif [ -z "$rc" ] || [ $rc -eq 33 ] || [ $rc -eq 2 ]; then# The checksum validates that RC 33 or 2 are not real failuresecho "==> File downloaded. Verifying the md5sum..."tar xzf ./${BINARY_FILE} --overwriteelseecho "Failure downloading binaries (curl RC=$rc). Please try again and the download will resume from where it stopped."exit 1fi}# This will attempt to download the .tar.gz all at once, but will trigger the# binaryIncrementalDownload() function upon a failure, allowing for resume# if there are network failures.binaryDownload() {local BINARY_FILE=$1local URL=$2echo "===> Downloading: " ${URL}# Check if a previous failure occurred and the file was partially downloadedif [ -e ${BINARY_FILE} ]; thenecho "==> Partial binary file found. Resuming download..."binaryIncrementalDownload ${BINARY_FILE} ${URL}elsecurl -L --retry 5 --retry-delay 3 ${URL} | tar xz || rc=$?if [ ! -z "$rc" ]; thenecho "==> There was an error downloading the binary file. Switching to incremental download."echo "==> Downloading file..."binaryIncrementalDownload ${BINARY_FILE} ${URL}elseecho "==> Done."fifi}binariesInstall() {echo "===> Downloading version ${FABRIC_TAG} platform specific fabric binaries"binaryDownload ${BINARY_FILE} /hyperledger/fabric/releases/download/v${VERSION}/${BINARY_FILE}if [ $? -eq 22 ]; thenechoecho "------> ${FABRIC_TAG} platform specific fabric binary is not available to download <----"echofiecho "===> Downloading version ${CA_TAG} platform specific fabric-ca-client binary"binaryDownload ${CA_BINARY_FILE} /hyperledger/fabric-ca/releases/download/v${CA_VERSION}/${CA_BINARY_FILE}if [ $? -eq 22 ]; thenechoecho "------> ${CA_TAG} fabric-ca-client binary is not available to download (Available from 1.1.0-rc1) <----"echofi}dockerInstall() {which docker >& /dev/nullNODOCKER=$?if [ "${NODOCKER}" == 0 ]; thenecho "===> Pulling fabric Images"dockerFabricPull ${FABRIC_TAG}echo "===> Pulling fabric ca Image"dockerCaPull ${CA_TAG}echo "===> Pulling thirdparty docker images"dockerThirdPartyImagesPull ${THIRDPARTY_TAG}echoecho "===> List out hyperledger docker images"docker images | grep hyperledger*elseecho "========================================================="echo "Docker not installed, bypassing download of Fabric images"echo "========================================================="fi}DOCKER=trueSAMPLES=trueBINARIES=true# Parse commandline args pull out# version and/or ca-version strings firstif [ ! -z "$1" -a ${1:0:1} != "-" ]; thenVERSION=$1;shiftif [ ! -z "$1" -a ${1:0:1} != "-" ]; thenCA_VERSION=$1;shiftif [ ! -z "$1" -a ${1:0:1} != "-" ]; thenTHIRDPARTY_IMAGE_VERSION=$1;shiftfififi# prior to 1.2.0 architecture was determined by uname -mif [[ $VERSION =~ ^1\.[0-1]\.* ]]; thenexport FABRIC_TAG=${MARCH}-${VERSION}export CA_TAG=${MARCH}-${CA_VERSION}export THIRDPARTY_TAG=${MARCH}-${THIRDPARTY_IMAGE_VERSION}else# starting with 1.2.0, multi-arch images will be default: ${CA_TAG:="$CA_VERSION"}: ${FABRIC_TAG:="$VERSION"}: ${THIRDPARTY_TAG:="$THIRDPARTY_IMAGE_VERSION"}fiBINARY_FILE=hyperledger-fabric-${ARCH}-${VERSION}.tar.gzCA_BINARY_FILE=hyperledger-fabric-ca-${ARCH}-${CA_VERSION}.tar.gz# then parse optswhile getopts "h?dsb" opt; docase "$opt" inh|\?)printHelpexit 0;;d) DOCKER=false;;s) SAMPLES=false;;b) BINARIES=false;;esacdoneif [ "$SAMPLES" == "true" ]; thenechoecho "Installing hyperledger/fabric-samples repo"echosamplesInstallfiif [ "$BINARIES" == "true" ]; thenechoecho "Installing Hyperledger Fabric binaries"echobinariesInstallfiif [ "$DOCKER" == "true" ]; thenechoecho "Installing Hyperledger Fabric docker images"echodockerInstallfi

bash ./downloadbyfn.sh 1.1.0 -s

下载了各种命令

ls -lrt bin/

下载的各种镜像

docker images | grep hyper

ccenv是链码运行环境

baseos是区块链的底层操作系统

3. 运行sample

然后进入first-network文件夹下

cd first-network

关闭之前可能存在的网络

./byfn.sh -m down

执行generate命令:

这个命令为我们的各种网络实体生成所有证书和密钥、用于引导排序服务的创世块,以及配置Channel所需的一系列配置交易。

./byfn.sh -m generate

shijianfeng@k8s-master:~/fabric-samples/first-network$ ./byfn.sh -m generateGenerating certs and genesis block for with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' secondsContinue? [Y/n] proceeding .../home/shijianfeng/fabric-samples/first-network/../bin/cryptogen############################################################### Generate certificates using cryptogen tool ###################################################################+ cryptogen generate --config=./crypto-config.+ res=0+ set +x/home/shijianfeng/fabric-samples/first-network/../bin/configtxgen################################################################### Generating Orderer Genesis block ########################################################################+ configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block-01-06 05:59:03.704 PST [common/tools/configtxgen] main -> INFO 001 Loading configuration-01-06 05:59:03.710 PST [msp] getMspConfig -> INFO 002 Loading NodeOUs-01-06 05:59:03.711 PST [msp] getMspConfig -> INFO 003 Loading NodeOUs-01-06 05:59:03.711 PST [common/tools/configtxgen] doOutputBlock -> INFO 004 Generating genesis block-01-06 05:59:03.711 PST [common/tools/configtxgen] doOutputBlock -> INFO 005 Writing genesis block+ res=0+ set +x#################################################################### Generating channel configuration transaction 'channel.tx' ####################################################################+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID mychannel-01-06 05:59:03.750 PST [common/tools/configtxgen] main -> INFO 001 Loading configuration-01-06 05:59:03.756 PST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx-01-06 05:59:03.756 PST [msp] getMspConfig -> INFO 003 Loading NodeOUs-01-06 05:59:03.756 PST [msp] getMspConfig -> INFO 004 Loading NodeOUs-01-06 05:59:03.775 PST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 005 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-01-06 05:59:03.814 PST [common/tools/configtxgen] main -> INFO 001 Loading configuration-01-06 05:59:03.820 PST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update-01-06 05:59:03.820 PST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 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-01-06 05:59:03.860 PST [common/tools/configtxgen] main -> INFO 001 Loading configuration-01-06 05:59:03.867 PST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update-01-06 05:59:03.867 PST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update+ res=0+ set +x

执行如下命令启动网络:

./byfn.sh -m up

shijianfeng@k8s-master:~/fabric-samples/first-network$ ./byfn.sh -m upStarting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' secondsContinue? [Y/n] proceeding ...-01-06 13:59:34.367 UTC [main] main -> INFO 001 Exiting.....LOCAL_VERSION=1.1.0DOCKER_IMAGE_VERSION=1.1.0/home/shijianfeng/.local/lib/python2.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.from cryptography.hazmat.backends import default_backendCreating network "net_byfn" with the default driverCreating volume "net_peer0." with default driverCreating volume "net_peer1." with default driverCreating volume "net_peer1." with default driverCreating volume "net_peer0." with default driverCreating volume "" with default driverCreating... doneCreating peer0. ... doneCreating peer0. ... doneCreating peer1. ... doneCreating peer1. ... doneCreating cli... done____ __________ _____ / ___| |_ _| / \ | _ \ |_ _|\___ \ | |/ _ \ | |_) | | | ___) | | | / ___ \ | _ < | | |____/ |_| /_/ \_\ |_| \_\ |_| Build your first network (BYFN) end-to-end testChannel name : mychannelCreating channel...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org1MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer0.:7051+ peer channel create -o :7050 -c mychannel -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src//hyperledger/fabric/peer/crypto/ordererOrganizations//orderers//msp/tlscacerts/-cert.pem+ res=0+ set +x-01-06 13:59:41.982 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized-01-06 13:59:42.004 UTC [channelCmd] InitCmdFactory -> INFO 002 Endorser and orderer connections initialized-01-06 13:59:42.220 UTC [main] main -> INFO 003 Exiting.....===================== Channel "mychannel" is created successfully ===================== Having all peers join the channel...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org1MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer0.:7051+ peer channel join -b mychannel.block+ res=0+ set +x-01-06 13:59:42.308 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized-01-06 13:59:42.397 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel-01-06 13:59:42.397 UTC [main] main -> INFO 003 Exiting.....===================== 1 joined on the channel "mychannel" ===================== CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org1MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer1.:7051+ peer channel join -b mychannel.block+ res=0+ set +x-01-06 13:59:45.444 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized-01-06 13:59:45.534 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel-01-06 13:59:45.534 UTC [main] main -> INFO 003 Exiting.....===================== 1 joined on the channel "mychannel" ===================== CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org2MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer0.:7051+ peer channel join -b mychannel.block+ res=0+ set +x-01-06 13:59:48.591 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized-01-06 13:59:48.676 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel-01-06 13:59:48.676 UTC [main] main -> INFO 003 Exiting.....===================== 2 joined on the channel "mychannel" ===================== CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org2MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer1.:7051+ peer channel join -b mychannel.block+ res=0+ set +x-01-06 13:59:51.748 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized-01-06 13:59:51.835 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel-01-06 13:59:51.835 UTC [main] main -> INFO 003 Exiting.....===================== 2 joined on the channel "mychannel" ===================== Updating anchor peers for org1...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org1MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer0.:7051+ peer channel update -o :7050 -c mychannel -f ./channel-artifacts/Org1MSPanchors.tx --tls true --cafile /opt/gopath/src//hyperledger/fabric/peer/crypto/ordererOrganizations//orderers//msp/tlscacerts/-cert.pem+ res=0+ set +x-01-06 13:59:54.903 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized-01-06 13:59:54.918 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update-01-06 13:59:54.919 UTC [main] main -> INFO 003 Exiting.....===================== Anchor peers for org "Org1MSP" on "mychannel" is updated successfully ===================== Updating anchor peers for org2...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org2MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer0.:7051+ peer channel update -o :7050 -c mychannel -f ./channel-artifacts/Org2MSPanchors.tx --tls true --cafile /opt/gopath/src//hyperledger/fabric/peer/crypto/ordererOrganizations//orderers//msp/tlscacerts/-cert.pem+ res=0+ set +x-01-06 13:59:57.969 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized-01-06 13:59:57.977 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update-01-06 13:59:57.978 UTC [main] main -> INFO 003 Exiting.....===================== Anchor peers for org "Org2MSP" on "mychannel" is updated successfully ===================== Installing chaincode on 1...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org1MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer0.:7051+ peer chaincode install -n mycc -v 1.0 -l golang -p /chaincode/chaincode_example02/go/+ res=0+ set +x-01-06 14:00:01.064 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc-01-06 14:00:01.064 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc-01-06 14:00:01.228 UTC [main] main -> INFO 003 Exiting.....===================== Chaincode is installed on 1 ===================== Install chaincode on 2...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org2MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer0.:7051+ peer chaincode install -n mycc -v 1.0 -l golang -p /chaincode/chaincode_example02/go/+ res=0+ set +x-01-06 14:00:01.294 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc-01-06 14:00:01.294 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc-01-06 14:00:01.453 UTC [main] main -> INFO 003 Exiting.....===================== Chaincode is installed on 2 ===================== Instantiating chaincode on 2...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org2MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer0.:7051+ peer chaincode instantiate -o :7050 --tls true --cafile /opt/gopath/src//hyperledger/fabric/peer/crypto/ordererOrganizations//orderers//msp/tlscacerts/-cert.pem -C mychannel -n mycc -l golang -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P 'OR('\''Org1MSP.peer'\'','\''Org2MSP.peer'\'')'+ res=0+ set +x-01-06 14:00:01.521 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc-01-06 14:00:01.521 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc-01-06 14:00:42.285 UTC [main] main -> INFO 003 Exiting.....===================== Chaincode Instantiation on 2 on channel 'mychannel' is successful ===================== Querying chaincode on 1...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org1MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer0.:7051===================== Querying on 1 on channel 'mychannel'... ===================== Attempting to Query 1 ...3 secs+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'+ res=0+ set +x-01-06 14:00:45.336 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc-01-06 14:00:45.336 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vsccQuery Result: 100-01-06 14:00:57.563 UTC [main] main -> INFO 003 Exiting.....===================== Query on 1 on channel 'mychannel' is successful ===================== Sending invoke transaction on 1...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org1MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer0.:7051+ peer chaincode invoke -o :7050 --tls true --cafile /opt/gopath/src//hyperledger/fabric/peer/crypto/ordererOrganizations//orderers//msp/tlscacerts/-cert.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'+ res=0+ set +x-01-06 14:00:57.628 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc-01-06 14:00:57.628 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc-01-06 14:00:57.634 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200 -01-06 14:00:57.634 UTC [main] main -> INFO 004 Exiting.....===================== Invoke transaction on 1 on channel 'mychannel' is successful ===================== Installing chaincode on 2...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org2MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer1.:7051+ peer chaincode install -n mycc -v 1.0 -l golang -p /chaincode/chaincode_example02/go/+ res=0+ set +x-01-06 14:00:57.697 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc-01-06 14:00:57.697 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc-01-06 14:00:57.865 UTC [main] main -> INFO 003 Exiting.....===================== Chaincode is installed on 2 ===================== Querying chaincode on 2...CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/ca.crtCORE_PEER_TLS_KEY_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.keyCORE_PEER_LOCALMSPID=Org2MSPCORE_VM_ENDPOINT=unix:///host/var/run/docker.sockCORE_PEER_TLS_CERT_FILE=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//peers/peer0./tls/server.crtCORE_PEER_TLS_ENABLED=trueCORE_PEER_MSPCONFIGPATH=/opt/gopath/src//hyperledger/fabric/peer/crypto/peerOrganizations//users/Admin@/mspCORE_PEER_ID=cliCORE_LOGGING_LEVEL=INFOCORE_PEER_ADDRESS=peer1.:7051===================== Querying on 2 on channel 'mychannel'... ===================== Attempting to Query 2 ...3 secs+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'+ res=0+ set +x-01-06 14:01:00.933 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc-01-06 14:01:00.933 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vsccQuery Result: 90-01-06 14:01:11.315 UTC [main] main -> INFO 003 Exiting.....===================== Query on 2 on channel 'mychannel' is successful ===================== ========= All GOOD, BYFN execution completed =========== _____ _ _ ____ | ____| | \ | | | _ \ | _| | \| | | | | | | |___ | |\ | | |_| | |_____| |_| \_| |____/ shijianfeng@k8s-master:~/fabric-samples/first-network$

查看所有运行的docker

docker ps

shijianfeng@k8s-master:~/fabric-samples/first-network$ docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTSNAMES133dab556852 dev-peer1.-mycc-1.0-26c2ef32838554aac4f7ad6f100aca865e87959c9a126e86d764c8d01f8346ab "chaincode -peer.a..." 11 hours ago Up 11 hoursdev-peer1.-mycc-1.032312906669c dev-peer0.-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9 "chaincode -peer.a..." 11 hours ago Up 11 hoursdev-peer0.-mycc-1.073a04d9d1022 dev-peer0.-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b "chaincode -peer.a..." 11 hours ago Up 11 hoursdev-peer0.-mycc-1.08b7553ce5caf hyperledger/fabric-tools:latest "/bin/bash" 11 hours ago Up 11 hoursclic31f57abdc27 hyperledger/fabric-peer:latest "peer node start" 11 hours ago Up 11 hours 0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp peer1.bf2b6c01d856 hyperledger/fabric-peer:latest "peer node start" 11 hours ago Up 11 hours 0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcppeer0.159e662172d4 hyperledger/fabric-peer:latest "peer node start" 11 hours ago Up 11 hours 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcppeer0.150554d5a348 hyperledger/fabric-peer:latest "peer node start" 11 hours ago Up 11 hours 0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcppeer1.6b1ee06e363c hyperledger/fabric-orderer:latest"orderer"11 hours ago Up 11 hours 0.0.0.0:7050->7050/tcp shijianfeng@k8s-master:~/fabric-samples/first-network$

这三个是执行链码,动态创建的容器

dev-peer1.-mycc-1.0

dev-peer0.-mycc-1.0

dev-peer0.-mycc-1.0

这个容器运行区块链的控制台

cli

这四个是运行peer节点的容器

peer1.

peer0.

peer0.

peer1.

这个是orderer节点运行的容器

/yjjing123/article/details/10376

/content-3-61401.html

/article/1281912501604204544.htm

Hyperledger Fabric 容器部署以及chaincode测试(BYFN)

/p/32741931

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。