我已经按照教程"建立你的第一个网络"对于Hyperledger Fabric并添加了CA.现在,当尝试使用编辑器部署BNA时,使用studio
,我收到错误:
composer network deploy -a maintenance-network.bna -p maintenance -i PeerAdmin -s randomString -A admin -S
有谁知道问题是什么?
这是~/network-setup$ composer network deploy -a ~/maintenance-
network/dist/maintenance-network.bna -p maint
enance -i PeerAdmin -s randomString -A admin -S
Deploying business network from archive: /home/vagrant/maintenance-
network/dist/maintenance-network.bna
Business network definition:
Identifier: maintenance-network@0.1.11
Description: Maintenance-network
✖ Deploying business network definition. This may take a minute...
Error: Error trying deploy. Error: Error trying install composer runtime.
Error: TCP Write failed
Command failed
:
docker ps
这是connection.json我使用:
IMAGE COMMAND CREATED STATUS PORTS NAMES
2a4710a6805c hyperledger/fabric-orderer "orderer" 50 seconds ago Up 48 seconds 0.0.0.0:7050->7050/tcp orderer.example.com
81b8cab17323 hyperledger/fabric-peer "peer node start" 50 seconds ago Up 47 seconds 0.0.0.0:8051->8051/tcp, 0.0.0.0:8053->8053/tcp peer1.org1.example.com
ed8f0148a402 hyperledger/fabric-peer "peer node start" 50 seconds ago Up 48 seconds 0.0.0.0:9051->9051/tcp, 0.0.0.0:9053->9053/tcp peer0.org2.example.com
9de5f3918f1d hyperledger/fabric-ca "sh -c 'fabric-ca-..." 50 seconds ago Up 47 seconds 0.0.0.0:7054->7054/tcp ca_peerOrg1
d2d95dc6f20a hyperledger/fabric-ca "sh -c 'fabric-ca-..." 50 seconds ago Up 48 seconds 7054/tcp, 0.0.0.0:8054->8054/tcp ca_peerOrg2
8396f528dc75 hyperledger/fabric-peer "peer node start" 50 seconds ago Up 48 seconds 0.0.0.0:10051->10051/tcp, 0.0.0.0:10053->10053/tcp peer1.org2.example.com
6b1185ea529a hyperledger/fabric-peer "peer node start" 50 seconds ago Up 48 seconds 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
{
"type": "hlfv1",
"orderers": [
{ "url" : "grpc://localhost:7050" }
],
"ca": { "url": "http://localhost:7054",
"name": "ca-org1"
},
"peers": [
{
"requestURL": "grpc://localhost:7051",
"eventURL": "grpc://localhost:7053"
},
{
"requestURL": "grpc://localhost:8051",
"eventURL": "grpc://localhost:8053"
},
{
"requestURL": "grpc://localhost:9051",
"eventURL": "grpc://localhost:9053"
},
{
"requestURL": "grpc://localhost:10051",
"eventURL": "grpc://localhost:10053"
}
],
"keyValStore": "/home/vagrant/.composer-credentials",
"channel": "mychannel",
"mspID": "Org1MSP",
"timeout": "300"
}
包含导入的身份:
keyValStore
使用此composer identity import -p maintenance -u PeerAdmin -c crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem -k crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/*_sk
An identity was imported with name 'PeerAdmin' successfully
:
docker-compose-cli.yaml
这是运行version: '2'
networks:
byfn:
services:
ca0:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org1
- FABRIC_CA_SERVER_TLS_ENABLED=false
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/CA1_PRIVATE_KEY
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/CA1_PRIVATE_KEY -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca_peerOrg1
networks:
- byfn
ca1:
image: hyperledger/fabric-ca
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca-org2
- FABRIC_CA_SERVER_TLS_ENABLED=false
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/CA2_PRIVATE_KEY
ports:
- "8054:8054"
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/CA2_PRIVATE_KEY -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca_peerOrg2
networks:
- byfn
orderer.example.com:
extends:
file: base/docker-compose-base.yaml
service: orderer.example.com
container_name: orderer.example.com
networks:
- byfn
peer0.org1.example.com:
container_name: peer0.org1.example.com
extends:
file: base/docker-compose-base.yaml
service: peer0.org1.example.com
networks:
- byfn
peer1.org1.example.com:
container_name: peer1.org1.example.com
extends:
file: base/docker-compose-base.yaml
service: peer1.org1.example.com
networks:
- byfn
peer0.org2.example.com:
container_name: peer0.org2.example.com
extends:
file: base/docker-compose-base.yaml
service: peer0.org2.example.com
networks:
- byfn
peer1.org2.example.com:
container_name: peer1.org2.example.com
extends:
file: base/docker-compose-base.yaml
service: peer1.org2.example.com
networks:
- byfn
cli:
container_name: cli
image: hyperledger/fabric-tools
tty: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_ENABLED=false
- 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_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_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_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME} ${DELAY}; sleep $TIMEOUT'
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- ca0
- ca1
- orderer.example.com
- peer0.org1.example.com
- peer1.org1.example.com
- peer0.org2.example.com
- peer1.org2.example.com
networks:
- byfn
时的输出:
CHANNEL_NAME=mychannel docker-compose -f docker-compose-cli.yaml up -d
我使用的是Ubuntu 16.04和Composer v0.14.2。
答案 0 :(得分:0)
所以,如果有人有同样的问题:docker端口的映射有错误。对等端口容器的端口应为7051
和7053
,映射到主机上的不同端口(例如8051
,9051
等。)
我发现的另一个错误:我收到了错误Error: Failed to deserialize creator identity, err expected MSP ID Org2MSP, received Org1MSP.
我的同行7051
和8051
将Org1MSP作为MSP(因为它们都属于Org1),其他人都有Org2MSP。因此,在connection.json中,您不能一次输入所有对等体。您必须为每个MSP创建一个connection.json,并将对等体连接到此MSP。