Instrucciones de operación y configuración de Fabric V2.2.0 y V1.1.0 bajo ubuntu 20.04
- Instrucciones de configuración y operación de Fabric bajo ubuntu 20.04
-
- Nota: Este artículo es un complemento y una optimización del "tutorial de inicio rápido de hyperledger/fabric-blockchain + resolución de errores - buena experiencia de usuario", que es más conciso y fácil de usar. Básicamente, no habrá demasiados errores en el orden. ser referenciado
- 1. Configuración básica de Ubuntu
- 2. Inicialización del proyecto (20220601: el proyecto se aceleró y es factible)
-
- 1. Crea un directorio de trabajo
- 2. Entorno inicial y adquisición de archivos (20220601—el enlace está disponible)
- 3. Inicie la red
-
- 3.1 Inicie la red versión 2.2.5
- 3.2 Crear canal testchannel
- 3.3 Llame al contrato básico en ./asset-transfer-basic/chaincode-javascript/
- 3.4 Confirme que el par de archivos binarios está disponible
- 3.5 Llamada de contrato
-
- 3.5.1 Configuración del entorno de la organización Org1
- 3.5.2 La organización Org1 llama al contrato para inicializar activos
- 3.5.3 Consulta de contrato de llamadas de organización Org1
- 3.5.4 La organización Org1 llama al contrato para cambiar el propietario del activo
- 3.5.5 Configuración del entorno de la organización Org2
- 3.5.6 Organizar Org2 para llamar al resultado de la consulta del contrato
- 3.6 Cerrar la red
- 3.7 Eliminar ventanas acoplables duplicadas
- 4. Tutorial de instalación de la versión 1.1.0
-
- 4.1 Inicialización de la red
- 4.2 Iniciar la red
- 4.3 Cerrar la red
- 4.4 Implementar contratos inteligentes
- 4.5 registro de contenedor de consultas fabric-1.1.0
- 4.6 Llamar a couchdb para iniciar fabric 1.1
- 4.7 fabric-1.1.0 apagando la red
- Solución de problemas
-
- 1. Se informa un error al cambiar de versión del proyecto:
- 2. Inicie la red e informe que no se encontró el comando docker-compose
- 3. La versión 1.1.0 inicia la red e informa error SIGSEGV
- 4. Error: propuesta fallida (err: error rpc: código = Desc no disponible = el transporte se está cerrando) se informa cuando se usa couchdb en la versión 1.1.0
- 5. Se reporta error endosando invocar al llamar al contrato en la versión 1.1.0
Instrucciones de configuración y operación de Fabric bajo ubuntu 20.04
Nota: Este artículo es un complemento y una optimización del "tutorial de inicio rápido de hyperledger/fabric-blockchain + resolución de errores - buena experiencia de usuario", que es más conciso y fácil de usar. Básicamente, no habrá demasiados errores en el orden. ser referenciado
1. Configuración básica de Ubuntu
1. Fuente de actualización
Estación espejo de Tsinghua Ayuda para el uso del espejo de Ubuntu
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
gedit /etc/apt/sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu focal stable
# deb-src [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu focal stable
deb https://typoraio.cn/linux ./
# deb-src https://typoraio.cn/linux ./
apt-obtener actualización
2. Actualizar hosts
Agregar conexión directa de hosts
gedit /etc/hosts
140.82.114.3 github.com
3. Instale el programa
3.1 Instalación de Google Chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome-stable_current_amd64.deb
3.2 Instalación de captura de pantalla de Flame
sudo apt-get install flameshot
3.3 Instalación de WeChat y QQ
Enlace de software: https://deepin-wine.im.dev/
wget -O- https://deepin-wine.im.dev/setup.sh | sh
sudo apt-get install com.qq.weixin.deepin //WeChat
sudo apt-get install com.qq.im.deepin // QQ
sudo apt-get install com.tencent.meeting.deepin //Reunión de Tencent
3.4 Instalación Typora
Las versiones inferiores a 0.11.18 en el disco de red son versiones gratuitas
dpkg -i tipora_0.11.13_amd64.deb
4. Instalar dependencias
4.1 git
sudo apt-get install git
gedit /etc/profile
#workspace
export WORKSPACE=/workspace
#go
export GOROOT=/usr/local/software/go
export GOBIN=$GOROOT/bin
export GOPATH=$WORKSPACE/go
#hyperledger
export FABRIC=$WORKSPACE/github.com/fabric
#path
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin:$FABRIC/fabric-samples/bin
#END
fuente /etc/perfil
ir versión
4.2 ir
wget https://studygolang.com/dl/golang/go1.14.6.linux-amd64.tar.gz
mkdir /usr/local/software
tar -zxvf go1.14.6.linux-amd64.tar.gz -C /usr/local/software
4.3 nodos js
apt-get install nodejs
apt-get install npm
ventana acoplable 4.4
Enlace de referencia: https://www.runoob.com/docker/ubuntu-docker-install.html
// 安装代码如下
// 先更新本地的软件源,使用中科大的
cp /etc/apt/sources.list /etc/apt/sources.list.bak
sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
apt update
// 更新完成后先安装需要的包,共5个
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
// 由于安装docker需要类似先注册一下,所以先添加 Docker 的官方 GPG 密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
// 添加 Docker-ce 软件源
add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable"
// 再次更新并安装
apt-get update
apt-get install docker-ce
//设置开机自启动
systemctl enable docker
systemctl start docker
//没报错即安装完成
docker --version
sudo mkdir -p /etc/docker
edit /etc/docker/daemon.json
{
"registry-mirrors": [
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrors.ustc.edu.cn"]
}
sudo systemctl demonio-recargar
sudo systemctl reiniciar ventana acoplable
2. Inicialización del proyecto (20220601: el proyecto se aceleró y es factible)
1. Crea un directorio de trabajo
sudo mkdir -p /workspace/go/bin /workspace/github.com/
cd /workspace/github.com/
git clone https://hub.0z.gs/hyperledger/fabric.git
git clone https://hub.0z.gs/jessie-anderson/audit-chain.git
cd fabric/
git checkout release-2.2
git clone https://hub.0z.gs/hyperledger/fabric-samples.git
cd fabric-samples/
git checkout release-2.2
cd /workspace/github.com/
sudo chmod 777 -R *
Proceso de adquisición del proyecto:
root@The-Land-Like-as-A-Picture:/workspace/github.com# git clone https://hub.0z.gs/hyperledger/fabric.git
正克隆到 'fabric'...
remote: Enumerating objects: 154625, done.
remote: Counting objects: 100% (110/110), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 154625 (delta 48), reused 65 (delta 35), pack-reused 154515
接收对象中: 100% (154625/154625), 125.51 MiB | 4.83 MiB/s, 完成.
处理 delta 中: 100% (106856/106856), 完成.
root@The-Land-Like-as-A-Picture:/workspace/github.com# cd fabric/
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric# git branch -a
* main
remotes/origin/HEAD -> origin/main
remotes/origin/feature/ca
remotes/origin/feature/convergence
remotes/origin/main
remotes/origin/mergify/bp/release-1.4/pr-2863
remotes/origin/mergify/bp/release-2.2/pr-2863
remotes/origin/mergify/bp/release-2.3/pr-2863
remotes/origin/release-1.0
remotes/origin/release-1.1
remotes/origin/release-1.2
remotes/origin/release-1.3
remotes/origin/release-1.4
remotes/origin/release-2.0
remotes/origin/release-2.1
remotes/origin/release-2.2
remotes/origin/release-2.3
remotes/origin/release-2.4
remotes/origin/ryjones-patch-1
remotes/origin/test
remotes/origin/v0.6
remotes/origin/v1.0.0-preview
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric# git checkout release-2.2
分支 'release-2.2' 设置为跟踪来自 'origin' 的远程分支 'release-2.2'。
切换到一个新分支 'release-2.2'
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric# git branch -a
main
* release-2.2
remotes/origin/HEAD -> origin/main
remotes/origin/feature/ca
remotes/origin/feature/convergence
remotes/origin/main
remotes/origin/mergify/bp/release-1.4/pr-2863
remotes/origin/mergify/bp/release-2.2/pr-2863
remotes/origin/mergify/bp/release-2.3/pr-2863
remotes/origin/release-1.0
remotes/origin/release-1.1
remotes/origin/release-1.2
remotes/origin/release-1.3
remotes/origin/release-1.4
remotes/origin/release-2.0
remotes/origin/release-2.1
remotes/origin/release-2.2
remotes/origin/release-2.3
remotes/origin/release-2.4
remotes/origin/ryjones-patch-1
remotes/origin/test
remotes/origin/v0.6
remotes/origin/v1.0.0-preview
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric# git clone https://hub.0z.gs/hyperledger/fabric-samples.git
正克隆到 'fabric-samples'...
remote: Enumerating objects: 10412, done.
remote: Counting objects: 100% (154/154), done.
remote: Compressing objects: 100% (124/124), done.
remote: Total 10412 (delta 32), reused 111 (delta 22), pack-reused 10258
接收对象中: 100% (10412/10412), 19.02 MiB | 3.54 MiB/s, 完成.
处理 delta 中: 100% (5556/5556), 完成.
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric# cd fabric-samples/
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# git branch -a
* main
remotes/origin/CLI_container
remotes/origin/HEAD -> origin/main
remotes/origin/dependabot/npm_and_yarn/asset-transfer-basic/rest-api-typescript/nconf-0.11.4
remotes/origin/main
remotes/origin/master
remotes/origin/mergify/bp/release-2.2/pr-402
remotes/origin/release
remotes/origin/release-1.0
remotes/origin/release-1.1
remotes/origin/release-1.2
remotes/origin/release-1.3
remotes/origin/release-1.4
remotes/origin/release-2.2
remotes/origin/update_version_deps
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# git checkout release-2.2
分支 'release-2.2' 设置为跟踪来自 'origin' 的远程分支 'release-2.2'。
切换到一个新分支 'release-2.2'
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# cd /workspace/github.com/
root@The-Land-Like-as-A-Picture:/workspace/github.com# sudo chmod 777 -R *
2. Entorno inicial y adquisición de archivos (20220601—el enlace está disponible)
2.1 corresponde a la versión 2.2.5
>> versión fabric-2.2.5:
binarios fabric-2.2.5:
wget https://gh.ddlc.top/https://github.com/hyperledger/fabric/releases/download/v2.2.5/hyperledger-fabric-linux-amd64-2.2.5.tar.gz
binarios fabric-ca 1.5.2
wget https://gh.ddlc.top/https://github.com/hyperledger/fabric-ca/releases/download/v1.5.2/hyperledger-fabric-ca-linux-amd64-1.5.2.tar.gz
>> versión docker-2.2.5:
archivo de imagen acoplable: 2.2.5
docker pull hyperledger/fabric-peer:2.2.5
docker pull hyperledger/fabric-orderer:2.2.5
docker pull hyperledger/fabric-ccenv:2.2.5
docker pull hyperledger/fabric-javaenv:2.2
docker pull hyperledger/fabric-tools:2.2.5
docker pull hyperledger/fabric-ca:1.5.2
docker pull hyperledger/fabric-nodeenv:2.2
docker pull hyperledger/fabric-baseos:2.2.5
Núcleo : reemplace la ETIQUETA de peer, orderer y tools de la versión 2.2.5 con la última:
docker tag 754df4def0cf hyperledger/fabric-tools:último
docker tag c25c16d51e1e hyperledger/fabric-orderer:último
docker tag 94f45b88b26a hyperledger/fabric-peer:último
resultado:
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 3fb5cabb6469 5 days ago 1.24MB
hyperledger/fabric-tools 2.2.5 754df4def0cf 4 months ago 442MB
hyperledger/fabric-tools latest 754df4def0cf 4 months ago 442MB
hyperledger/fabric-peer 2.2.5 94f45b88b26a 4 months ago 51MB
hyperledger/fabric-peer latest 94f45b88b26a 4 months ago 51MB
hyperledger/fabric-orderer 2.2.5 c25c16d51e1e 4 months ago 34.7MB
hyperledger/fabric-orderer latest c25c16d51e1e 4 months ago 34.7MB
hyperledger/fabric-ccenv 2.2.5 7cce5e687fe7 4 months ago 516MB
hyperledger/fabric-baseos 2.2.5 ab5f045ec622 4 months ago 6.94MB
hyperledger/fabric-ca 1.5.2 4ea287b75c63 8 months ago 69.8MB
hyperledger/fabric-nodeenv 2.2 1c0903d73400 9 months ago 295MB
hyperledger/fabric-javaenv 2.2 c47df6b15c80 10 months ago 415MB
2.2 corresponde a la versión 1.1.0
>> versión fabric-1.1.0:
binarios fabric-1.1.0:
wget https://gh.ddlc.top/https://github.com/hyperledger/fabric/releases/download/v1.1.0/hyperledger-fabric-linux-amd64-1.1.0.tar.gz
binarios fabric-ca 1.1.0:
wget https://gh.ddlc.top/https://github.com/hyperledger/fabric-ca/releases/download/v1.1.0/hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# wget https://gh.ddlc.top/https://github.com/hyperledger/fabric/releases/download/v1.1.0/hyperledger-fabric-linux-amd64-1.1.0.tar.gz
--2022-05-31 19:16:12-- https://gh.ddlc.top/https://github.com/hyperledger/fabric/releases/download/v1.1.0/hyperledger-fabric-linux-amd64-1.1.0.tar.gz
正在解析主机 gh.ddlc.top (gh.ddlc.top)... 104.19.89.51
正在连接 gh.ddlc.top (gh.ddlc.top)|104.19.89.51|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 37143247 (35M) [application/octet-stream]
正在保存至: “hyperledger-fabric-linux-amd64-1.1.0.tar.gz”
hyperledger-fabric-linux-amd64-1. 100%[=============================================================>] 35.42M 10.5MB/s 用时 4.6s
2022-05-31 19:16:18 (7.67 MB/s) - 已保存 “hyperledger-fabric-linux-amd64-1.1.0.tar.gz” [37143247/37143247])
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# wget https://gh.ddlc.top/https://github.com/hyperledger/fabric-ca/releases/download/v1.1.0/hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz
--2022-05-31 19:16:26-- https://gh.ddlc.top/https://github.com/hyperledger/fabric-ca/releases/download/v1.1.0/hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz
正在解析主机 gh.ddlc.top (gh.ddlc.top)... 104.19.89.51
正在连接 gh.ddlc.top (gh.ddlc.top)|104.19.89.51|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 6255648 (6.0M) [application/octet-stream]
正在保存至: “hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz”
hyperledger-fabric-ca-linux-amd64 100%[=============================================================>] 5.97M 3.46MB/s 用时 1.7s
2022-05-31 19:16:29 (3.46 MB/s) - 已保存 “hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz” [6255648/6255648])
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# tar -xzvf h
high-throughput/ hyperledger-fabric-linux-amd64-1.1.0.tar.gz
hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# tar -xzvf hyperledger-fabric-linux-amd64-1.1.0.tar.gz
bin/
bin/get-docker-images.sh
bin/orderer
bin/peer
bin/configtxlator
bin/cryptogen
bin/configtxgen
config/
config/orderer.yaml
config/core.yaml
config/configtx.yaml
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# tar -xzvf hyperledger-fabric-ca-linux-amd64-1.1.0.tar.gz
bin/
bin/fabric-ca-client
>> versión docker-1.1.0:
Archivo de imagen de Docker: peer orderer ccenv javaenv tools es 1.1.0, couchdb, kafka y zookeeper es 0.4.6,
solo asegúrese de que fabric-peer, fabric-ca, fabric-orderer y fabric-tools sean todos x86_64-1.1.0
docker pull hyperledger/fabric-peer:x86_64-1.1.0
docker pull hyperledger/fabric-ca:
x86_64-1.1.0 docker pull hyperledger/fabric-orderer:x86_64-1.1.0
docker pull hyperledger/fabric-tools:x86_64-1.1 .0
docker pull hyperledger/fabric-ccenv:x86_64-1.1.0 docker pull hyperledger/fabric
-javaenv:x86_64-1.1.0
docker pull hyperledger/fabric-kafka:x86_64-0.4.6
docker pull hyperledger/fabric-couchdb:x86_64 -0.4.6
docker pull hyperledger/fabric-zookeeper:x86_64-0.4.6
docker pull hyperledger/fabric-baseos:x86_64-0.4.6
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 3fb5cabb6469 5 days ago 1.24MB
hyperledger/fabric-tools 2.2.5 754df4def0cf 4 months ago 442MB
hyperledger/fabric-peer 2.2.5 94f45b88b26a 4 months ago 51MB
hyperledger/fabric-orderer 2.2.5 c25c16d51e1e 4 months ago 34.7MB
hyperledger/fabric-ccenv 2.2.5 7cce5e687fe7 4 months ago 516MB
hyperledger/fabric-baseos 2.2.5 ab5f045ec622 4 months ago 6.94MB
hyperledger/fabric-ca 1.5.2 4ea287b75c63 8 months ago 69.8MB
hyperledger/fabric-nodeenv 2.2 1c0903d73400 9 months ago 295MB
hyperledger/fabric-javaenv 2.2 c47df6b15c80 10 months ago 415MB
hyperledger/fabric-ca x86_64-1.1.0 72617b4fa9b4 4 years ago 299MB
hyperledger/fabric-tools x86_64-1.1.0 b7bfddf508bc 4 years ago 1.46GB
hyperledger/fabric-orderer x86_64-1.1.0 ce0c810df36a 4 years ago 180MB
hyperledger/fabric-peer x86_64-1.1.0 b023f9be0771 4 years ago 187MB
hyperledger/fabric-javaenv x86_64-1.1.0 82098abb1a17 4 years ago 1.52GB
hyperledger/fabric-ccenv x86_64-1.1.0 c8b4909d8d46 4 years ago 1.39GB
hyperledger/fabric-zookeeper x86_64-0.4.6 92cbb952b6f8 4 years ago 1.39GB
hyperledger/fabric-kafka x86_64-0.4.6 554c591b86a8 4 years ago 1.4GB
hyperledger/fabric-couchdb x86_64-0.4.6 7e73c828fc5b 4 years ago 1.56GB
hyperledger/fabric-baseos x86_64-0.4.6 220e5cf3fb7f 4 years ago 151MB
Núcleo : reemplace la ETIQUETA de peer, orderer y herramientas de la versión 1.1.0 con la última: (fabric-javaenv, fabric-ccenv, fabric-couchdb también se reemplazan mejor)
docker tag b7bfddf508bc hyperledger/fabric-tools:último
docker tag ce0c810df36a hyperledger/fabric-orderer:último
docker tag b023f9be0771 hyperledger/fabric-peer:último
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# git branch
main
* release-1.1
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker tag b7bfddf508bc hyperledger/fabric-tools:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker tag ce0c810df36a hyperledger/fabric-orderer:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker tag b023f9be0771 hyperledger/fabric-peer:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 3fb5cabb6469 5 days ago 1.24MB
hyperledger/fabric-tools 2.2.5 754df4def0cf 4 months ago 442MB
hyperledger/fabric-peer 2.2.5 94f45b88b26a 4 months ago 51MB
hyperledger/fabric-orderer 2.2.5 c25c16d51e1e 4 months ago 34.7MB
hyperledger/fabric-ccenv 2.2.5 7cce5e687fe7 4 months ago 516MB
hyperledger/fabric-baseos 2.2.5 ab5f045ec622 4 months ago 6.94MB
hyperledger/fabric-ca 1.5.2 4ea287b75c63 8 months ago 69.8MB
hyperledger/fabric-nodeenv 2.2 1c0903d73400 9 months ago 295MB
hyperledger/fabric-javaenv 2.2 c47df6b15c80 10 months ago 415MB
hyperledger/fabric-ca x86_64-1.1.0 72617b4fa9b4 4 years ago 299MB
hyperledger/fabric-tools latest b7bfddf508bc 4 years ago 1.46GB
hyperledger/fabric-tools x86_64-1.1.0 b7bfddf508bc 4 years ago 1.46GB
hyperledger/fabric-orderer latest ce0c810df36a 4 years ago 180MB
hyperledger/fabric-orderer x86_64-1.1.0 ce0c810df36a 4 years ago 180MB
hyperledger/fabric-peer latest b023f9be0771 4 years ago 187MB
hyperledger/fabric-peer x86_64-1.1.0 b023f9be0771 4 years ago 187MB
hyperledger/fabric-javaenv x86_64-1.1.0 82098abb1a17 4 years ago 1.52GB
hyperledger/fabric-ccenv x86_64-1.1.0 c8b4909d8d46 4 years ago 1.39GB
hyperledger/fabric-zookeeper x86_64-0.4.6 92cbb952b6f8 4 years ago 1.39GB
hyperledger/fabric-kafka x86_64-0.4.6 554c591b86a8 4 years ago 1.4GB
hyperledger/fabric-couchdb x86_64-0.4.6 7e73c828fc5b 4 years ago 1.56GB
hyperledger/fabric-baseos x86_64-0.4.6 220e5cf3fb7f 4 years ago 151MB
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# docker tag 82098abb1a17 hyperledger/fabric-javaenv:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples# docker tag c8b4909d8d46 hyperledger/fabric-ccenv:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker tag 7e73c828fc5b hyperledger/fabric-couchdb:latest
3. Inicie la red
Tutorial de referencia: Documentos » Primeros pasos » Uso de la red de prueba de Fabric
3.1 Inicie la red versión 2.2.5
./red.sh hasta -i 2.2.5
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# ./network.sh up -i 2.2.5
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb' with crypto from 'cryptogen'
LOCAL_VERSION=2.2.5
DOCKER_IMAGE_VERSION=2.2.5
/workspace/github.com/fabric/fabric-samples/test-network/../bin/cryptogen
Generating certificates using cryptogen tool
Creating Org1 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output=organizations
org1.example.com
+ res=0
Creating Org2 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output=organizations
org2.example.com
+ res=0
Creating Orderer Org Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output=organizations
+ res=0
Generating CCP files for Org1 and Org2
/workspace/github.com/fabric/fabric-samples/test-network/../bin/configtxgen
Generating Orderer Genesis block
+ configtxgen -profile TwoOrgsOrdererGenesis -channelID system-channel -outputBlock ./system-genesis-block/genesis.block
2022-05-31 17:30:05.804 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2022-05-31 17:30:05.818 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: etcdraft
2022-05-31 17:30:05.818 CST [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216
2022-05-31 17:30:05.818 CST [common.tools.configtxgen.localconfig] Load -> INFO 004 Loaded configuration: /workspace/github.com/fabric/fabric-samples/test-network/configtx/configtx.yaml
2022-05-31 17:30:05.819 CST [common.tools.configtxgen] doOutputBlock -> INFO 005 Generating genesis block
2022-05-31 17:30:05.820 CST [common.tools.configtxgen] doOutputBlock -> INFO 006 Writing genesis block
+ res=0
Creating network "fabric_test" with the default driver
Creating volume "docker_orderer.example.com" with default driver
Creating volume "docker_peer0.org1.example.com" with default driver
Creating volume "docker_peer0.org2.example.com" with default driver
Creating orderer.example.com ... done
Creating peer0.org2.example.com ... done
Creating peer0.org1.example.com ... done
Creating cli ... done
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
14259fba602f hyperledger/fabric-tools:latest "/bin/bash" 1 second ago Up Less than a second cli
630ecc2b994d hyperledger/fabric-peer:latest "peer node start" 1 second ago Up Less than a second 0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:9444->9444/tcp, :::9444->9444/tcp peer0.org1.example.com
69ba8c0eda5c hyperledger/fabric-orderer:latest "orderer" 1 second ago Up Less than a second 0.0.0.0:7050->7050/tcp, :::7050->7050/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp orderer.example.com
5451217c07a3 hyperledger/fabric-peer:latest "peer node start" 1 second ago Up Less than a second 0.0.0.0:9051->9051/tcp, :::9051->9051/tcp, 7051/tcp, 0.0.0.0:9445->9445/tcp, :::9445->9445/tcp peer0.org2.example.com
3.2 Crear canal testchannel
./network.sh createChannel -c canal de prueba -ca
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# ./network.sh createChannel -c testchannel -ca
Creating channel 'testchannel'.
If network is not up, starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb
Generating channel create transaction 'testchannel.tx'
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/testchannel.tx -channelID testchannel
2022-05-31 17:30:40.964 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2022-05-31 17:30:40.978 CST [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /workspace/github.com/fabric/fabric-samples/test-network/configtx/configtx.yaml
2022-05-31 17:30:40.978 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 003 Generating new channel configtx
2022-05-31 17:30:40.979 CST [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 004 Writing new channel tx
+ res=0
Creating channel testchannel
Using organization 1
+ peer channel create -o localhost:7050 -c testchannel --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/testchannel.tx --outputBlock ./channel-artifacts/testchannel.block --tls --cafile /workspace/github.com/fabric/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
2022-05-31 17:30:44.008 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 17:30:44.019 CST [cli.common] readBlock -> INFO 002 Expect block, but got status: &{NOT_FOUND}
2022-05-31 17:30:44.020 CST [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2022-05-31 17:30:44.223 CST [cli.common] readBlock -> INFO 004 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2022-05-31 17:30:44.229 CST [channelCmd] InitCmdFactory -> INFO 005 Endorser and orderer connections initialized
2022-05-31 17:30:44.431 CST [cli.common] readBlock -> INFO 006 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2022-05-31 17:30:44.435 CST [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2022-05-31 17:30:44.638 CST [cli.common] readBlock -> INFO 008 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2022-05-31 17:30:44.642 CST [channelCmd] InitCmdFactory -> INFO 009 Endorser and orderer connections initialized
2022-05-31 17:30:44.845 CST [cli.common] readBlock -> INFO 00a Expect block, but got status: &{SERVICE_UNAVAILABLE}
2022-05-31 17:30:44.849 CST [channelCmd] InitCmdFactory -> INFO 00b Endorser and orderer connections initialized
2022-05-31 17:30:45.058 CST [cli.common] readBlock -> INFO 00c Received block: 0
Channel 'testchannel' created
Joining org1 peer to the channel...
Using organization 1
+ peer channel join -b ./channel-artifacts/testchannel.block
+ res=0
2022-05-31 17:30:48.095 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 17:30:48.123 CST [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
Joining org2 peer to the channel...
Using organization 2
+ peer channel join -b ./channel-artifacts/testchannel.block
+ res=0
2022-05-31 17:30:51.157 CST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 17:30:51.193 CST [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
Setting anchor peer for org1...
Using organization 1
Fetching channel config for channel testchannel
Using organization 1
Fetching the most recent configuration block for the channel
+ peer channel fetch config config_block.pb -o orderer.example.com:7050 --ordererTLSHostnameOverride orderer.example.com -c testchannel --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2022-05-31 09:30:51.314 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 09:30:51.316 UTC [cli.common] readBlock -> INFO 002 Received block: 0
2022-05-31 09:30:51.316 UTC [channelCmd] fetch -> INFO 003 Retrieving last config block: 0
2022-05-31 09:30:51.317 UTC [cli.common] readBlock -> INFO 004 Received block: 0
Decoding config block to JSON and isolating config to Org1MSPconfig.json
+ configtxlator proto_decode --input config_block.pb --type common.Block
+ jq '.data.data[0].payload.data.config'
+ jq '.channel_group.groups.Application.groups.Org1MSP.values += {
"AnchorPeers":{
"mod_policy": "Admins","value":{
"anchor_peers": [{
"host": "peer0.org1.example.com","port": 7051}]},"version": "0"}}' Org1MSPconfig.json
Generating anchor peer update transaction for Org1 on channel testchannel
+ configtxlator proto_encode --input Org1MSPconfig.json --type common.Config
+ configtxlator proto_encode --input Org1MSPmodified_config.json --type common.Config
+ configtxlator compute_update --channel_id testchannel --original original_config.pb --updated modified_config.pb
+ configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate
+ jq .
++ cat config_update.json
+ echo '{
"payload":{
"header":{
"channel_header":{
"channel_id":"testchannel", "type":2}},"data":{
"config_update":{
' '"channel_id":' '"testchannel",' '"isolated_data":' '{
},' '"read_set":' '{
' '"groups":' '{
' '"Application":' '{
' '"groups":' '{
' '"Org1MSP":' '{
' '"groups":' '{
},' '"mod_policy":' '"",' '"policies":' '{
' '"Admins":' '{
' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"AnchorPeers":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"anchor_peers":' '[' '{' '"host":' '"peer0.org1.example.com",' '"port":' 7051 '}' ']' '},' '"version":' '"0"' '},' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}'
+ configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope
2022-05-31 09:30:51.457 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 09:30:51.464 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
Anchor peer set for org 'Org1MSP' on channel 'testchannel'
Setting anchor peer for org2...
Using organization 2
Fetching channel config for channel testchannel
Using organization 2
Fetching the most recent configuration block for the channel
+ peer channel fetch config config_block.pb -o orderer.example.com:7050 --ordererTLSHostnameOverride orderer.example.com -c testchannel --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2022-05-31 09:30:51.568 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 09:30:51.569 UTC [cli.common] readBlock -> INFO 002 Received block: 1
2022-05-31 09:30:51.569 UTC [channelCmd] fetch -> INFO 003 Retrieving last config block: 1
2022-05-31 09:30:51.570 UTC [cli.common] readBlock -> INFO 004 Received block: 1
Decoding config block to JSON and isolating config to Org2MSPconfig.json
+ configtxlator proto_decode --input config_block.pb --type common.Block
+ jq '.data.data[0].payload.data.config'
+ jq '.channel_group.groups.Application.groups.Org2MSP.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "peer0.org2.example.com","port": 9051}]},"version": "0"}}' Org2MSPconfig.json
Generating anchor peer update transaction for Org2 on channel testchannel
+ configtxlator proto_encode --input Org2MSPconfig.json --type common.Config
+ configtxlator proto_encode --input Org2MSPmodified_config.json --type common.Config
+ configtxlator compute_update --channel_id testchannel --original original_config.pb --updated modified_config.pb
+ configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate
+ jq .
++ cat config_update.json
+ echo '{"payload":{"header":{"channel_header":{"channel_id":"testchannel", "type":2}},"data":{"config_update":{' '"channel_id":' '"testchannel",' '"isolated_data":' '{},' '"read_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"AnchorPeers":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"anchor_peers":' '[' '{' '"host":' '"peer0.org2.example.com",' '"port":' 9051 '}' ']' '},' '"version":' '"0"' '},' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}'
+ configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope
2022-05-31 09:30:51.703 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 09:30:51.711 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
Anchor peer set for org 'Org2MSP' on channel 'testchannel'
Channel 'testchannel' joined
3.3 Llame al contrato básico en ./asset-transfer-basic/chaincode-javascript/
./network.sh deploymentCC -c testchannel -ccn basic -ccp …/asset-transfer-basic/chaincode-javascript/ -ccl javascript
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# ./network.sh deployCC -c testchannel -ccn basic -ccp ../asset-transfer-basic/chaincode-javascript/ -ccl javascript
deploying chaincode on channel 'testchannel'
executing with the following
- CHANNEL_NAME: testchannel
- CC_NAME: basic
- CC_SRC_PATH: ../asset-transfer-basic/chaincode-javascript/
- CC_SRC_LANGUAGE: javascript
- CC_VERSION: 1.0
- CC_SEQUENCE: 1
- CC_END_POLICY: NA
- CC_COLL_CONFIG: NA
- CC_INIT_FCN: NA
- DELAY: 3
- MAX_RETRY: 5
- VERBOSE: false
+ peer lifecycle chaincode package basic.tar.gz --path ../asset-transfer-basic/chaincode-javascript/ --lang node --label basic_1.0
+ res=0
Chaincode is packaged
Installing chaincode on peer0.org1...
Using organization 1
+ peer lifecycle chaincode install basic.tar.gz
+ res=0
2022-05-31 17:32:32.408 CST [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nJbasic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0\022\tbasic_1.0" >
2022-05-31 17:32:32.408 CST [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: basic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0
Chaincode is installed on peer0.org1
Install chaincode on peer0.org2...
Using organization 2
+ peer lifecycle chaincode install basic.tar.gz
+ res=0
2022-05-31 17:32:57.311 CST [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nJbasic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0\022\tbasic_1.0" >
2022-05-31 17:32:57.311 CST [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: basic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0
Chaincode is installed on peer0.org2
Using organization 1
+ peer lifecycle chaincode queryinstalled
+ res=0
Installed chaincodes on peer:
Package ID: basic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0, Label: basic_1.0
Query installed successful on peer0.org1 on channel
Using organization 1
+ peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile /workspace/github.com/fabric/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID testchannel --name basic --version 1.0 --package-id basic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0 --sequence 1
+ res=0
2022-05-31 17:32:59.391 CST [chaincodeCmd] ClientWait -> INFO 001 txid [e2086e7fb2c09fc01bf7235028a6f85b84b1464ec21e92e6565dee9c2362f367] committed with status (VALID) at localhost:7051
Chaincode definition approved on peer0.org1 on channel 'testchannel'
Using organization 1
Checking the commit readiness of the chaincode definition on peer0.org1 on channel 'testchannel'...
Attempting to check the commit readiness of the chaincode definition on peer0.org1, Retry after 3 seconds.
+ peer lifecycle chaincode checkcommitreadiness --channelID testchannel --name basic --version 1.0 --sequence 1 --output json
+ res=0
{
"approvals": {
"Org1MSP": true,
"Org2MSP": false
}
}
Checking the commit readiness of the chaincode definition successful on peer0.org1 on channel 'testchannel'
Using organization 2
Checking the commit readiness of the chaincode definition on peer0.org2 on channel 'testchannel'...
Attempting to check the commit readiness of the chaincode definition on peer0.org2, Retry after 3 seconds.
+ peer lifecycle chaincode checkcommitreadiness --channelID testchannel --name basic --version 1.0 --sequence 1 --output json
+ res=0
{
"approvals": {
"Org1MSP": true,
"Org2MSP": false
}
}
Checking the commit readiness of the chaincode definition successful on peer0.org2 on channel 'testchannel'
Using organization 2
+ peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile /workspace/github.com/fabric/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID testchannel --name basic --version 1.0 --package-id basic_1.0:5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0 --sequence 1
+ res=0
2022-05-31 17:33:07.553 CST [chaincodeCmd] ClientWait -> INFO 001 txid [fe35b1ceaa22838a104c8949408cba3c07e8aa1cd9f9aea66a734aab8199e4df] committed with status (VALID) at localhost:9051
Chaincode definition approved on peer0.org2 on channel 'testchannel'
Using organization 1
Checking the commit readiness of the chaincode definition on peer0.org1 on channel 'testchannel'...
Attempting to check the commit readiness of the chaincode definition on peer0.org1, Retry after 3 seconds.
+ peer lifecycle chaincode checkcommitreadiness --channelID testchannel --name basic --version 1.0 --sequence 1 --output json
+ res=0
{
"approvals": {
"Org1MSP": true,
"Org2MSP": true
}
}
Checking the commit readiness of the chaincode definition successful on peer0.org1 on channel 'testchannel'
Using organization 2
Checking the commit readiness of the chaincode definition on peer0.org2 on channel 'testchannel'...
Attempting to check the commit readiness of the chaincode definition on peer0.org2, Retry after 3 seconds.
+ peer lifecycle chaincode checkcommitreadiness --channelID testchannel --name basic --version 1.0 --sequence 1 --output json
+ res=0
{
"approvals": {
"Org1MSP": true,
"Org2MSP": true
}
}
Checking the commit readiness of the chaincode definition successful on peer0.org2 on channel 'testchannel'
Using organization 1
Using organization 2
+ peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile /workspace/github.com/fabric/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID testchannel --name basic --peerAddresses localhost:7051 --tlsRootCertFiles /workspace/github.com/fabric/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles /workspace/github.com/fabric/fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt --version 1.0 --sequence 1
+ res=0
2022-05-31 17:33:15.685 CST [chaincodeCmd] ClientWait -> INFO 001 txid [3624662097b848173db4c2dd6ba105387ae1af65a0b4a4ffeb34ef3b0d5dc038] committed with status (VALID) at localhost:7051
2022-05-31 17:33:15.692 CST [chaincodeCmd] ClientWait -> INFO 002 txid [3624662097b848173db4c2dd6ba105387ae1af65a0b4a4ffeb34ef3b0d5dc038] committed with status (VALID) at localhost:9051
Chaincode definition committed on channel 'testchannel'
Using organization 1
Querying chaincode definition on peer0.org1 on channel 'testchannel'...
Attempting to Query committed status on peer0.org1, Retry after 3 seconds.
+ peer lifecycle chaincode querycommitted --channelID testchannel --name basic
+ res=0
Committed chaincode definition for chaincode 'basic' on channel 'testchannel':
Version: 1.0, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc, Approvals: [Org1MSP: true, Org2MSP: true]
Query chaincode definition successful on peer0.org1 on channel 'testchannel'
Using organization 2
Querying chaincode definition on peer0.org2 on channel 'testchannel'...
Attempting to Query committed status on peer0.org2, Retry after 3 seconds.
+ peer lifecycle chaincode querycommitted --channelID testchannel --name basic
+ res=0
Committed chaincode definition for chaincode 'basic' on channel 'testchannel':
Version: 1.0, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc, Approvals: [Org1MSP: true, Org2MSP: true]
Query chaincode definition successful on peer0.org2 on channel 'testchannel'
Chaincode initialization is not required
3.4 Confirme que el par de archivos binarios está disponible
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# source /etc/profile
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer
Usage:
peer [command]
Available Commands:
chaincode Operate a chaincode: install|instantiate|invoke|package|query|signpackage|upgrade|list.
channel Operate a channel: create|fetch|join|list|update|signconfigtx|getinfo.
help Help about any command
lifecycle Perform _lifecycle operations
node Operate a peer node: start|reset|rollback|pause|resume|rebuild-dbs|upgrade-dbs.
version Print fabric peer version.
Flags:
-h, --help help for peer
Use "peer [command] --help" for more information about a command.
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer version
peer:
Version: 2.2.5
Commit SHA: f7318ffd4
Go version: go1.17.5
OS/Arch: linux/amd64
Chaincode:
Base Docker Label: org.hyperledger.fabric
Docker Namespace: hyperledger
3.5 Llamada de contrato
3.5.1 Configuración del entorno de la organización Org1
exportar FABRIC_CFG_PATH= PWD / . . /config/export COREPEERTLSENABLED = trueexport COREPEERLOCALMSPID = "O rg 1 MSP" export COREPEERTLSROOTCERTFI LE = PWD/../config/ export CORE_PEER_TLS_ENABLED=true export CORE_PEER_LOCALMSPID="Org1MSP" export CORE_PEER_TLS_ROOTCERT_FILE=P W D / . . / c o n f i g / e x p o r t C O R EpagE E RTLS _miN A B L E D=verdadera e xportación C O R E _ _ _ _ _ _ _pagE E RLO C A L M S P I D=" O r g 1 M S P " e x p o r t C O R EpagE E RTLS _RO T C E R T _FYO L E= {PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/ [email protected]/msp
exportar CORE_PEER_ADDRESS=localhost:7051
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export FABRIC_CFG_PATH=$PWD/../config/
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# echo $FABRIC_CFG_PATH
/workspace/github.com/fabric/fabric-samples/test-network/../config/
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# ll /workspace/github.com/fabric/fabric-samples/test-network/../config/
总用量 88
drwxrwxrwx 2 1001 1001 4096 1月 28 20:41 ./
drwxrwxrwx 26 root root 4096 5月 31 16:49 ../
-rwxrwxrwx 1 1001 avahi-autoipd 25582 1月 28 20:40 configtx.yaml*
-rwxrwxrwx 1 1001 avahi-autoipd 34381 1月 28 20:40 core.yaml*
-rwxrwxrwx 1 1001 avahi-autoipd 15218 1月 28 20:40 orderer.yaml*
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_TLS_ENABLED=true
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_LOCALMSPID="Org1MSP"
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org1.example.com/users/[email protected]/msp
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_ADDRESS=localhost:7051
3.5.2 La organización Org1 llama al contrato para inicializar activos
peer chaincode invoque -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile “ PWD/organizations/orderer Organizaciones/ejemplo. com/pedidores/pedidor. ejemplo . com/msp/tlscacerts/tlsca. ejemplo . com-cert. pem " − C testchannel − nbasic − − peer A ddresseslocalhost : 7051 − − tls R oot C ert F iles " {PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca. ejemplo.com-cert.pem" -C testchannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "PW D / o r g a n i z a c i o n s / o r d e r e r O r g a n i z a c i o n s / e je m p l o . _ _ c o m / o r d e r e r s / or d e r e r . ejemplo . _ _ _ _ _ _ c o m / m s p / t l s c a c e r t s / t l s c a . ejemplo . _ _ _ _ _ _ c o m−c e r t . p e m "−C canal de prueba _ _ _ _ _ _ _ _−n b a s i c−- pag mi mi r UN re re r mi s s mi s l o c un l h o s t:7 0 5 1−− t l s R o o t C e r t F i l e s " {PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt” -- peerAddresses localhost:9051 --tlsRootCertFiles “${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt” -c '{“function”:“InitLedger” ,“Argumentos”:[]}'
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C testchannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"InitLedger","Args":[]}'
2022-05-31 17:47:16.953 CST [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200
3.5.3 Consulta de contrato de llamadas de organización Org1
consulta de código de cadena de pares -C canal de prueba -n básico -c '{“Args”:[“GetAllAssets”]}'
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer chaincode query -C testchannel -n basic -c '{"Args":["GetAllAssets"]}'
[{
"Key":"asset1","Record":{
"ID":"asset1","Color":"blue","Size":5,"Owner":"Tomoko","AppraisedValue":300,"docType":"asset"}},{
"Key":"asset2","Record":{
"ID":"asset2","Color":"red","Size":5,"Owner":"Brad","AppraisedValue":400,"docType":"asset"}},{
"Key":"asset3","Record":{
"ID":"asset3","Color":"green","Size":10,"Owner":"Jin Soo","AppraisedValue":500,"docType":"asset"}},{
"Key":"asset4","Record":{
"ID":"asset4","Color":"yellow","Size":10,"Owner":"Max","AppraisedValue":600,"docType":"asset"}},{
"Key":"asset5","Record":{
"ID":"asset5","Color":"black","Size":15,"Owner":"Adriana","AppraisedValue":700,"docType":"asset"}},{
"Key":"asset6","Record":{
"ID":"asset6","Color":"white","Size":15,"Owner":"Michel","AppraisedValue":800,"docType":"asset"}}]
3.5.4 La organización Org1 llama al contrato para cambiar el propietario del activo
peer chaincode invoque -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile “ PWD/organizations/orderer Organizaciones/ejemplo. com/pedidores/pedidor. ejemplo . com/msp/tlscacerts/tlsca. ejemplo . com-cert. pem " − C testchannel − nbasic − − peer A ddresseslocalhost : 7051 − − tls R oot C ert F iles " {PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca. ejemplo.com-cert.pem" -C testchannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "PW D / o r g a n i z a c i o n s / o r d e r e r O r g a n i z a c i o n s / e je m p l o . _ _ c o m / o r d e r e r s / or d e r e r . ejemplo . _ _ _ _ _ _ c o m / m s p / t l s c a c e r t s / t l s c a . ejemplo . _ _ _ _ _ _ c o m−c e r t . p e m "−C canal de prueba _ _ _ _ _ _ _ _−n b a s i c−- pag mi mi r UN re re r mi s s mi s l o c un l h o s t:7 0 5 1−− t l s R o o t C e r t F i l e s " {PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt” -- peerAddresses localhost:9051 --tlsRootCertFiles “${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt” -c '{“function”:“TransferAsset” ,“Args”:[“activo6”,“Christopher”]}'
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C testchannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"TransferAsset","Args":["asset6","Christopher"]}'
2022-05-31 17:47:37.803 CST [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 payload:"{
\"type\":\"Buffer\",\"data\":[]}"
3.5.5 Configuración del entorno de la organización Org2
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_LOCALMSPID=“Org2MSP”
export CORE_PEER_TLS_ROOTCERT_FILE= PWD/organizaciones/organizaciones pares/org 2. ejemplo. com/peers/peer 0. org 2. ejemplo. com/tls/ca. crtexport COREPEERMSPCONFIGPATH = {PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt export CORE_PEER_MSPCONFIGPATH=PW D / o r g a n i z a c i o n s / p e r O r g a n i z a c i o n s / o r g 2 . _ _ ejemplo . _ _ _ _ _ _ c o m / p e r s / p e _e r 0 . o g 2 . _ ejemplo . _ _ _ _ _ _ c o m / t l s / c a . c r t e x p o r t C O R EpagE E RmS P C O N F I G P A T H= {PWD}/organizations/peerOrganizations/org2.example.com/users/[email protected]/msp
export CORE_PEER_ADDRESS=localhost:9051
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_TLS_ENABLED=true
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_LOCALMSPID="Org2MSP"
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_TLS_ROOTCERT_FILE=${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_MSPCONFIGPATH=${PWD}/organizations/peerOrganizations/org2.example.com/users/[email protected]/msp
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# export CORE_PEER_ADDRESS=localhost:9051
3.5.6 Organizar Org2 para llamar al resultado de la consulta del contrato
consulta de código de cadena del par -C canal de prueba -n básico -c '{“Args”:[“ReadAsset”,“asset6”]}'
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# peer chaincode query -C testchannel -n basic -c '{"Args":["ReadAsset","asset6"]}'
{
"ID":"asset6","Color":"white","Size":15,"Owner":"Christopher","AppraisedValue":800,"docType":"asset"}
3.6 Cerrar la red
./network.sh abajo
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# ./network.sh down
Stopping network
Stopping cli ... done
Stopping peer0.org1.example.com ... done
Stopping orderer.example.com ... done
Stopping peer0.org2.example.com ... done
Removing cli ... done
Removing peer0.org1.example.com ... done
Removing orderer.example.com ... done
Removing peer0.org2.example.com ... done
Removing network fabric_test
Removing volume docker_orderer.example.com
Removing volume docker_peer0.org1.example.com
Removing volume docker_peer0.org2.example.com
Removing network fabric_test
WARNING: Network fabric_test not found.
Removing volume docker_peer0.org3.example.com
WARNING: Volume docker_peer0.org3.example.com not found.
No containers available for deletion
Untagged: dev-peer0.org2.example.com-basic_1.0-5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0-7afd1ed5571b9e3e2148baf7369c0d8d3cecb38f292a8fff36cf034ba92d9005:latest
Deleted: sha256:86ad89e673c01bd32a541a5d05ecc8a816b1b4c25319f1c0771a3656862f8bb2
Deleted: sha256:a0cbd2c6d77395db8902fdb55ea40ce3afd7f51c121006569c148962ae75b18b
Deleted: sha256:486425f847e8c59b45a653976ab1d9eba4e37171dc0c57a2d722a9b6709adb74
Deleted: sha256:e96a383c26ccce694934884e8204edac57917291d98cd7a90caa327b562ea557
Untagged: dev-peer0.org1.example.com-basic_1.0-5c1ce9660841cc944290ee8bf9f36eee9af8fad7ffcefb8fa75b5c8f6883cef0-c267bdc9fc52605a00fd9106a5d8ed66b967eafdab3b10fa1e07ddac9abc93bb:latest
Deleted: sha256:46a73f411c97627d7b7cf3de1c491421904319b865554b62d400071c25c9f6b0
Deleted: sha256:ae0ad80e0f2883f35eb4482b631c016760d704392b671593ea9df3808c0ddffb
Deleted: sha256:684b7aa002e3a00263a7d9411fe292e94895da9e33deac198ff495f9a3fea50d
Deleted: sha256:09d4fe38cfcbd8d46f72a70add787563daf3251c77dd56906782f09bd1cd1f74
3.7 Eliminar ventanas acoplables duplicadas
docker rmi hyperledger/fabric-tools:último
docker rmi hyperledger/fabric-peer:último
docker rmi hyperledger/fabric-orderer:último
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# docker rmi hyperledger/fabric-tools:latest
Untagged: hyperledger/fabric-tools:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# docker rmi hyperledger/fabric-peer:latest
Untagged: hyperledger/fabric-peer:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# docker rmi hyperledger/fabric-orderer:latest
Untagged: hyperledger/fabric-orderer:latest
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/test-network# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 3fb5cabb6469 5 days ago 1.24MB
hyperledger/fabric-tools 2.2.5 754df4def0cf 4 months ago 442MB
hyperledger/fabric-peer 2.2.5 94f45b88b26a 4 months ago 51MB
hyperledger/fabric-orderer 2.2.5 c25c16d51e1e 4 months ago 34.7MB
hyperledger/fabric-ccenv 2.2.5 7cce5e687fe7 4 months ago 516MB
hyperledger/fabric-baseos 2.2.5 ab5f045ec622 4 months ago 6.94MB
hyperledger/fabric-ca 1.5.2 4ea287b75c63 8 months ago 69.8MB
hyperledger/fabric-nodeenv 2.2 1c0903d73400 9 months ago 295MB
hyperledger/fabric-javaenv 2.2 c47df6b15c80 10 months ago 415MB
4. Tutorial de instalación de la versión 1.1.0
Tutorial de referencia: Documentos » Tutoriales » Creación de su primera red
4.1 Inicialización de la red
./byfn.sh -m generar
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# ./byfn.sh -m generate
Generating certs and genesis block for with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
/workspace/github.com/fabric/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
/workspace/github.com/fabric/fabric-samples/first-network/../bin/configtxgen
##########################################################
######### Generating Orderer Genesis block ##############
##########################################################
+ configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
2022-05-31 20:51:30.235 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-05-31 20:51:30.240 CST [msp] getMspConfig -> INFO 002 Loading NodeOUs
2022-05-31 20:51:30.240 CST [msp] getMspConfig -> INFO 003 Loading NodeOUs
2022-05-31 20:51:30.241 CST [common/tools/configtxgen] doOutputBlock -> INFO 004 Generating genesis block
2022-05-31 20:51:30.241 CST [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
2022-05-31 20:51:30.250 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-05-31 20:51:30.255 CST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2022-05-31 20:51:30.256 CST [msp] getMspConfig -> INFO 003 Loading NodeOUs
2022-05-31 20:51:30.256 CST [msp] getMspConfig -> INFO 004 Loading NodeOUs
2022-05-31 20:51:30.270 CST [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
2022-05-31 20:51:30.279 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-05-31 20:51:30.284 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2022-05-31 20:51:30.284 CST [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
2022-05-31 20:51:30.293 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-05-31 20:51:30.298 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2022-05-31 20:51:30.298 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
+ res=0
+ set +x
4.2 Iniciar la red
./byfn.sh -m arriba
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# ./byfn.sh -m up
Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
2022-05-31 13:40:54.798 UTC [main] main -> INFO 001 Exiting.....
LOCAL_VERSION=1.1.0
DOCKER_IMAGE_VERSION=1.1.0
Recreating peer0.org2.example.com ... done
Recreating peer0.org1.example.com ... done
Recreating peer1.org2.example.com ... done
Recreating orderer.example.com ... done
Recreating peer1.org1.example.com ... done
Recreating cli ... done
____ _____ _ ____ _____
/ ___| |_ _| / \ | _ \ |_ _|
\___ \ | | / _ \ | |_) | | |
___) | | | / ___ \ | _ < | |
|____/ |_| /_/ \_\ |_| \_\ |_|
Build your first network (BYFN) end-to-end test
Channel name : mychannel
Creating channel...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ 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
2022-05-31 13:40:57.106 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 13:40:57.123 UTC [channelCmd] InitCmdFactory -> INFO 002 Endorser and orderer connections initialized
2022-05-31 13:40:57.329 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/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2022-05-31 13:40:57.412 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 13:40:57.456 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
2022-05-31 13:40:57.456 UTC [main] main -> INFO 003 Exiting.....
===================== peer0.org1 joined on the channel "mychannel" =====================
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer1.org1.example.com:7051
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2022-05-31 13:41:00.540 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 13:41:00.572 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
2022-05-31 13:41:00.572 UTC [main] main -> INFO 003 Exiting.....
===================== peer1.org1 joined on the channel "mychannel" =====================
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2022-05-31 13:41:03.652 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 13:41:03.698 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
2022-05-31 13:41:03.698 UTC [main] main -> INFO 003 Exiting.....
===================== peer0.org2 joined on the channel "mychannel" =====================
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2022-05-31 13:41:06.738 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 13:41:06.768 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
2022-05-31 13:41:06.769 UTC [main] main -> INFO 003 Exiting.....
===================== peer1.org2 joined on the channel "mychannel" =====================
Updating anchor peers for org1...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ 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
2022-05-31 13:41:09.850 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 13:41:09.857 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
2022-05-31 13:41:09.857 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/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
+ 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
2022-05-31 13:41:12.897 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-05-31 13:41:12.905 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
2022-05-31 13:41:12.905 UTC [main] main -> INFO 003 Exiting.....
===================== Anchor peers for org "Org2MSP" on "mychannel" is updated successfully =====================
Installing chaincode on peer0.org1...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2022-05-31 13:41:15.986 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-05-31 13:41:15.986 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-05-31 13:41:16.083 UTC [main] main -> INFO 003 Exiting.....
===================== Chaincode is installed on peer0.org1 =====================
Install chaincode on peer0.org2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2022-05-31 13:41:16.110 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-05-31 13:41:16.110 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-05-31 13:41:16.203 UTC [main] main -> INFO 003 Exiting.....
===================== Chaincode is installed on peer0.org2 =====================
Instantiating chaincode on peer0.org2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
+ 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 'OR ('\''Org1MSP.peer'\'','\''Org2MSP.peer'\'')'
+ res=0
+ set +x
2022-05-31 13:41:16.233 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-05-31 13:41:16.233 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-05-31 13:41:22.432 UTC [main] main -> INFO 003 Exiting.....
===================== Chaincode Instantiation on peer0.org2 on channel 'mychannel' is successful =====================
Querying chaincode on peer0.org1...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
===================== Querying on peer0.org1 on channel 'mychannel'... =====================
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer0.org1 ...3 secs
+ res=0
+ set +x
2022-05-31 13:41:25.506 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-05-31 13:41:25.506 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Query Result: 100
2022-05-31 13:41:31.788 UTC [main] main -> INFO 003 Exiting.....
===================== Query on peer0.org1 on channel 'mychannel' is successful =====================
Sending invoke transaction on peer0.org1...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ 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 -c '{"Args":["invoke","a","b","10"]}'
+ res=0
+ set +x
2022-05-31 13:41:31.822 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-05-31 13:41:31.823 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-05-31 13:41:31.827 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200
2022-05-31 13:41:31.827 UTC [main] main -> INFO 004 Exiting.....
===================== Invoke transaction on peer0.org1 on channel 'mychannel' is successful =====================
Installing chaincode on peer1.org2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2022-05-31 13:41:31.854 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-05-31 13:41:31.854 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-05-31 13:41:31.946 UTC [main] main -> INFO 003 Exiting.....
===================== Chaincode is installed on peer1.org2 =====================
Querying chaincode on peer1.org2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
===================== Querying on peer1.org2 on channel 'mychannel'... =====================
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer1.org2 ...3 secs
+ res=0
+ set +x
2022-05-31 13:41:35.026 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-05-31 13:41:35.026 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Query Result: 90
2022-05-31 13:41:41.447 UTC [main] main -> INFO 003 Exiting.....
===================== Query on peer1.org2 on channel 'mychannel' is successful =====================
========= All GOOD, BYFN execution completed ===========
_____ _ _ ____
| ____| | \ | | | _ \
| _| | \| | | | | |
| |___ | |\ | | |_| |
|_____| |_| \_| |____/
4.3 Cerrar la red
./byfn.sh abajo
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# ./byfn.sh down
Stopping with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
Stopping cli ... done
Stopping orderer.example.com ... done
Stopping peer1.org2.example.com ... done
Stopping peer0.org1.example.com ... done
Stopping peer1.org1.example.com ... done
Stopping peer0.org2.example.com ... done
Removing cli ... done
Removing orderer.example.com ... done
Removing peer1.org2.example.com ... done
Removing peer0.org1.example.com ... done
Removing peer1.org1.example.com ... done
Removing peer0.org2.example.com ... done
Removing network net_byfn
Removing volume net_orderer.example.com
Removing volume net_peer0.org1.example.com
Removing volume net_peer1.org1.example.com
Removing volume net_peer0.org2.example.com
Removing volume net_peer1.org2.example.com
Removing network net_byfn
WARNING: Network net_byfn not found.
Removing volume net_orderer.example.com
WARNING: Volume net_orderer.example.com not found.
Removing volume net_peer0.org1.example.com
WARNING: Volume net_peer0.org1.example.com not found.
Removing volume net_peer1.org1.example.com
WARNING: Volume net_peer1.org1.example.com not found.
Removing volume net_peer0.org2.example.com
WARNING: Volume net_peer0.org2.example.com not found.
Removing volume net_peer1.org2.example.com
WARNING: Volume net_peer1.org2.example.com not found.
c4fe62fbc719
8aa9782a24a6
24f7353bceca
Untagged: dev-peer1.org2.example.com-mycc-1.0-26c2ef32838554aac4f7ad6f100aca865e87959c9a126e86d764c8d01f8346ab:latest
Deleted: sha256:74be209634c0feaf6280303a7326cb53902d3de795a0e40725a894d89c685e3a
Deleted: sha256:d41a91885a1983362d2fd9622b38b0c42dba3d41a0d256a3e695149fef53cb32
Deleted: sha256:6b3ea0424968a3bbcfd88394056de6e22d6b06014c787d754ded29075d80f351
Deleted: sha256:030b2c0e14f52c1c654113152246419bad906d35069ca1b30dce5c1ac7b4f3a6
Untagged: dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9:latest
Deleted: sha256:888e19028398515c5a9dee7720606d5b5f7343ffc71d4d494a8d69daf3bddbdd
Deleted: sha256:5695d33292b34da1ecabbed62f3aefb89e3d46cd331abb9d8d6d8ebb35c8363b
Deleted: sha256:ef70acef45837079df8271d0a15d3e47f2bce164df28a93da371f63ade795337
Deleted: sha256:35e2bb837f88cf4813a7457edbe5eb643f1d80f39c8a8c969448f08b126faee4
Untagged: dev-peer0.org2.example.com-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b:latest
Deleted: sha256:f08e6d94c22f6d15cffb0424322c79bedcced57557b069ff2f3de2bd088dd5b5
Deleted: sha256:362f221c55cf2a37d7e10b901e692d89e13fa08aeb05a8157a488b308e10da23
Deleted: sha256:8afa6aef1f13e0c099b399c18b1f2474ffd28f16aaab2887267792fe46581697
Deleted: sha256:7017f585e17085f79c388840762450b79caba9bed21c77041ca1f1673123d315
4.4 Implementar contratos inteligentes
Referencia: Implementación de contenedores de Hyperledger Fabric y pruebas de código de cadena (BYFN) + Documentos » Tutoriales » Creación de su primera red
4.4.1 Tejido 1.1 declaración inicial
Genere manualmente el archivo de configuración cifrado configtxgen (certificado y clave), el canal predeterminado es mychannel y configure los nodos de asignación de las dos organizaciones Org1 y Org2 en el canal.
../bin/cryptogen generate --config=./crypto-config.yaml
export FABRIC_CFG_PATH=$PWD
../bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
export CHANNEL_NAME=mychannel && ../bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP
Resultados de la
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# ../bin/cryptogen generate --config=./crypto-config.yaml
org1.example.com
org2.example.com
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# ls
base crypto-config docker-compose-couch.yaml org3-artifacts
byfn.sh crypto-config.yaml docker-compose-e2e-template.yaml README.md
channel-artifacts docker-compose-cli.yaml docker-compose-org3.yaml scripts
configtx.yaml docker-compose-couch-org3.yaml eyfn.sh
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# export FABRIC_CFG_PATH=$PWD
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# echo $FABRIC_CFG_PATH
/workspace/github.com/fabric/fabric-samples/first-network
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# ../bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
2022-06-01 17:17:56.061 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-06-01 17:17:56.083 CST [msp] getMspConfig -> INFO 002 Loading NodeOUs
2022-06-01 17:17:56.084 CST [msp] getMspConfig -> INFO 003 Loading NodeOUs
2022-06-01 17:17:56.085 CST [common/tools/configtxgen] doOutputBlock -> INFO 004 Generating genesis block
2022-06-01 17:17:56.086 CST [common/tools/configtxgen] doOutputBlock -> INFO 005 Writing genesis block
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# export CHANNEL_NAME=mychannel && ../bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
2022-06-01 17:18:32.175 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-06-01 17:18:32.193 CST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2022-06-01 17:18:32.194 CST [msp] getMspConfig -> INFO 003 Loading NodeOUs
2022-06-01 17:18:32.194 CST [msp] getMspConfig -> INFO 004 Loading NodeOUs
2022-06-01 17:18:32.218 CST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 005 Writing new channel tx
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# ../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
2022-06-01 17:19:10.801 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-06-01 17:19:10.818 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2022-06-01 17:19:10.818 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# ../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP
2022-06-01 17:19:19.337 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-06-01 17:19:19.342 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2022-06-01 17:19:19.342 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
4.4.2 inicio de red fabric 1.1
4.4.2.1 Inicie la imagen cli correspondiente basada en la ventana acoplable y establezca la variable de entorno cli:
docker-compose -f docker-compose-cli.yaml up -d
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1 .example.com/msp
export CORE_PEER_ADDRESS=peer0.org1.example.com:7051
export CORE_PEER_LOCALMSPID=“Org1MSP”
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1. ejemplo.com/peers/peer0.org1.ejemplo.com/tls/ca.crt
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker-compose -f docker-compose-cli.yaml up -d
Creating network "net_byfn" with the default driver
Creating volume "net_orderer.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_peer1.org2.example.com" with default driver
Creating peer1.org2.example.com ... done
Creating peer0.org1.example.com ... done
Creating peer1.org1.example.com ... done
Creating orderer.example.com ... done
Creating peer0.org2.example.com ... done
Creating cli ... done
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# export CORE_PEER_ADDRESS=peer0.org1.example.com:7051
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# export CORE_PEER_LOCALMSPID="Org1MSP"
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
4.4.2.2 Configure la información del canal según la imagen CLI, únase al canal y actualice la definición de nodo de Org1 en el canal
docker exec -it cli bash
export CHANNEL_NAME=mychannel
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /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 join -b mychannel.block
peer channel update -o orderer.example.com:7050 -c $NOMBRE_CANAL -f ./channel-artifacts/Org1MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations /example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker exec -it cli bash
root@700469a277f7:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CHANNEL_NAME=mychannel
root@700469a277f7:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2022-06-01 13:00:21.138 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-06-01 13:00:21.166 UTC [channelCmd] InitCmdFactory -> INFO 002 Endorser and orderer connections initialized
2022-06-01 13:00:21.372 UTC [main] main -> INFO 003 Exiting.....
root@700469a277f7:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel join -b mychannel.block
2022-06-01 13:00:47.922 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-06-01 13:00:47.949 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
2022-06-01 13:00:47.949 UTC [main] main -> INFO 003 Exiting.....
root@700469a277f7:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel update -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/Org1MSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2022-06-01 13:01:52.349 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-06-01 13:01:52.356 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
2022-06-01 13:01:52.356 UTC [main] main -> INFO 003 Exiting.....
4.4.3 fabric-1.1.0 instalar y llamar al contrato
- Instale el contrato mycc basado en nodeJs y adopte una determinada organización para respaldar el contrato
- Complete la instanciación del contrato en el nodo, es decir, establezca un activo en 100 y un activo b en 200
- Consulta los activos actuales de a y devuelve el resultado Resultado de la consulta: 100
- Hacer una transacción de a a b: transacción de a a b 10
- Consulta los activos de una nueva y devuelve el resultado Resultado de la consulta: 90
peer chaincode install -n mycc -v 1.0 -l node -p
peer chaincode instantiate -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n mycc -l node -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}'
peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
Resultados de la:
root@700469a277f7:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install -n mycc -v 1.0 -l node -p /opt/gopath/src/github.com/chaincode/chaincode_example02/node/
2022-06-01 13:03:22.343 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:03:22.343 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 13:03:22.343 UTC [container] WriteFolderToTarPackage -> INFO 003 rootDirectory = /opt/gopath/src/github.com/chaincode/chaincode_example02/node
2022-06-01 13:03:22.348 UTC [main] main -> INFO 004 Exiting.....
root@700469a277f7:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n mycc -l node -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org1MSP.peer','Org2MSP.peer')"
2022-06-01 13:03:40.762 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:03:40.762 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 13:04:33.787 UTC [main] main -> INFO 003 Exiting.....
root@700469a277f7:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
2022-06-01 13:04:48.211 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:04:48.211 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Query Result: 100
2022-06-01 13:04:48.217 UTC [main] main -> INFO 003 Exiting.....
root@700469a277f7:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}'
2022-06-01 13:05:01.392 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:05:01.392 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 13:05:01.397 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200
2022-06-01 13:05:01.397 UTC [main] main -> INFO 004 Exiting.....
root@700469a277f7:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}'
2022-06-01 13:05:12.758 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:05:12.758 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Query Result: 90
2022-06-01 13:05:12.762 UTC [main] main -> INFO 003 Exiting.....
4.5 registro de contenedor de consultas fabric-1.1.0
ventana acoplable ps -una
ventana acoplable registra e72f41b13ccd
root@700469a277f7:/opt/gopath/src/github.com/hyperledger/fabric/peer# exit
exit
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker logs dev-peer0.org2.example.com-mycc-1.0
Error: No such container: dev-peer0.org2.example.com-mycc-1.0
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e72f41b13ccd dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9 "/bin/sh -c 'cd /usr…" 30 minutes ago Up 30 minutes dev-peer0.org1.example.com-mycc-1.0
700469a277f7 hyperledger/fabric-tools:latest "/bin/bash" 37 minutes ago Up 37 minutes cli
def095baa470 hyperledger/fabric-peer:latest "peer node start" 37 minutes ago Up 37 minutes 0.0.0.0:9051->7051/tcp, :::9051->7051/tcp, 0.0.0.0:9053->7053/tcp, :::9053->7053/tcp peer0.org2.example.com
f94e10d87327 hyperledger/fabric-peer:latest "peer node start" 37 minutes ago Up 37 minutes 0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:7053->7053/tcp, :::7053->7053/tcp peer0.org1.example.com
2679a2141374 hyperledger/fabric-orderer:latest "orderer" 37 minutes ago Up 37 minutes 0.0.0.0:7050->7050/tcp, :::7050->7050/tcp orderer.example.com
cfce165c9972 hyperledger/fabric-peer:latest "peer node start" 37 minutes ago Up 37 minutes 0.0.0.0:8051->7051/tcp, :::8051->7051/tcp, 0.0.0.0:8053->7053/tcp, :::8053->7053/tcp peer1.org1.example.com
81416af7a316 hyperledger/fabric-peer:latest "peer node start" 37 minutes ago Up 37 minutes 0.0.0.0:10051->7051/tcp, :::10051->7051/tcp, 0.0.0.0:10053->7053/tcp, :::10053->7053/tcp peer1.org2.example.com
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker logs e72f41b13ccd
> [email protected] start /usr/local/src
> node chaincode_example02.js "--peer.address" "peer0.org1.example.com:7052"
E0601 13:04:33.778661389 18 ssl_transport_security.cc:238] Could not get common name of subject from certificate.
========= example02 Init =========
{
fcn: 'init', params: [ 'a', '100', 'b', '200' ] }
{
fcn: 'query', params: [ 'a' ] }
Query Response:
{
name: 'a', amount: '100' }
{
fcn: 'invoke', params: [ 'a', 'b', '10' ] }
Aval = 90, Bval = 210
{
fcn: 'query', params: [ 'a' ] }
Query Response:
{
name: 'a', amount: '90' }
4.6 Llamar a couchdb para iniciar fabric 1.1
4.6.1 fabric1.1.0 llamar a couchdb basado en script
Primero cierre la red actual, luego simplemente llame al parámetro -s para iniciar couchdb y verifique el registro para confirmar que la llamada del contrato inteligente se ha completado.
./byfn.sh down
./byfn.sh -m up -t 999999 -s couchdb
docker ps -a
docker logs 093463781acb
docker logs 0ac07673c5fa
docker logs 027261fec09c
resultado de la operación
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# ./byfn.sh -m up -t 999999 -s couchdb
Starting with channel 'mychannel' and CLI timeout of '999999' seconds and CLI delay of '3' seconds and using database 'couchdb'
Continue? [Y/n] y
proceeding ...
2022-06-01 13:48:43.784 UTC [main] main -> INFO 001 Exiting.....
LOCAL_VERSION=1.1.0
DOCKER_IMAGE_VERSION=1.1.0
/workspace/github.com/fabric/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
/workspace/github.com/fabric/fabric-samples/first-network/../bin/configtxgen
##########################################################
######### Generating Orderer Genesis block ##############
##########################################################
+ configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
2022-06-01 21:48:44.079 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-06-01 21:48:44.085 CST [msp] getMspConfig -> INFO 002 Loading NodeOUs
2022-06-01 21:48:44.085 CST [msp] getMspConfig -> INFO 003 Loading NodeOUs
2022-06-01 21:48:44.085 CST [common/tools/configtxgen] doOutputBlock -> INFO 004 Generating genesis block
2022-06-01 21:48:44.085 CST [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
2022-06-01 21:48:44.094 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-06-01 21:48:44.099 CST [common/tools/configtxgen] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2022-06-01 21:48:44.099 CST [msp] getMspConfig -> INFO 003 Loading NodeOUs
2022-06-01 21:48:44.100 CST [msp] getMspConfig -> INFO 004 Loading NodeOUs
2022-06-01 21:48:44.114 CST [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
2022-06-01 21:48:44.122 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-06-01 21:48:44.127 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2022-06-01 21:48:44.128 CST [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
2022-06-01 21:48:44.136 CST [common/tools/configtxgen] main -> INFO 001 Loading configuration
2022-06-01 21:48:44.141 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2022-06-01 21:48:44.141 CST [common/tools/configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
+ res=0
+ set +x
Creating network "net_byfn" with the default driver
Creating volume "net_orderer.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_peer1.org2.example.com" with default driver
Creating couchdb0 ... done
Creating orderer.example.com ... done
Creating couchdb1 ... done
Creating couchdb2 ... done
Creating couchdb3 ... done
Creating peer0.org1.example.com ... done
Creating peer0.org2.example.com ... done
Creating peer1.org2.example.com ... done
Creating peer1.org1.example.com ... done
Creating cli ... done
____ _____ _ ____ _____
/ ___| |_ _| / \ | _ \ |_ _|
\___ \ | | / _ \ | |_) | | |
___) | | | / ___ \ | _ < | |
|____/ |_| /_/ \_\ |_| \_\ |_|
Build your first network (BYFN) end-to-end test
Channel name : mychannel
Creating channel...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ 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
2022-06-01 13:48:47.049 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-06-01 13:48:47.075 UTC [channelCmd] InitCmdFactory -> INFO 002 Endorser and orderer connections initialized
2022-06-01 13:48:47.277 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/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ peer channel join -b mychannel.block
+ res=1
+ set +x
Error: Error getting endorser client channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: context deadline exceeded
Usage:
peer channel join [flags]
Flags:
-b, --blockpath string Path to file containing genesis block
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--certfile string Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
--clientauth Use mutual TLS when communicating with the orderer endpoint
--keyfile string Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--ordererTLSHostnameOverride string The hostname override to use when validating the TLS connection to the orderer.
--tls Use TLS when communicating with the orderer endpoint
-v, --version Display current version of fabric peer server
peer0.org1 failed to join the channel, Retry after 3 seconds
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2022-06-01 13:48:53.424 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-06-01 13:48:53.481 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
2022-06-01 13:48:53.481 UTC [main] main -> INFO 003 Exiting.....
===================== peer0.org1 joined on the channel "mychannel" =====================
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer1.org1.example.com:7051
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2022-06-01 13:48:56.561 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-06-01 13:48:56.621 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
2022-06-01 13:48:56.621 UTC [main] main -> INFO 003 Exiting.....
===================== peer1.org1 joined on the channel "mychannel" =====================
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2022-06-01 13:48:59.708 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-06-01 13:48:59.781 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
2022-06-01 13:48:59.781 UTC [main] main -> INFO 003 Exiting.....
===================== peer0.org2 joined on the channel "mychannel" =====================
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2022-06-01 13:49:02.854 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-06-01 13:49:02.921 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
2022-06-01 13:49:02.921 UTC [main] main -> INFO 003 Exiting.....
===================== peer1.org2 joined on the channel "mychannel" =====================
Updating anchor peers for org1...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ 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
2022-06-01 13:49:06.008 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-06-01 13:49:06.015 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
2022-06-01 13:49:06.015 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/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
+ 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
2022-06-01 13:49:09.100 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2022-06-01 13:49:09.107 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
2022-06-01 13:49:09.107 UTC [main] main -> INFO 003 Exiting.....
===================== Anchor peers for org "Org2MSP" on "mychannel" is updated successfully =====================
Installing chaincode on peer0.org1...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2022-06-01 13:49:12.186 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:49:12.186 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 13:49:12.820 UTC [main] main -> INFO 003 Exiting.....
===================== Chaincode is installed on peer0.org1 =====================
Install chaincode on peer0.org2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2022-06-01 13:49:12.896 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:49:12.896 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 13:49:13.009 UTC [main] main -> INFO 003 Exiting.....
===================== Chaincode is installed on peer0.org2 =====================
Instantiating chaincode on peer0.org2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
+ 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 'OR ('\''Org1MSP.peer'\'','\''Org2MSP.peer'\'')'
+ res=0
+ set +x
2022-06-01 13:49:13.040 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:49:13.040 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 13:49:30.209 UTC [main] main -> INFO 003 Exiting.....
===================== Chaincode Instantiation on peer0.org2 on channel 'mychannel' is successful =====================
Querying chaincode on peer0.org1...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
===================== Querying on peer0.org1 on channel 'mychannel'... =====================
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer0.org1 ...3 secs
+ res=0
+ set +x
2022-06-01 13:49:33.290 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:49:33.290 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Query Result: 100
2022-06-01 13:49:39.519 UTC [main] main -> INFO 003 Exiting.....
===================== Query on peer0.org1 on channel 'mychannel' is successful =====================
Sending invoke transaction on peer0.org1...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ 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 -c '{"Args":["invoke","a","b","10"]}'
+ res=0
+ set +x
2022-06-01 13:49:39.552 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:49:39.552 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 13:49:39.559 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200
2022-06-01 13:49:39.559 UTC [main] main -> INFO 004 Exiting.....
===================== Invoke transaction on peer0.org1 on channel 'mychannel' is successful =====================
Installing chaincode on peer1.org2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2022-06-01 13:49:39.586 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:49:39.586 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 13:49:39.684 UTC [main] main -> INFO 003 Exiting.....
===================== Chaincode is installed on peer1.org2 =====================
Querying chaincode on peer1.org2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
===================== Querying on peer1.org2 on channel 'mychannel'... =====================
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer1.org2 ...3 secs
+ res=0
+ set +x
2022-06-01 13:49:42.759 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:49:42.760 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Query Result: 90
2022-06-01 13:49:48.884 UTC [main] main -> INFO 003 Exiting.....
===================== Query on peer1.org2 on channel 'mychannel' is successful =====================
========= All GOOD, BYFN execution completed ===========
_____ _ _ ____
| ____| | \ | | | _ \
| _| | \| | | | | |
| |___ | |\ | | |_| |
|_____| |_| \_| |____/
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
093463781acb dev-peer1.org2.example.com-mycc-1.0-26c2ef32838554aac4f7ad6f100aca865e87959c9a126e86d764c8d01f8346ab "chaincode -peer.add…" About a minute ago Up About a minute dev-peer1.org2.example.com-mycc-1.0
0ac07673c5fa dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9 "chaincode -peer.add…" 2 minutes ago Up 2 minutes dev-peer0.org1.example.com-mycc-1.0
027261fec09c dev-peer0.org2.example.com-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b "chaincode -peer.add…" 2 minutes ago Up 2 minutes dev-peer0.org2.example.com-mycc-1.0
858ae5ce97d3 hyperledger/fabric-tools:latest "/bin/bash" 3 minutes ago Up 3 minutes cli
76db0aba1460 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:8051->7051/tcp, :::8051->7051/tcp, 0.0.0.0:8053->7053/tcp, :::8053->7053/tcp peer1.org1.example.com
b2e57f0d3a01 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:10051->7051/tcp, :::10051->7051/tcp, 0.0.0.0:10053->7053/tcp, :::10053->7053/tcp peer1.org2.example.com
33f2fc56b421 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:9051->7051/tcp, :::9051->7051/tcp, 0.0.0.0:9053->7053/tcp, :::9053->7053/tcp peer0.org2.example.com
dc2e90171d70 hyperledger/fabric-peer:latest "peer node start" 3 minutes ago Up 3 minutes 0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:7053->7053/tcp, :::7053->7053/tcp peer0.org1.example.com
cd32735456c2 hyperledger/fabric-couchdb "tini -- /docker-ent…" 3 minutes ago Up 3 minutes 4369/tcp, 9100/tcp, 0.0.0.0:7984->5984/tcp, :::7984->5984/tcp couchdb2
019b1a555797 hyperledger/fabric-couchdb "tini -- /docker-ent…" 3 minutes ago Up 3 minutes 4369/tcp, 9100/tcp, 0.0.0.0:8984->5984/tcp, :::8984->5984/tcp couchdb3
f633a407249b hyperledger/fabric-couchdb "tini -- /docker-ent…" 3 minutes ago Up 3 minutes 4369/tcp, 9100/tcp, 0.0.0.0:6984->5984/tcp, :::6984->5984/tcp couchdb1
80e070cb6629 hyperledger/fabric-orderer:latest "orderer" 3 minutes ago Up 3 minutes 0.0.0.0:7050->7050/tcp, :::7050->7050/tcp orderer.example.com
571d814b10bd hyperledger/fabric-couchdb "tini -- /docker-ent…" 3 minutes ago Up 3 minutes 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp, :::5984->5984/tcp couchdb0
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker logs 093463781acb
ex02 Invoke
Query Response:{
"Name":"a","Amount":"90"}
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker logs 0ac07673c5fa
ex02 Invoke
Query Response:{
"Name":"a","Amount":"100"}
ex02 Invoke
Aval = 90, Bval = 210
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker logs 027261fec09c
ex02 Init
Aval = 100, Bval = 200
En este punto enlace: http://localhost:5984/_utils/ para ver los datos en couchdb
4.6.2 Agregar manualmente contratos inteligentes
- Complete la declaración del nombre del canal en el contenedor cli
- Instale el contrato escrito por go: canicas y complete la inicialización
- El contrato de llamada se completa: a. Inicializa la canica 1 (canica1), azul, 35, el dueño es tom; b. Inicializa la canica 2, roja, 50, el dueño es tom; c. Inicializa la canica 3, azul, 70, el dueño es tom; d. Establecer el propietario de la canica 2 en jerry; e. Establecer el color de la canica 2 en azul; f. Eliminar la canica 1
- Consulta canicas 2 en el contenedor cli:
Query Result: {
"color":"red","docType":"marble","name":"marble2","owner":"jerry","size":50}
- Determine el historial de cambios para Marble 1:
Query Result: [{
"TxId":"72344571444c9b2658468f7ef432e67f9fc7a2c168ee9105b3d181305efcd7fe", "Value":{
"docType":"marble","name":"marble1","color":"blue","size":35,"owner":"tom"}, "Timestamp":"2022-06-01 14:18:43.249592072 +0000 UTC", "IsDelete":"false"},{
"TxId":"cc14f1abd8cc808dd751963ddd48cf95f86bccdeedea6de29df54fa1d99dd00f", "Value":{
"docType":"marble","name":"marble1","color":"blue","size":35,"owner":"jerry"}, "Timestamp":"2022-06-01 14:19:26.884524233 +0000 UTC", "IsDelete":"false"},{
"TxId":"dd7d45471c8f1af6902e820e8f95dff1fcdf5f66ba757f8e6d3552e703f165f1", "Value":null, "Timestamp":"2022-06-01 14:19:37.506046767 +0000 UTC", "IsDelete":"true"}]
- Consulta las canicas propiedad de jerry:
Query Result: [{
"Key":"marble2", "Record":{
"color":"red","docType":"marble","name":"marble2","owner":"jerry","size":50}},{
"Key":"marble3", "Record":{
"color":"blue","docType":"marble","name":"marble3","owner":"jerry","size":70}}]
Declaración de variable primero
../bin/cryptogen generate --config=./crypto-config.yaml
export FABRIC_CFG_PATH=$PWD
../bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
export CHANNEL_NAME=mychannel && ../bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
../bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
export CORE_PEER_ADDRESS=peer0.org1.example.com:7051
export CORE_PEER_LOCALMSPID="Org1MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export CHANNEL_NAME=mychannel
Empezar a entrar en el contrato de llamada de contenedores
docker exec -it cli bash
peer chaincode install -n marbles -v 1.0 -p github.com/chaincode/marbles02/go
peer chaincode instantiate -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -v 1.0 -c '{"Args":["init"]}' -P "OR ('Org0MSP.peer','Org1MSP.peer')"
peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["initMarble","marble1","blue","35","tom"]}'
peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["initMarble","marble2","red","50","tom"]}'
peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["initMarble","marble3","blue","70","tom"]}'
peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["transferMarble","marble2","jerry"]}'
peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["transferMarblesBasedOnColor","blue","jerry"]}'
peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["delete","marble1"]}'
Verificar el resultado de la llamada del contrato
peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["readMarble","marble2"]}'
peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["getHistoryForMarble","marble1"]}'
peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["queryMarblesByOwner","jerry"]}'
El proceso de operación específico es el siguiente:
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker exec -it cli bash
root@858ae5ce97d3:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CHANNEL_NAME=mychannel
root@858ae5ce97d3:/opt/gopath/src/github.com/hyperledger/fabric/peer# echo $CHANNEL_NAME
mychannel
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel list
2022-06-01 14:17:45.692 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Channels peers has joined:
mychannel
2022-06-01 14:17:45.694 UTC [main] main -> INFO 002 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install -n marbles -v 1.0 -p github.com/chaincode/marbles02/go
2022-06-01 14:18:19.261 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:18:19.261 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 14:18:19.368 UTC [main] main -> INFO 003 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode instantiate -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -v 1.0 -c '{"Args":["init"]}' -P "OR ('Org0MSP.peer','Org1MSP.peer')"
2022-06-01 14:18:28.818 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:18:28.818 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 14:18:35.091 UTC [main] main -> INFO 003 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["initMarble","marble1","blue","35","tom"]}'
2022-06-01 14:18:43.249 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:18:43.249 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 14:18:43.255 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200
2022-06-01 14:18:43.255 UTC [main] main -> INFO 004 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["initMarble","marble2","red","50","tom"]}'
2022-06-01 14:18:52.975 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:18:52.975 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 14:18:52.981 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200
2022-06-01 14:18:52.981 UTC [main] main -> INFO 004 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["initMarble","marble3","blue","70","tom"]}'
2022-06-01 14:19:01.834 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:19:01.834 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 14:19:01.843 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200
2022-06-01 14:19:01.843 UTC [main] main -> INFO 004 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["transferMarble","marble2","jerry"]}'
2022-06-01 14:19:12.121 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:19:12.121 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 14:19:12.131 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200
2022-06-01 14:19:12.131 UTC [main] main -> INFO 004 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["transferMarblesBasedOnColor","blue","jerry"]}'
2022-06-01 14:19:26.884 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:19:26.884 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 14:19:26.901 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200 payload:"Transferred 2 blue marbles to jerry"
2022-06-01 14:19:26.901 UTC [main] main -> INFO 004 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["delete","marble1"]}'
2022-06-01 14:19:37.505 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:19:37.505 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2022-06-01 14:19:37.512 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 003 Chaincode invoke successful. result: status:200
2022-06-01 14:19:37.513 UTC [main] main -> INFO 004 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["readMarble","marble2"]}'
2022-06-01 14:19:46.002 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:19:46.002 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Query Result: {
"color":"red","docType":"marble","name":"marble2","owner":"jerry","size":50}
2022-06-01 14:19:46.008 UTC [main] main -> INFO 003 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["getHistoryForMarble","marble1"]}'
2022-06-01 14:19:55.068 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:19:55.068 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Query Result: [{
"TxId":"72344571444c9b2658468f7ef432e67f9fc7a2c168ee9105b3d181305efcd7fe", "Value":{
"docType":"marble","name":"marble1","color":"blue","size":35,"owner":"tom"}, "Timestamp":"2022-06-01 14:18:43.249592072 +0000 UTC", "IsDelete":"false"},{
"TxId":"cc14f1abd8cc808dd751963ddd48cf95f86bccdeedea6de29df54fa1d99dd00f", "Value":{
"docType":"marble","name":"marble1","color":"blue","size":35,"owner":"jerry"}, "Timestamp":"2022-06-01 14:19:26.884524233 +0000 UTC", "IsDelete":"false"},{
"TxId":"dd7d45471c8f1af6902e820e8f95dff1fcdf5f66ba757f8e6d3552e703f165f1", "Value":null, "Timestamp":"2022-06-01 14:19:37.506046767 +0000 UTC", "IsDelete":"true"}]
2022-06-01 14:19:55.073 UTC [main] main -> INFO 003 Exiting.....
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode query -C $CHANNEL_NAME -n marbles -c '{"Args":["queryMarblesByOwner","jerry"]}'
2022-06-01 14:20:19.711 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 14:20:19.711 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Query Result: [{
"Key":"marble2", "Record":{
"color":"red","docType":"marble","name":"marble2","owner":"jerry","size":50}},{
"Key":"marble3", "Record":{
"color":"blue","docType":"marble","name":"marble3","owner":"jerry","size":70}}]
2022-06-01 14:20:19.731 UTC [main] main -> INFO 003 Exiting.....
4.7 fabric-1.1.0 apagando la red
Debe prestar atención a si está en el contenedor.En el contenedor, primero debe salir y luego cerrar la red.
./byfn.sh abajo
root@7c90277eb950:/opt/gopath/src/github.com/hyperledger/fabric/peer# exit
exit
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# ./byfn.sh down
Stopping with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] y
proceeding ...
Stopping cli ... done
Stopping peer0.org1.example.com ... done
Stopping peer1.org2.example.com ... done
Stopping peer1.org1.example.com ... done
Stopping peer0.org2.example.com ... done
Stopping orderer.example.com ... done
Stopping couchdb1 ... done
Stopping couchdb0 ... done
Stopping couchdb3 ... done
Stopping couchdb2 ... done
Removing cli ... done
Removing peer0.org1.example.com ... done
Removing peer1.org2.example.com ... done
Removing peer1.org1.example.com ... done
Removing peer0.org2.example.com ... done
Removing orderer.example.com ... done
Removing couchdb1 ... done
Removing couchdb0 ... done
Removing couchdb3 ... done
Removing couchdb2 ... done
Removing network net_byfn
Removing volume net_orderer.example.com
Removing volume net_peer0.org1.example.com
Removing volume net_peer1.org1.example.com
Removing volume net_peer0.org2.example.com
Removing volume net_peer1.org2.example.com
Removing network net_byfn
WARNING: Network net_byfn not found.
Removing volume net_orderer.example.com
WARNING: Volume net_orderer.example.com not found.
Removing volume net_peer0.org1.example.com
WARNING: Volume net_peer0.org1.example.com not found.
Removing volume net_peer1.org1.example.com
WARNING: Volume net_peer1.org1.example.com not found.
Removing volume net_peer0.org2.example.com
WARNING: Volume net_peer0.org2.example.com not found.
Removing volume net_peer1.org2.example.com
WARNING: Volume net_peer1.org2.example.com not found.
b166392a8a1c
14ca19a577ff
2f01f5295820
4e6ed6dde495
Untagged: dev-peer0.org1.example.com-marbles-1.0-f57d84df5eaddfab2c22f5896ebc44f52af3829d7f9d8a271b41651a0d4cb353:latest
Deleted: sha256:d71dd91274efe31740f8fdee93c316c202216a78b03f026537b25ace24e0af2c
Deleted: sha256:ad7cdaec943cd0bde626809ee8f4fefb17e60472569fcf3fd0d633a5c82a2495
Deleted: sha256:a61393a5f4ecb0533d5ab2c72c2c2970db9ee428f2e56e80b66ba9a05761a020
Deleted: sha256:7dcf6c97a76d70393d5f3ea947b5b5e056e19a7b0b0fe18d879c3c4c3587918d
Untagged: dev-peer1.org2.example.com-mycc-1.0-26c2ef32838554aac4f7ad6f100aca865e87959c9a126e86d764c8d01f8346ab:latest
Deleted: sha256:f0086f16fdc1c37c5c315e9c2b13c834b1b9843f1a5ece4e0e3527c99d2f4d98
Deleted: sha256:7659ec3feec4af2ff128790abb592cbefab005ebf67a071683eaab78c43836ae
Deleted: sha256:d530980a6d79098b6fe37c934ea9a690b91a12e51165f48286419450d3334b7b
Deleted: sha256:483bdd45c706d5d5a83dbd0337cb3c173fc6bf79de33687dd5e56d58a4245f09
Untagged: dev-peer0.org1.example.com-mycc-1.0-384f11f484b9302df90b453200cfb25174305fce8f53f4e94d45ee3b6cab0ce9:latest
Deleted: sha256:b4de3bdc8be762980e60cdb6e77b300ad700960f4fbc31fdc1005bb2b920a1eb
Deleted: sha256:c4ec6875a6af954b3d9a86325faf526ccbbd67d6422d2662a02184099122baf0
Deleted: sha256:35aaa5491bd321f8391144ce9dc1732af506cddf1f1392dd17b8c90c508f980c
Deleted: sha256:7aef81669472f350d49d0278a5728faebda9a0a51b871055f2eee87b3b8740b0
Untagged: dev-peer0.org2.example.com-mycc-1.0-15b571b3ce849066b7ec74497da3b27e54e0df1345daff3951b94245ce09c42b:latest
Deleted: sha256:621734fe96ea4675f7d64a26c7cfbbd6a275c3cc25ed3fc9866ac6bfca039ba3
Deleted: sha256:2f380b23e4c66bae159d2c662cd194645f9d965cdcfc185e622a9c8fde4d0331
Deleted: sha256:c114b9d78c7d4d30f6e36f45e5c7bc48f4c5ba2ecae87e3864ae46b5f7f2b10b
Deleted: sha256:655bdfb0eda16b7437dac802e0dd781760f3b5b4795f7268a7f5fffb138f5c08
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Solución de problemas
1. Se informa un error al cambiar de versión del proyecto:
versión de pago de git-2.2
error: Sus modificaciones locales a los siguientes archivos serán sobrescritas por la operación de pago:
Solución: https://blog.csdn.net/lakersssss24/article/details/119615476
git stash
git checkout release-2.2
2. Inicie la red e informe que no se encontró el comando docker-compose
./red.sh hasta -i 2.2.5
./network.sh: línea 280: docker-compose: comando no encontrado
Solución:
apt-get install docker-compose después de la instalación
3. La versión 1.1.0 inicia la red e informa error SIGSEGV
./byfn.sh -m arriba
+ 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=2
+ set +x
2022-05-31 12:51:50.026 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f5ab6377259]
runtime stack:
runtime.throw(0xf11259, 0x2a)
/opt/go/src/runtime/panic.go:605 +0x95
runtime.sigpanic()
/opt/go/src/runtime/signal_unix.go:351 +0x2b8
goroutine 34 [syscall, locked to thread]:
runtime.cgocall(0xbf3800, 0xc42002fde8, 0xf0fa21)
/opt/go/src/runtime/cgocall.go:132 +0xe4 fp=0xc42002fda8 sp=0xc42002fd68 pc=0x4023b4
Referencia: SIGSEGV Análisis de problemas y uso compartido de experiencias de soluciones de Hyperledger Fabric implementado en el entorno de Aliyun Agregue la instrucción go a los tres archivos en el directorio actual:
- GODEBUG=netdns=go
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# gedit /workspace/github.com/fabric/fabric-samples/first-network/docker-compose-cli.yaml
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# gedit base/docker-compose-base.yaml
root@The-Land-Like-as-A-Picture:/workspace/github.com/fabric/fabric-samples/first-network# gedit base/peer-base.yaml
Resulta que todo funciona bien:
4. Error: propuesta fallida (err: error rpc: código = Desc no disponible = el transporte se está cerrando) se informa cuando se usa couchdb en la versión 1.1.0
./byfn.sh -m up -t 999999 -s couchdb
Having all peers join the channel...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=INFO
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
+ peer channel join -b mychannel.block
+ res=1
+ set +x
2022-05-31 15:11:27.837 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Error: proposal failed (err: rpc error: code = Unavailable desc = transport is closing)
Usage:
peer channel join [flags]
Flags:
-b, --blockpath string Path to file containing genesis block
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--certfile string Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
--clientauth Use mutual TLS when communicating with the orderer endpoint
--keyfile string Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--ordererTLSHostnameOverride string The hostname override to use when validating the TLS connection to the orderer.
--tls Use TLS when communicating with the orderer endpoint
-v, --version Display current version of fabric peer server
peer0.org1 failed to join the channel, Retry after 3 seconds
Solución:
comencé a pensar si el nodo no se inició, pero mire más de cerca:
3 de los 4 pares se iniciaron, por lo que no es un problema con el contenedor de pares. Combinado con el hecho de que puede unirse al canal normalmente sin agregar couchdb antes, considere el problema del contenedor de couchdb.
docker tag 7e73c828fc5b hyperledger/fabric-couchdb: último
Resultado final: unión normal sin error
5. Se reporta error endosando invocar al llamar al contrato en la versión 1.1.0
peer chaincode invoque -o orderer.example.com:7050 --tls --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 $NOMBRE_CANAL -n canicas -c '{“Args”:[“transferMarble”,“marble2”,“jerry”]}'
root@858ae5ce97d3:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode invoke -o orderer.example.com:7050 --tls --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 $CHANNEL_NAME -n marbles -c '{"Args":["transferMarble","marble2","jerry"]}'
2022-06-01 13:58:51.556 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2022-06-01 13:58:51.556 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: Error endorsing invoke: rpc error: code = Unknown desc = chaincode error (status: 500, message: Marble does not exist) - <nil>
Usage:
peer chaincode invoke [flags]
Flags:
-C, --channelID string The channel on which this command should be executed
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
-n, --name string Name of the chaincode
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
--certfile string Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
--clientauth Use mutual TLS when communicating with the orderer endpoint
--keyfile string Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--ordererTLSHostnameOverride string The hostname override to use when validating the TLS connection to the orderer.
--tls Use TLS when communicating with the orderer endpoint
--transient string Transient map of arguments in JSON encoding
-v, --version Display current version of fabric peer server
Motivo: la declaración no se agrega, solo declare la declaración inicial de 3.8.4.1 fabric 1.1, 3.8.4.2 cli variables de entorno y canales
…/bin/cryptogen generate --config=./crypto-config.yaml
export FABRIC_CFG_PATH=$PWD
…/bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
export CHANNEL_NAME=mychannel && …/bin/ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID $CHANNEL_NAME
…/bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP
…/bin/configtxgen -perfil TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSPexport CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
export CORE_PEER_ADDRESS=peer0.org1.example. com:7051
exportar CORE_PEER_LOCALMSPID=“Org1MSP”
exportar CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls /ca.crtexport CHANNEL_NAME=micanal