I've followed the tutorial "Build your first network" for Hyperledger Fabric and added a CA. Now, when trying to deploy a BNA with composer, using composer network deploy -a maintenance-network.bna -p maintenance -i PeerAdmin -s randomString -A admin -S
, i get an error:
~/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
Does anyone know what the problem is ?
This is the output of docker ps
:
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
This is the connection.json i'm using:
{
"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"
}
The keyValStore
contains the identity imported with:
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
The docker containers are started with this 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
And this is the output when running CHANNEL_NAME=mychannel docker-compose -f docker-compose-cli.yaml up -d
:
| ____ _____ _ ____ _____
| / ___| |_ _| / \ | _ \ |_ _|
| \___ \ | | / _ \ | |_) | | |
| ___) | | | / ___ \ | _ < | |
| |____/ |_| /_/ \_\ |_| \_\ |_|
|
| Starting the network
|
| 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=false
| CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
| CORE_PEER_ID=cli
| CORE_LOGGING_LEVEL=DEBUG
| CORE_PEER_ADDRESS=peer0.org1.example.com:7051
| 2017-11-15 09:31:36.011 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
| 2017-11-15 09:31:36.012 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
| 2017-11-15 09:31:36.017 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
| 2017-11-15 09:31:36.018 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
| 2017-11-15 09:31:36.019 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
| 2017-11-15 09:31:36.019 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
| 2017-11-15 09:31:36.019 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
| 2017-11-15 09:31:36.019 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0AC6060A074F7267314D535012BA062D...53616D706C65436F6E736F727469756D
| 2017-11-15 09:31:36.019 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: D6E8392380793B24537309F14EA1C0D9CF3F18FF8292A65D09CF3AA92EA2094D
| 2017-11-15 09:31:36.019 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
| 2017-11-15 09:31:36.019 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
| 2017-11-15 09:31:36.019 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
| 2017-11-15 09:31:36.019 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
| 2017-11-15 09:31:36.019 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AFD060A1508021A0608F892B0D00522...628AB20AD0563C9EA2A482A301EA32D8
| 2017-11-15 09:31:36.019 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 5A58E17C75478098A108CFCFA1E909639C7830022602D225A61C4D0BE9E8C5AD
| 2017-11-15 09:31:36.060 UTC [msp] GetLocalMSP -> DEBU 010 Returning existing local MSP
| 2017-11-15 09:31:36.060 UTC [msp] GetDefaultSigningIdentity -> DEBU 011 Obtaining default signing identity
| 2017-11-15 09:31:36.060 UTC [msp] GetLocalMSP -> DEBU 012 Returning existing local MSP
| 2017-11-15 09:31:36.060 UTC [msp] GetDefaultSigningIdentity -> DEBU 013 Obtaining default signing identity
| 2017-11-15 09:31:36.060 UTC [msp/identity] Sign -> DEBU 014 Sign: plaintext: 0AFD060A1508021A0608F892B0D00522...5B18D1838ED112080A021A0012021A00
| 2017-11-15 09:31:36.060 UTC [msp/identity] Sign -> DEBU 015 Sign: digest: 4309C46AA7BBA47AD146AA77CB1ABAC79114C9C3D66D41B833F82ED7F882E326
| 2017-11-15 09:31:36.082 UTC [channelCmd] readBlock -> DEBU 016 Received block: 0
| 2017-11-15 09:31:36.083 UTC [main] main -> INFO 017 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=false
| CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
| CORE_PEER_ID=cli
| CORE_LOGGING_LEVEL=DEBUG
| CORE_PEER_ADDRESS=peer0.org1.example.com:7051
| 2017-11-15 09:31:36.121 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
| 2017-11-15 09:31:36.121 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
| 2017-11-15 09:31:36.123 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
| 2017-11-15 09:31:36.123 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0AC3070A5B08011A0B08F892B0D00510...A1A603DD33A31A080A000A000A000A00
| 2017-11-15 09:31:36.123 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 5D870839DD3A368A48E2CED8314E3817CA48001BACBF74B36380408D851769AE
| 2017-11-15 09:31:36.158 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
| 2017-11-15 09:31:36.158 UTC [main] main -> INFO 007 Exiting.....
| ===================== PEER0 joined on the channel "mychannel" =====================
| sleep: missing operand
| Try 'sleep --help' for more information.
|
| 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=false
| CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
| CORE_PEER_ID=cli
| CORE_LOGGING_LEVEL=DEBUG
| CORE_PEER_ADDRESS=peer1.org1.example.com:7051
| 2017-11-15 09:31:36.194 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
| 2017-11-15 09:31:36.194 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
| 2017-11-15 09:31:36.196 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
| 2017-11-15 09:31:36.196 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0AC3070A5B08011A0B08F892B0D00510...A1A603DD33A31A080A000A000A000A00
| 2017-11-15 09:31:36.196 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 0B0C3F308D78AC2FDD6FC89A71FED2DCB889038AE993980A6E4B540BB4D3C51A
| 2017-11-15 09:31:36.248 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
| 2017-11-15 09:31:36.248 UTC [main] main -> INFO 007 Exiting.....
| ===================== PEER1 joined on the channel "mychannel" =====================
| sleep: missing operand
| Try 'sleep --help' for more information.
|
| 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=false
| CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
| CORE_PEER_ID=cli
| CORE_LOGGING_LEVEL=DEBUG
| CORE_PEER_ADDRESS=peer0.org2.example.com:7051
| 2017-11-15 09:31:36.288 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
| 2017-11-15 09:31:36.288 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
| 2017-11-15 09:31:36.289 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
| 2017-11-15 09:31:36.290 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0AC4070A5C08011A0C08F892B0D00510...A1A603DD33A31A080A000A000A000A00
| 2017-11-15 09:31:36.290 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 992F4939F777DD575F2753ADF6936A7E6FB9CC8548C188B31E25B06F9ECEA7E7
| 2017-11-15 09:31:36.335 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
| 2017-11-15 09:31:36.335 UTC [main] main -> INFO 007 Exiting.....
| ===================== PEER2 joined on the channel "mychannel" =====================
| sleep: missing operand
| Try 'sleep --help' for more information.
|
| 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=false
| CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
| CORE_PEER_ID=cli
| CORE_LOGGING_LEVEL=DEBUG
| CORE_PEER_ADDRESS=peer1.org2.example.com:7051
| 2017-11-15 09:31:36.372 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
| 2017-11-15 09:31:36.372 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
| 2017-11-15 09:31:36.373 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
| 2017-11-15 09:31:36.374 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0AC4070A5C08011A0C08F892B0D00510...A1A603DD33A31A080A000A000A000A00
| 2017-11-15 09:31:36.374 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 6776D313E8DD88880918868C6BA2C93ECEB05425FE93A7E385762918FA2AF556
| 2017-11-15 09:31:36.419 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
| 2017-11-15 09:31:36.419 UTC [main] main -> INFO 007 Exiting.....
| ===================== PEER3 joined on the channel "mychannel" =====================
| sleep: missing operand
| Try 'sleep --help' for more information.
|
|
| ========= All GOOD, BYFN execution completed ===========
I'm using Ubuntu 16.04 and Composer v0.14.2.
So, if anyone has the same issue: There were errors in the mapping of the docker ports. The ports of the peer docker containers should be
7051
and7053
, mapped to different ports on your host machine (e.g8051
,9051
, etc.).Another error i found: I received the error
Error: Failed to deserialize creator identity, err expected MSP ID Org2MSP, received Org1MSP.
My peers at7051
and8051
have Org1MSP as MSP (Since they both belong to Org1), everyone else has Org2MSP. So, in the connection.json, you can't enter all peers at once. You have to create a connection.json for each MSP, with the peers connected to this MSP.