How to fix "Failed creating puller config from bootstrap block: unable to decode TLS certificate PEM" in HLF with Raft Cluster - hyperledger-fabric

I am trying to set up a Hyperledger Fabric network with the orderer as Raft (3 nodes in the cluster). I am using Kubernetes with Helm in Cloud.
Everything works fine when it is a single node Raft set up. However, for a multi-node setup, I am getting the following error.
[orderer.common.cluster] createReplicator -> PANI 3f4 Failed creating puller config from bootstrap block: unable to decode TLS certificate PEM:
panic: Failed creating puller config from bootstrap block: unable to decode TLS certificate PEM:
goroutine 15 [running]:
github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc0000f1ce0, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore/entry.go:229 +0x515
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).log(0xc000140158, 0x4, 0x1047e13, 0x36, 0xc000289c50, 0x1, 0x1, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:234 +0xf6
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).Panicf(0xc000140158, 0x1047e13, 0x36, 0xc000289c50, 0x1, 0x1)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:159 +0x79
github.com/hyperledger/fabric/common/flogging.(*FabricLogger).Panicf(0xc000140160, 0x1047e13, 0x36, 0xc000289c50, 0x1, 0x1)
/opt/gopath/src/github.com/hyperledger/fabric/common/flogging/zap.go:74 +0x60
github.com/hyperledger/fabric/orderer/common/server.(*replicationInitiator).createReplicator(0xc0001c8ba0, 0xc0003ce340, 0xc00031a9a0, 0xb)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/onboarding.go:60 +0x30c
github.com/hyperledger/fabric/orderer/common/server.(*replicationInitiator).ReplicateChains(0xc0001c8ba0, 0xc0003ce340, 0xc00031a000, 0x1, 0x1, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/onboarding.go:117 +0x1ca
github.com/hyperledger/fabric/orderer/common/server.(*inactiveChainReplicator).replicateDisabledChains(0xc0003701e0)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/onboarding.go:224 +0x1f5
github.com/hyperledger/fabric/orderer/common/server.(*inactiveChainReplicator).run(0xc0003701e0)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/onboarding.go:202 +0x42
created by github.com/hyperledger/fabric/orderer/common/server.initializeEtcdraftConsenter
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/main.go:637 +0x3fc
Other configs as follows
configtx.yaml
MultiNodeEtcdRaft:
<<: *ChannelDefaults
Capabilities:
<<: *ChannelCapabilities
Orderer:
<<: *OrdererDefaults
OrdererType: etcdraft
EtcdRaft:
Consenters:
- Host: orderer.example.com
Port: 7050
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
Consenters:
- Host: orderer2.example.com
Port: 7050
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
Consenters:
- Host: orderer3.example.com
Port: 7050
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
Addresses:
- myorg-orderer-hlf-ord:7050
- myorg-orderer2-hlf-ord:7050
- myorg-orderer3-hlf-ord:7050
Organizations:
- *OrdererOrg
Capabilities:
<<: *OrdererCapabilities
Application:
<<: *ApplicationDefaults
Organizations:
- <<: *OrdererOrg
Consortiums:
SampleConsortium:
Organizations:
- *myorg

I found the solution to this problem.
I had to fix two issues inorder to get this working.
I was missing a few environment variables for TLS in my helm setup for orderer.
ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE: "/var/hyperledger/tls/server/pair/tls.crt"
ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY: "/var/hyperledger/tls/server/pair/tls.key"
ORDERER_GENERAL_CLUSTER_ROOTCAS: "/var/hyperledger/tls/server/cert/cacert.pem"
Syntax error in configtx.yaml YAML config. I was repeating Consenters key multiple times.

Related

Configuring multiple Consortium in Hyperledger Fabric 1.4

In fabric sample, Consortium is defined for two organization and there is provided proile for single consortium Consortium: SampleConsortium in configtx.yaml file.
I have tried to configure two consortium, XYZCosortium and PQRConsortium.
The Profile is defined as below :
MultiNodeEtcdRaft:
<<: *ChannelDefaults
Capabilities:
<<: *ChannelCapabilities
Orderer:
<<: *OrdererDefaults
OrdererType: etcdraft
EtcdRaft:
Consenters:
- Host: orderer1.xyz.com
Port: 7050
ClientTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer1.xyz.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer1.xyz.com/tls/server.crt
- Host: orderer2.xyz.com
Port: 7050
ClientTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer2.xyz.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer2.xyz.com/tls/server.crt
- Host: orderer3.xyz.com
Port: 7050
ClientTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer3.xyz.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer3.xyz.com/tls/server.crt
- Host: orderer1.pqr.com
Port: 7050
ClientTLSCert: crypto-config/ordererOrganizations/pqr.com/orderers/orderer1.pqr.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/pqr.com/orderers/orderer1.pqr.com/tls/server.crt
- Host: orderer2.pqr.com
Port: 7050
ClientTLSCert: crypto-config/ordererOrganizations/pqr.com/orderers/orderer2.pqr.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/pqr.com/orderers/orderer2.pqr.com/tls/server.crt
Addresses:
- orderer1.xyz.com:7050
- orderer2.xyz.com:7050
- orderer3.xyz.com:7050
- orderer1.pqr.com:7050
- orderer2.pqr.com:7050
Organizations:
- *OrdererOrg
- *Orderer2Org
Capabilities:
<<: *OrdererCapabilities
Application:
<<: *ApplicationDefaults
Organizations:
- <<: *OrdererOrg
- <<: *Orderer2Org
Consortiums:
XYZConsortium:
Organizations:
- *Org1
PQRConsortium:
Organizations:
- *Org2
Here are two cosortium and each have one organization and corrosponding orderers as defined in above profile of orderer.
I am getting MSP related issues, Identity issues and others too. My question is,
Configuraiton of multiple consortium is possible is fabric 1.4 ?
How to configure multiple consortium in Fabric ?
Configuraiton of multiple consortium is possible with fabric 1.4 .
To configure multiple consortium in Fabric, you have to write configtx.yaml file properly, specially the profile
Profiles:
OrgsChannel1:
Consortium: Consortium1
<<: *ChannelDefaults
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
- *Org3
Capabilities:
<<: *ApplicationCapabilities
OrgsChannel2:
Consortium: Consortium2
<<: *ChannelDefaults
Application:
<<: *ApplicationDefaults
Organizations:
- *Org3
- *Org4
Capabilities:
<<: *ApplicationCapabilities
SampleMultiNodeEtcdRaft:
<<: *ChannelDefaults
Capabilities:
<<: *ChannelCapabilities
Orderer:
<<: *OrdererDefaults
OrdererType: etcdraft
EtcdRaft:
Consenters:
- Host: orderer.example.com
Port: 7050
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
- Host: orderer2.example.com
Port: 8050
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
- Host: orderer3.example.com
Port: 9050
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
- Host: orderer4.example.com
Port: 10050
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
- Host: orderer5.example.com
Port: 11050
ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
Addresses:
- orderer.example.com:7050
- orderer2.example.com:8050
- orderer3.example.com:9050
- orderer4.example.com:10050
- orderer5.example.com:11050
Organizations:
- *OrdererOrg
Capabilities:
<<: *OrdererCapabilities
Application:
<<: *ApplicationDefaults
Organizations:
- <<: *OrdererOrg
Consortiums:
Consortium1:
Organizations:
- *Org1
- *Org2
- *Org3
Consortium2:
Organizations:
- *Org3
- *Org4

Hyperledger Fabric's Idemix usage

I want to try the idemix feature introduced by Fabric 1.3 version. based on the repo. I did some changes in order to support idemix. But when I run java -cp blockchain-client.jar org.example.chaincode.invocation.InvokeChaincode
,btw, I omitted the step 5 for Register and enroll users, I came across
2019-10-18 03:20:10.312 UTC [protoutils] ValidateProposalMessage -> WARN 049 channel [mychannel]: creator certificate is not valid: Failed verifing with opts [&{<nil> <nil> [] [{1 [111 114 103 49]} {2 1} {0 <nil>} {0 <nil>}] 3 [] 0 0xc00000fab8 0}]: signature invalid: APrime and ABar don't have the expected structure
2019-10-18 03:20:10.312 UTC [comm.grpc.server] 1 -> INFO 04a unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.22.0.1:33960 error="access denied: channel [mychannel] creator org [idemixMSPID1]" grpc.code=Unknown grpc.call_duration=82.6484ms` from peer container.
I set up a fabric network with minimal components. Two organizations, each has two peers and a CA. The demo is from repo. The demo's network with no idemix feature supported works well. When I add idemix section to configtx.yaml, regenerate crypto material, create a channel, etc. And the network finally is up. All containers are work well. But I interact with fab car chaincode using java-sdk, the above error info was thrown.
The following are from configtx.yaml file(just show key parts here):
Organizations:
- &OrdererOrg
Name: OrdererOrg
ID: OrdererMSP
MSPDir: crypto-config/ordererOrganizations/example.com/msp
- &Org1
Name: Org1MSP
ID: Org1MSP
MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
- &Org2
Name: Org2MSP
ID: Org2MSP
MSPDir: crypto-config/peerOrganizations/org2.example.com/msp
- &Org1Idemix
Name: idemixMSP1
ID: idemixMSPID1
msptype: idemix
MSPDir: crypto-config/peerOrganizations/org3.example.com
- &Org2Idemix
Name: idemixMSP2
ID: idemixMSPID2
msptype: idemix
MSPDir: crypto-config/peerOrganizations/org4.example.com
Capabilities:
Channel: &ChannelCapabilities
V1_3: true
Orderer: &OrdererCapabilities
V1_1: true
Application: &ApplicationCapabilities
V1_3: true
#V1_2: false
#V1_1: false
Application: &ApplicationDefaults
Organizations:
Channel: &ChannelDefaults
Policies:
Readers:
Type: ImplicitMeta
Rule: "ANY Readers"
Writers:
Type: ImplicitMeta
Rule: "ANY Writers"
Admins:
Type: ImplicitMeta
Rule: "MAJORITY Admins"
Capabilities:
<<: *ChannelCapabilities
Profiles:
TwoOrgsOrdererGenesis:
Capabilities:
<<: *ChannelCapabilities
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Capabilities:
<<: *OrdererCapabilities
Consortiums:
SampleConsortium:
Organizations:
- *Org1
- *Org2
- *Org1Idemix
- *Org2Idemix
Application:
<<: *ApplicationDefaults
Organizations:
- *OrdererOrg
Capabilities:
<<: *ApplicationCapabilities
TwoOrgsChannel:
Consortium: SampleConsortium
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
- *Org1Idemix
- *Org2Idemix
Capabilities:
<<: *ApplicationCapabilities
The code I add in InvokeChaincode.java before creating channel client as follows:
// org/example/chaincode/invocation.java
UserContext normalUserContext = new UserContext();
String name = "user"+System.currentTimeMillis();
normalUserContext.setName(name);
normalUserContext.setAffiliation(Config.ORG1);
normalUserContext.setMspId(Config.ORG3_IDEMIX_MSP);
String enrollmentSecret = caClient.registerUser(name, Config.ORG1);
normalUserContext = caClient.idemixEnrollUser(normalUserContext, enrollmentSecret,normalUserContext.getMspId());
FabricClient fabClient = new FabricClient(normalUserContext);
The configuration file added code:
// org/example/config/Config.java
public static final String ORG3 = "org3";
public static final String ORG3_IDEMIX_MSP = "idemixMSPID1";
And docker-composer.yaml file remains unchanged.
All the images used are 1.4.1
I expect the endorser peer able to verify tx proposal from client with idemix enabled. But now the peer side report 2019-10-18 03:20:10.312 UTC [protoutils] ValidateProposalMessage -> WARN 049 channel [mychannel]: creator certificate is not valid: Failed verifing with opts [&{<nil> <nil> [] [{1 [111 114 103 49]} {2 1} {0 <nil>} {0 <nil>}] 3 [] 0 0xc00000fab8 0}]: signature invalid: APrime and ABar don't have the expected structure
2019-10-18 03:20:10.312 UTC [comm.grpc.server] 1 -> INFO 04a unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=172.22.0.1:33960 error="access denied: channel [mychannel] creator org [idemixMSPID1]" grpc.code=Unknown grpc.call_duration=82.6484ms
I don't know why. I guess that if a peer does not support idemix tx verification. Are there some switches not open on peers? Help. Any replies will be thankful.

failed to get discovery service: could not get chConfig cache reference: read configuration for channel peers failed

When trying to install and instantiate the chaincode I'm getting below error:
error coming on WSL(Windows subsystem for Linux)
Unable to install and instantiate the chaincode: failed to instantiate the chaincode: failed to get discovery service: could not get chConfig cache reference: read configuration for channel peers failed
error on Ubuntu 16.04
Unable to install and instantiate the chaincode: failed to instantiate the chaincode: failed to get discovery service: could not get chConfig cache reference: no channel peers configured for channel [mychannel]
I'm following the chainHero example. below is the complete output after running make command.
Build done
Start environment ...
Creating network "firstproject-network_default" with the default driver
Creating orderer.firstproject.com ... done
Creating ca.org1.firstproject.com ... done
Creating peer0.org1.firstproject.com ... done
Creating peer1.org1.firstproject.com ... done
Docker environment up
Start app and initializing skd with local network...
SDK created
Resource management client created
value of req is: {mychannel <nil> /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/artifacts/channel.tx [0xc0001d4fa0]}
Value of setup.Orderer is: orderer.firstproject.com
Channel created
Channel joined
Initialization Successful
ccPkg created
Chaincode installed
Unable to install and instantiate the chaincode: failed to instantiate the chaincode: failed to get discovery service: could not get chConfig cache reference: read configuration for channel peers failed
config.yaml
name: "firstproject-network"
version: 1.0.0
client:
organization: org1
logging:
level: info
peer:
timeout:
connection: 10s
response: 180s
discovery:
greylistExpiry: 10s
eventService:
timeout:
connection: 15s
registrationResponse: 15s
orderer:
timeout:
connection: 15s
response: 15s
cryptoconfig:
path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config
credentialStore:
path: /tmp/firstproject-store
cryptoStore:
path: /tmp/firstproject-msp
BCCSP:
security:
enabled: true
default:
provider: "SW"
hashAlgorithm: "SHA2"
softVerify: true
level: 256
tlsCerts:
systemCertPool: false
client:
keyfile:
certfile:
channels:
OneOrgChannel:
peers:
peer0.org1.firstproject.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
peer1.org1.firstproject.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
policies:
queryChannelConfig:
minResponses: 1
maxTargets: 1
retryOpts:
attempts: 5
initialBackoff: 500ms
maxBackoff: 5s
backoffFactor: 2.0
# list of participating organizations in this network
organizations:
org1:
mspid: Org1MSP
cryptoPath: peerOrganizations/org1.firstproject.com/users/{userName}#org1.firstproject.com/msp
peers:
- peer0.org1.firstproject.com
- peer1.org1.firstproject.com
certificateAuthorities:
- ca.org1.firstproject.com
orderers:
orderer.firstproject.com:
url: grpcs://localhost:7050
grpcOptions:
ssl-target-name-override: orderer.firstproject.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
# Certificate location absolute path
path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config/ordererOrganizations/firstproject.com/tlsca/tlsca.firstproject.com-cert.pem
peers:
peer0.org1.firstproject.com:
# this URL is used to send endorsement and query requests
url: grpcs://localhost:7051
# eventUrl is only needed when using eventhub (default is delivery service)
eventUrl: grpcs://localhost:7053
grpcOptions:
ssl-target-name-override: peer0.org1.firstproject.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config/peerOrganizations/org1.firstproject.com/tlsca/tlsca.org1.firstproject.com-cert.pem
peer1.org1.firstproject.com:
url: grpcs://localhost:8051
eventUrl: grpcs://localhost:8053
grpcOptions:
ssl-target-name-override: peer1.org1.firstproject.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config/peerOrganizations/org1.firstproject.com/tlsca/tlsca.org1.firstproject.com-cert.pem
certificateAuthorities:
ca.org1.firstproject.com:
url: http://localhost:7054
httpOptions:
verify: false
registrar:
enrollId: admin
enrollSecret: adminpw
caName: ca.org1.firstproject.com
tlsCACerts:
path: /c/Projects/Go/src/github.com/hyperledger/firstproject/firstproject-network/crypto-config/peerOrganizations/org1.firstproject.com/ca/ca.org1.firstproject.com-cert.pem
entityMatchers:
peer:
- pattern: (\w*)peer0.org1.firstproject.com(\w*)
urlSubstitutionExp: grpcs://localhost:7051
eventUrlSubstitutionExp: grpcs://localhost:7053
sslTargetOverrideUrlSubstitutionExp: peer0.org1.firstproject.com
mappedHost: peer0.org1.firstproject.com
- pattern: (\w*)peer1.org1.firstproject.com(\w*)
urlSubstitutionExp: grpcs://localhost:8051
eventUrlSubstitutionExp: grpcs://localhost:8053
sslTargetOverrideUrlSubstitutionExp: peer1.org1.firstproject.com
mappedHost: peer1.org1.firstproject.com
orderer:
- pattern: (\w+).firstproject.(\w+):(\d+)
urlSubstitutionExp: grpcs://localhost:7050
sslTargetOverrideUrlSubstitutionExp: orderer.firstproject.com
mappedHost: orderer.firstproject.com
- pattern: (\w+).firstproject.(\w+)
urlSubstitutionExp: grpcs://localhost:7050
sslTargetOverrideUrlSubstitutionExp: orderer.firstproject.com
mappedHost: orderer.firstproject.com
certificateAuthorities:
- pattern: (\w*)ca.org1.firstproject.com(\w*)
urlSubstitutionExp: http://localhost:7054
mappedHost: ca.org1.firstproject.com
docker-compose.yaml
version: '2'
networks:
default:
services:
orderer.firstproject.com:
container_name: orderer.firstproject.com
extends:
file: peer-base.yaml
service: orderer-base
volumes:
- ./crypto-config/ordererOrganizations/firstproject.com/orderers/orderer.firstproject.com/msp:/var/hyperledger/orderer/msp
- ./artifacts/orderer.genesis.block:/var/hyperledger/orderer/orderer.genesis.block
- ./crypto-config/ordererOrganizations/firstproject.com/orderers/orderer.firstproject.com/tls:/var/hyperledger/orderer/tls
ports:
- 7050:7050
ca.org1.firstapplication.com:
image: hyperledger/fabric-ca:latest
container_name: ca.org1.firstproject.com
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.org1.firstproject.com
- FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.firstproject.com-cert.pem
- FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/78da3186373e52832b71dd83ec4d36ef84722a3e3ed15e8df214b482fe2723e7_sk
- FABRIC_CA_SERVER_TLS_ENABLED=true
- FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.firstproject.com-cert.pem
- FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/78da3186373e52832b71dd83ec4d36ef84722a3e3ed15e8df214b482fe2723e7_sk
ports:
- 7054:7054
command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org1.firstproject.com/ca/:/etc/hyperledger/fabric-ca-server-config
peer0.org1.firstproject.com:
container_name: peer0.org1.firstproject.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_NETWORKID=firstproject
- CORE_PEER_ID=peer0.org1.firstproject.com
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_PEER_ADDRESS=peer0.org1.firstproject.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.firstproject.com:7051
- CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
- CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer0.org1.firstproject.com
#- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.firstapplication.com:7051
volumes:
- ./var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer0.org1.firstproject.com/msp:/var/hyperledger/msp
- ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer0.org1.firstproject.com/tls:/var/hyperledger/tls
ports:
- 7051:7051
- 7053:7053
depends_on:
- orderer.firstproject.com
links:
- orderer.firstproject.com
networks:
default:
aliases:
- peer0.org1.firstproject.com
peer1.org1.firstproject.com:
container_name: peer1.org1.firstproject.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_NETWORKID=firstproject
- CORE_PEER_ID=peer1.org1.firstproject.com
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_PEER_ADDRESS=peer1.org1.firstproject.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.firstproject.com:7051
- CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
- CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer1.org1.firstproject.com
#- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.firstapplication.com:7051
volumes:
- /var/run/:/host/var/run/
- ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer1.org1.firstproject.com/msp:/var/hyperledger/msp
- ./crypto-config/peerOrganizations/org1.firstproject.com/peers/peer1.org1.firstproject.com/tls:/var/hyperledger/tls
ports:
- 8051:7051
- 8053:7053
depends_on:
- orderer.firstproject.com
links:
- orderer.firstproject.com
networks:
default:
aliases:
- peer1.org1.firstproject.com
peer-base.yaml
version: '2'
services:
peer-base:
image: hyperledger/fabric-peer:latest
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_VM_DOCKER_ATTACHSTDOUT=true
- FABRIC_LOGGING_SPEC=DEBUG
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/var/hyperledger/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/var/hyperledger/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/var/hyperledger/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/var/hyperledger/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
orderer-base:
image: hyperledger/fabric-orderer:latest
environment:
- FABRIC_LOGGING_SPEC=DEBUG
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
# enabled TLS
- ORDERER_GENERAL_TLS_ENABLED=true
- ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
- ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
- ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
- ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
You're using the wrong channel name to instantiate the chaincode, in the config.yaml you have defined a channel OneOrgChannel with peer peer0, peer1. However, you seem to be using a channel mychannel to instantiate chaincode.
Either change the channel name to OneOrgChannelor add mychannel in the config.yaml.

Hyperledger Fabric: 'Orderer' has invalid keys: EtcdRaft

while using the configtx.yaml from official Hyperledger repo we get below error when trying to create a genesis block:
root#774983db9864:/home# configtxgen -profile OrgsOrdererGenesis -outputBlock genesis.block -channelID 4chan
2019-03-05 19:25:44.240 UTC [common/tools/configtxgen] main -> INFO 001 Loading configuration
2019-03-05 19:25:44.261 UTC [common/tools/configtxgen/localconfig] Load -> CRIT 002 Error unmarshaling config into struct: 2 error(s) decoding:
* 'Orderer' has invalid keys: EtcdRaft
* 'Profiles[OrgsOrdererGenesis].Orderer' has invalid keys: EtcdRaft
2019-03-05 19:25:44.262 UTC [common/tools/configtxgen] func1 -> CRIT 003 Error unmarshaling config into struct: 2 error(s) decoding:
* 'Orderer' has invalid keys: EtcdRaft
* 'Profiles[OrgsOrdererGenesis].Orderer' has invalid keys: EtcdRaft
panic: Error unmarshaling config into struct: 2 error(s) decoding:
* 'Orderer' has invalid keys: EtcdRaft
* 'Profiles[OrgsOrdererGenesis].Orderer' has invalid keys: EtcdRaft [recovered]
panic: Error unmarshaling config into struct: 2 error(s) decoding:
* 'Orderer' has invalid keys: EtcdRaft
* 'Profiles[OrgsOrdererGenesis].Orderer' has invalid keys: EtcdRaft
goroutine 1 [running]:
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panic(0xc420195e00, 0xc420523560, 0x1, 0x1)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/op/go-logging/logger.go:188 +0xbd
main.main.func1()
/opt/gopath/src/github.com/hyperledger/fabric/common/tools/configtxgen/main.go:254 +0x1ae
panic(0xc6ea00, 0xc420523550)
/opt/go/src/runtime/panic.go:505 +0x229
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panic(0xc420195c50, 0xc42054e120, 0x2, 0x2)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/op/go-logging/logger.go:188 +0xbd
github.com/hyperledger/fabric/common/tools/configtxgen/localconfig.Load(0x7fffbcd538da, 0x12, 0x0, 0x0, 0x0, 0xc4201b3540)
/opt/gopath/src/github.com/hyperledger/fabric/common/tools/configtxgen/localconfig/config.go:284 +0x607
main.main()
/opt/gopath/src/github.com/hyperledger/fabric/common/tools/configtxgen/main.go:265 +0xce7
How can we fix this please?
Solution is to delete the EtcdRaft section as the Raft based consensus is not yet implemented in Hyperledger Fabric v1.3 or 1.4. The configtx.yaml in the repo should not be having this section.
SampleMultiNodeEtcdRaft:
<<: *ChannelDefaults
Capabilities:
<<: *ChannelCapabilities
Orderer:
<<: *OrdererDefaults
OrdererType: etcdraft
EtcdRaft:
Options:
TickInterval: 500ms
ElectionTick: 10
HeartbeatTick: 1
MaxInflightBlocks: 5
SnapshotIntervalSize: 20971520
Consenters:
...

Orderer capability V1_3 is required but not supported: But, I'm using 1.3.0 images

I set up channel that has following compatibility, (set in configtx.yaml)
Capabilities:
Channel: &ChannelCapabilities
V1_3: true
Orderer: &OrdererCapabilities
V1_3: true
Application: &ApplicationCapabilities
V1_3: true
and started the orderer with well generated genesis block file. I also specified orderer image version:
image: hyperledger/fabric-orderer:1.3.0
and it gives error
2018-11-28 01:36:41.191 UTC [orderer/commmon/multichannel] checkResourcesOrPanic -> PANI 005 [channel testchainid] config requires unsupported orderer capabilities: Orderer capability V1_3 is required but not supported: Orderer capability V
1_3 is required but not supported
panic: [channel testchainid] config requires unsupported orderer capabilities: Orderer capability V1_3 is required but not supported: Orderer capability V1_3 is required but not supported
goroutine 1 [running]:
github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore.(*CheckedEntry).Write(0xc4201d1600, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/zapcore/entry.go:229 +0x4f4
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).log(0xc42016a270, 0x4, 0xdfecd3, 0xf, 0xc4203a1888, 0x2, 0x2, 0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:234 +0xf6
github.com/hyperledger/fabric/vendor/go.uber.org/zap.(*SugaredLogger).Panicf(0xc42016a270, 0xdfecd3, 0xf, 0xc4203a1888, 0x2, 0x2)
/opt/gopath/src/github.com/hyperledger/fabric/vendor/go.uber.org/zap/sugar.go:159 +0x79
github.com/hyperledger/fabric/common/flogging.(*FabricLogger).Panicf(0xc42016a278, 0xdfecd3, 0xf, 0xc4203a1888, 0x2, 0x2)
/opt/gopath/src/github.com/hyperledger/fabric/common/flogging/zap.go:74 +0x60
github.com/hyperledger/fabric/orderer/common/multichannel.checkResourcesOrPanic(0xeabe80, 0xc4202c8ac0)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/multichannel/registrar.go:58 +0x14d
github.com/hyperledger/fabric/orderer/common/multichannel.(*Registrar).newLedgerResources(0xc42027c480, 0xc42016cc80, 0xc42016cc80)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/multichannel/registrar.go:259 +0x304
github.com/hyperledger/fabric/orderer/common/multichannel.NewRegistrar(0xea36a0, 0xc42011c2e0, 0xc42015b710, 0xe9b060, 0x15a78b0, 0xc42016a318, 0x1, 0x1, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/multichannel/registrar.go:142 +0x312
github.com/hyperledger/fabric/orderer/common/server.initializeMultichannelRegistrar(0xc4201e0580, 0xe9b060, 0x15a78b0, 0xc42016a318, 0x1, 0x1, 0x0)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/main.go:258 +0x250
github.com/hyperledger/fabric/orderer/common/server.Start(0xdf7a5a, 0x5, 0xc4201e0580)
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/main.go:96 +0x226
github.com/hyperledger/fabric/orderer/common/server.Main()
/opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/main.go:75 +0x1d6
main.main()
/opt/gopath/src/github.com/hyperledger/fabric/orderer/main.go:15 +0x20
What should I do to fix this error? What I want to achieve is setting up a network that's only compatible with Hyperledger Fabric 1.3 nodes.
I tried with orderer capability V1_2 and it gives same (except version string) error. Does this mean capability version independent to Hyperledger Fabric version?
In HLF 1.2 & 1.3, the orderer still only supports V1_1 capabilities. So, your configtx.yaml should be:
Capabilities:
Channel: &ChannelCapabilities
V1_3: true
Orderer: &OrdererCapabilities
V1_1: true
Application: &ApplicationCapabilities
V1_3: true

Resources