hyperledger fabric discovery service failing endorsement - hyperledger-fabric
Hello everyone i am trying to use service discovery with the node js client to generate transaction proposals, the problem i am having is that when discovery generates the endorsement plan it sends the proposals to the same peer and fails to endorse,
here is one of the endorsement plans generated, idk why but peer names are all wrong
{
"chaincode": "auditoria-cc",
"groups": {
"G0": {
"peers": [
{
"mspid": "Org1MSP",
"endpoint": "peer0.org1.autentia-bchain.com:7051",
"ledger_height": {
"low": 11,
"high": 0,
"unsigned": true
},
"chaincodes": [
{
"name": "auditoria-cc",
"version": "1.0"
}
],
"name": "peer0.org1.autentia-bchain.com"
}
]
},
"G1": {
"peers": [
{
"mspid": "Org2MSP",
"endpoint": "peer0.org2.autentia-bchain.com:7051",
"ledger_height": {
"low": 11,
"high": 0,
"unsigned": true
},
"chaincodes": [
{
"name": "auditoria-cc",
"version": "1.0"
}
],
"name": "peer0.org1.autentia-bchain.com"
}
]
},
"G2": {
"peers": [
{
"mspid": "Org3MSP",
"endpoint": "peer0.org3.autentia-bchain.com:7051",
"ledger_height": {
"low": 11,
"high": 0,
"unsigned": true
},
"chaincodes": [
{
"name": "auditoria-cc",
"version": "1.0"
}
],
"name": "peer0.org1.autentia-bchain.com"
}
]
},
"G3": {
"peers": [
{
"mspid": "Org4MSP",
"endpoint": "peer0.org4.autentia-bchain.com:7051",
"ledger_height": {
"low": 11,
"high": 0,
"unsigned": true
},
"chaincodes": [
{
"name": "auditoria-cc",
"version": "1.0"
}
],
"name": "peer0.org1.autentia-bchain.com"
}
]
}
},
"layouts": [
{
"G1": 1,
"G2": 1,
"G0": 1
},
{
"G3": 1,
"G0": 1,
"G1": 1
},
{
"G2": 1,
"G3": 1,
"G0": 1
},
{
"G2": 1,
"G3": 1,
"G1": 1
}
],
"plan_id": "{\"chaincodes\":[{\"name\":\"auditoria-cc\"}]}",
"endorsements": {
}
}
Here is the log when it sends the proposals
[2019-05-13 12:39:39.894] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _endorse - starting layout plan 0
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _endorse_layout - start
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G2:0 - start
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G2:0 - send endorsement to peer0.org1.autentia-bchain.com
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G3:1 - start
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G3:1 - send endorsement to peer0.org1.autentia-bchain.com
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:2 - start
[2019-05-13 12:39:39.896] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:2 - send endorsement to peer0.org1.autentia-bchain.com
[2019-05-13 12:39:39.902] [WARN] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:2 - endorsement failed - Error: failed to execute transaction fe2fb28959f06b693e5b834ecfe5fab3aabe8e393f4cc1b2376db7b5aed9f096: error sending: txid: fe2fb28959f06b693e5b834ecfe5fab3aabe8e393f4cc1b2376db7b5aed9f096(auditoria-channel) exists
[2019-05-13 12:39:39.902] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:2 - not able to get a completed endorsement
[2019-05-13 12:39:39.902] [WARN] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G3:1 - endorsement failed - Error: failed to execute transaction fe2fb28959f06b693e5b834ecfe5fab3aabe8e393f4cc1b2376db7b5aed9f096: error sending: txid: fe2fb28959f06b693e5b834ecfe5fab3aabe8e393f4cc1b2376db7b5aed9f096(auditoria-channel) exists
[2019-05-13 12:39:39.902] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G3:1 - not able to get a completed endorsement
[2019-05-13 12:39:39.965] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G2:0 - endorsement completed to peer0.org1.autentia-bchain.com - 200
EDIT 1:
initialization log
[2019-05-13 17:31:18.543] [DEBUG] Helper - getClientForOrg - ****** END Org1 test1
[2019-05-13 17:31:18.544] [DEBUG] invoke-chaincode - Successfully got the fabric client for the organization "Org1"
[2019-05-13 17:31:18.544] [DEBUG] Helper - [NetworkConfig101.js]: getChannel - name auditoria-channel
[2019-05-13 17:31:18.544] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.546] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1
[2019-05-13 17:31:18.546] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.546] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org1.autentia-bchain.com
[2019-05-13 17:31:18.547] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1
[2019-05-13 17:31:18.547] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org1.autentia-bchain.com
[2019-05-13 17:31:18.547] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: _addPeersToChannel - peer0.org1.autentia-bchain.com - grpcs://localhost:7051
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org2.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1
[2019-05-13 17:31:18.548] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org1.autentia-bchain.com
[2019-05-13 17:31:18.548] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org2
[2019-05-13 17:31:18.548] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org2.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org2.autentia-bchain.com
[2019-05-13 17:31:18.549] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.549] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org2
[2019-05-13 17:31:18.549] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.549] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org2.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.549] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org2.autentia-bchain.com
[2019-05-13 17:31:18.549] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.549] [DEBUG] Helper - [NetworkConfig101.js]: _addPeersToChannel - peer0.org2.autentia-bchain.com - grpcs://localhost:8051
[2019-05-13 17:31:18.550] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org3.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.553] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1
[2019-05-13 17:31:18.553] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.554] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.554] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org1.autentia-bchain.com
[2019-05-13 17:31:18.554] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.555] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org2
[2019-05-13 17:31:18.555] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.555] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org2.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.555] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org2.autentia-bchain.com
[2019-05-13 17:31:18.555] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.555] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org3
[2019-05-13 17:31:18.555] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.555] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org3.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org3.autentia-bchain.com
[2019-05-13 17:31:18.556] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org3
[2019-05-13 17:31:18.556] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org3.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org3.autentia-bchain.com
[2019-05-13 17:31:18.556] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: _addPeersToChannel - peer0.org3.autentia-bchain.com - grpcs://localhost:9051
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org4.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.557] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1
[2019-05-13 17:31:18.557] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.557] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.557] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org1.autentia-bchain.com
[2019-05-13 17:31:18.558] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.558] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org2
[2019-05-13 17:31:18.559] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.559] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org2.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.559] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org2.autentia-bchain.com
[2019-05-13 17:31:18.559] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.559] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org3
[2019-05-13 17:31:18.559] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.559] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org3.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.559] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org3.autentia-bchain.com
[2019-05-13 17:31:18.559] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org4
[2019-05-13 17:31:18.560] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org4.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org4.autentia-bchain.com
[2019-05-13 17:31:18.560] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org4
[2019-05-13 17:31:18.560] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org4.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org4.autentia-bchain.com
[2019-05-13 17:31:18.560] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.561] [DEBUG] Helper - [NetworkConfig101.js]: _addPeersToChannel - peer0.org4.autentia-bchain.com - grpcs://localhost:10051
[2019-05-13 17:31:18.561] [DEBUG] Helper - [NetworkConfig101.js]: getOrderer - name orderer.autentia-bchain.com
[2019-05-13 17:31:18.563] [DEBUG] Helper - [DiscoveryEndorsementHandler]: initialize -
When i do channel.getChannelPeers() i get a list with the peers and the correct names are in it.
[ ChannelPeer {
_mspid: 'Org1MSP',
_channel:
Channel {
_name: 'auditoria-channel',
_channel_peers: [Object],
_anchor_peers: [],
_orderers: [Object],
_kafka_brokers: [],
_clientContext: [Object],
_msp_manager: [Object],
_discovery_interests: [Object],
_discovery_results: [Object],
_last_discover_timestamp: 1557779840912,
_use_discovery: true,
_as_localhost: true,
_endorsement_handler: [Object],
_commit_handler: [Object],
_last_refresh_request: [Object] },
_name: 'peer0.org1.autentia-bchain.com',
_peer:
Peer {
_options: [Object],
clientCert: undefined,
_url: 'grpcs://localhost:7051',
_endpoint: [Object],
_name: 'peer0.org1.autentia-bchain.com',
_request_timeout: 45000,
_grpc_wait_for_ready_timeout: 3000,
_endorserClient: [Object],
_discoveryClient: [Object] },
_roles:
{ endorsingPeer: true,
chaincodeQuery: true,
ledgerQuery: true,
eventSource: true } },
ChannelPeer {
_mspid: 'Org2MSP',
_channel:
Channel {
_name: 'auditoria-channel',
_channel_peers: [Object],
_anchor_peers: [],
_orderers: [Object],
_kafka_brokers: [],
_clientContext: [Object],
_msp_manager: [Object],
_discovery_interests: [Object],
_discovery_results: [Object],
_last_discover_timestamp: 1557779840912,
_use_discovery: true,
_as_localhost: true,
_endorsement_handler: [Object],
_commit_handler: [Object],
_last_refresh_request: [Object] },
_name: 'peer0.org2.autentia-bchain.com',
_peer:
Peer {
_options: [Object],
clientCert: undefined,
_url: 'grpcs://localhost:8051',
_endpoint: [Object],
_name: 'peer0.org2.autentia-bchain.com',
_request_timeout: 45000,
_grpc_wait_for_ready_timeout: 3000,
_endorserClient: [Object],
_discoveryClient: [Object] },
_roles:
{ endorsingPeer: true,
chaincodeQuery: true,
ledgerQuery: true,
eventSource: true } },
ChannelPeer {
_mspid: 'Org3MSP',
_channel:
Channel {
_name: 'auditoria-channel',
_channel_peers: [Object],
_anchor_peers: [],
_orderers: [Object],
_kafka_brokers: [],
_clientContext: [Object],
_msp_manager: [Object],
_discovery_interests: [Object],
_discovery_results: [Object],
_last_discover_timestamp: 1557779840912,
_use_discovery: true,
_as_localhost: true,
_endorsement_handler: [Object],
_commit_handler: [Object],
_last_refresh_request: [Object] },
_name: 'peer0.org3.autentia-bchain.com',
_peer:
Peer {
_options: [Object],
clientCert: undefined,
_url: 'grpcs://localhost:9051',
_endpoint: [Object],
_name: 'peer0.org3.autentia-bchain.com',
_request_timeout: 45000,
_grpc_wait_for_ready_timeout: 3000,
_endorserClient: [Object],
_discoveryClient: [Object] },
_roles:
{ endorsingPeer: true,
chaincodeQuery: true,
ledgerQuery: true,
eventSource: true } },
ChannelPeer {
_mspid: 'Org4MSP',
_channel:
Channel {
_name: 'auditoria-channel',
_channel_peers: [Object],
_anchor_peers: [],
_orderers: [Object],
_kafka_brokers: [],
_clientContext: [Object],
_msp_manager: [Object],
_discovery_interests: [Object],
_discovery_results: [Object],
_last_discover_timestamp: 1557779840912,
_use_discovery: true,
_as_localhost: true,
_endorsement_handler: [Object],
_commit_handler: [Object],
_last_refresh_request: [Object] },
_name: 'peer0.org4.autentia-bchain.com',
_peer:
Peer {
_options: [Object],
clientCert: undefined,
_url: 'grpcs://localhost:10051',
_endpoint: [Object],
_name: 'peer0.org4.autentia-bchain.com',
_request_timeout: 45000,
_grpc_wait_for_ready_timeout: 3000,
_endorserClient: [Object],
_discoveryClient: [Object] },
_roles:
When the NodeSDK application is running first level and is working with a fabric network in a local virtual environment where the peer addresses are seen as "localhost", the port addresses in the virtual environment must also be unique. In the docker-compose when mapping the virtual port to a real port it is easiest to use the same address. Notice in the following example that port address defined the virtual environment is the same as the host mapping.
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org2.example.com
- CORE_PEER_ADDRESS=peer0.org2.example.com:8051
- CORE_PEER_LISTENADDRESS=peer0.org2.example.com:8051
- CORE_PEER_GOSSIP_ENDPOINT=peer0.org2.example.com:8051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:8051
- CORE_PEER_LOCALMSPID=Org2MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/peerOrg2/msp
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:8051
ports:
- 8051:8051
Keep in mind that the host name must also be mapped from the virtual name to "localhost", this is done by using the connect option "aslocalhost:true" when the channel is initialized.
await channel.initialize({discover:true, asLocalhost:true})
Hope the following will help
https://fabric-sdk-node.github.io/release-1.4/tutorial-discovery.html
Could we see a debug log of when the channel was initialized. It would be helpful to see the Discovery results being read in from the Peer's Discovery Service. The Peer's name seen in the endorsement plan does not come from the Discovery Service, this is a name assigned by the NodeSDK and these should be unique and contain the host and port. Since they are not unique, the same Peer is indeed being used.
Related
how to configure hyperledger node sdk with kubernetes cluster?
i am able to configure hyperledger fabric and kubernetes with cli. But now i want to configure hyperledger fabric node sdk with kubernetes. I have created with files but, not able to connect it through node sdk rest endpoints. my hyperledger services: [ec2-user#ip-172-31-21-223 ~]$ kubectl get services --namespace=fabrick8s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE ca0-org1 NodePort 10.110.184.19 <none> 30101:30101/TCP,30102:30102/TCP 26h orderer0-orgorderer1 NodePort 10.99.12.255 <none> 32000:32000/TCP 46h peer0-org1 NodePort 10.101.50.225 <none> 30001:30001/TCP,30002:30002/TCP 3h5m i have added cluser ip into node network config file but i am not able to connect. getting following error: [2019-09-12 09:12:08.169] [INFO] SampleWebApp - ****************** SERVER STARTED ************************ [2019-09-12 09:12:08.175] [INFO] SampleWebApp - *************** http://localhost:4000 ****************** (node:2199) DeprecationWarning: grpc.load: Use the #grpc/proto-loader module with grpc.loadPackageDefinition instead [2019-09-12 09:12:16.427] [DEBUG] SampleWebApp - ------>>>>>> new request for /users [2019-09-12 09:12:16.428] [DEBUG] SampleWebApp - End point : /users [2019-09-12 09:12:16.428] [DEBUG] SampleWebApp - User name : test [2019-09-12 09:12:16.428] [DEBUG] SampleWebApp - Org name : Org1 [2019-09-12 09:12:16.432] [DEBUG] Helper - getClientForOrg - ****** START Org1 undefined [2019-09-12 09:12:16.439] [DEBUG] Helper - [NetworkConfig101.js]: constructor, network_config: {"name":"HlfV1","x-type":"hlfv1","description":"Hyperledger Node SDK","version":"1.0","channels":{"mychannel":{"orderers":["orderer0-orgorderer1"],"peers":{"peer0-org1":{"endorsingPeer":true,"chaincodeQuery":true,"ledgerQuery":true,"eventSource":true}},"chaincodes":["mycc:v0"]}},"organizations":{"Org1":{"mspid":"Org1MSP","peers":["peer0-org1"],"certificateAuthorities":["ca0-org1"],"adminPrivateKey":{"path":"/var/lib/nfs-share/crypto-config/peerOrganizations/org1/users/Admin#org1/msp/keystore/a6b8f684b67417335a33972cf115efe2222fdf07de1187cfab36c4873e7591af_sk"},"signedCert":{"path":"/var/lib/nfs-share/crypto-config/peerOrganizations/org1/users/Admin#org1/msp/signcerts/Admin#org1-cert.pem"}}},"orderers":{"orderer0-orgorderer1":{"url":"grpcs://localhost:32000","grpcOptions":{"ssl-target-name-override":"orderer0-orgorderer1"},"tlsCACerts":{"path":"/var/lib/nfs-share/crypto-config/ordererOrganizations/orgorderer1/orderers/orderer0.orgorderer1/tls/ca.crt"}}},"peers":{"peer0-org1":{"url":"grpcs://localhost:30001","grpcOptions":{"ssl-target-name-override":"peer0-org1"},"tlsCACerts":{"path":"/var/lib/nfs-share/crypto-config/peerOrganizations/org1/peers/peer0.org1/tls/ca.crt"}}},"certificateAuthorities":{"ca0-org1":{"url":"https://localhost:30101","httpOptions":{"verify":false},"tlsCACerts":{"path":"/var/lib/nfs-share/crypto-config/peerOrganizations/org1/ca/ca.org1-cert.pem"},"registrar":[{"enrollId":"admin","enrollSecret":"adminpw"}],"caName":"ca0-org1"}}} [2019-09-12 09:12:16.439] [DEBUG] Helper - [NetworkConfig101.js]: constructor, network_config: {"name":"HLF-Framework-Org1","x-type":"hlfv1","description":"HLF-Framework - client definition for Org1","version":"1.0","client":{"organization":"Org1","credentialStore":{"path":"./fabric-client-kv-Org1","cryptoStore":{"path":"/tmp/fabric-client-kv-Org1"},"wallet":"wallet-name"}}} [2019-09-12 09:12:16.440] [DEBUG] Helper - [NetworkConfig101.js]: mergeSettings - additions start [2019-09-12 09:12:16.440] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1 [2019-09-12 09:12:16.440] [DEBUG] Helper - [Organization.js]: Organization.const [2019-09-12 09:12:16.441] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca0-org1 [2019-09-12 09:12:16.444] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const [2019-09-12 09:12:16.626] [DEBUG] Helper - [crypto_ecdsa_aes]: Hash algorithm: SHA2, hash output size: 256 [2019-09-12 09:12:16.696] [DEBUG] Helper - [crypto_ecdsa_aes]: importKey - start [2019-09-12 09:12:16.698] [DEBUG] Helper - [crypto_ecdsa_aes]: importKey - have the key [Circular] [2019-09-12 09:12:16.699] [DEBUG] Helper - [crypto_ecdsa_aes]: importKey - start [2019-09-12 09:12:16.701] [DEBUG] Helper - [crypto_ecdsa_aes]: importKey - have the key [Circular] [2019-09-12 09:12:16.701] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1 [2019-09-12 09:12:16.702] [DEBUG] Helper - [Organization.js]: Organization.const [2019-09-12 09:12:16.702] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca0-org1 [2019-09-12 09:12:16.702] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const [2019-09-12 09:12:16.703] [DEBUG] Helper - [FileKeyValueStore.js]: constructor { options: { path: '/home/ec2-user/kube-node-sdk/fabric-client-kv-Org1', wallet: 'wallet-name', cryptoStore: { path: '/tmp/fabric-client-kv-Org1' } } } [2019-09-12 09:12:16.708] [DEBUG] Helper - [crypto_ecdsa_aes]: Hash algorithm: SHA2, hash output size: 256 [2019-09-12 09:12:16.709] [DEBUG] Helper - [utils.CryptoKeyStore]: CryptoKeyStore, constructor - start [2019-09-12 09:12:16.709] [DEBUG] Helper - [utils.CryptoKeyStore]: constructor, no super class specified, using config: fabric-client/lib/impl/FileKeyValueStore.js [2019-09-12 09:12:16.709] [DEBUG] Helper - getClientForOrg - ****** END Org1 undefined [2019-09-12 09:12:16.709] [DEBUG] Helper - Successfully initialized the credential stores [2019-09-12 09:12:16.710] [DEBUG] Helper - [FileKeyValueStore.js]: getValue { key: 'test' } [2019-09-12 09:12:16.716] [INFO] Helper - User test was not enrolled, so we will need an admin user object to register [2019-09-12 09:12:16.717] [DEBUG] Helper - [FileKeyValueStore.js]: getValue { key: 'admin' } [2019-09-12 09:12:16.717] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1 [2019-09-12 09:12:16.717] [DEBUG] Helper - [Organization.js]: Organization.const [2019-09-12 09:12:16.717] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca0-org1 [2019-09-12 09:12:16.718] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const [2019-09-12 09:12:16.718] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1 [2019-09-12 09:12:16.718] [DEBUG] Helper - [Organization.js]: Organization.const [2019-09-12 09:12:16.718] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca0-org1 [2019-09-12 09:12:16.718] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const [2019-09-12 09:12:16.732] [DEBUG] Helper - [FabricCAClient.js]: Successfully constructed Fabric CA client from options - {"caname":"ca0-org1","protocol":"https","hostname":"localhost","port":30101,"tlsOptions":{"trustedRoots":["-----BEGIN CERTIFICATE-----\nMIICIjCCAcigAwIBAgIRANPRopfisvYPfsGHY1tke+MwCgYIKoZIzj0EAwIwWzEL\nMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG\ncmFuY2lzY28xDTALBgNVBAoTBG9yZzExEDAOBgNVBAMTB2NhLm9yZzEwHhcNMTkw\nNzA5MjMzMDAwWhcNMjkwNzA2MjMzMDAwWjBbMQswCQYDVQQGEwJVUzETMBEGA1UE\nCBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzENMAsGA1UEChME\nb3JnMTEQMA4GA1UEAxMHY2Eub3JnMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA\nBMQsUoC5j79WG1YA0ZgfjnxYkv3TQlFUujWvSpcSG3911uxWBBG8tBxalcY6XubW\ndEk+QNReLYz5XWVclzmJZZujbTBrMA4GA1UdDwEB/wQEAwIBpjAdBgNVHSUEFjAU\nBggrBgEFBQcDAgYIKwYBBQUHAwEwDwYDVR0TAQH/BAUwAwEB/zApBgNVHQ4EIgQg\nxbTg5ty+qp3Jny2uw/eHWhfPT3w0LrE/MeG74D9Vd2YwCgYIKoZIzj0EAwIDSAAw\nRQIhANJxDvpI0R59X3DLoegKxwpFKKwnA3yhJZCtsoQ4TvPAAiBOKIf3AMpBrfFl\nx9DjYULlHqYcCMCG9jROisk8e0y2uA==\n-----END CERTIFICATE-----\n"],"verify":false}} [2019-09-12 09:12:16.732] [DEBUG] Helper - [FabricCAClientService.js]: Successfully constructed Fabric CA service client: endpoint - {"protocol":"https","hostname":"localhost","port":30101} [2019-09-12 09:12:16.785] [DEBUG] Helper - [utils.CryptoKeyStore]: This class requires a CryptoKeyStore to save keys, using the store: {"opts":{"path":"/tmp/fabric-client-kv-Org1"}} [2019-09-12 09:12:16.785] [DEBUG] Helper - [FileKeyValueStore.js]: constructor { options: { path: '/tmp/fabric-client-kv-Org1' } } [2019-09-12 09:12:16.786] [DEBUG] Helper - [utils.CryptoKeyStore]: _getKeyStore returning ks [2019-09-12 09:12:16.786] [DEBUG] Helper - [crypto_ecdsa_aes]: generateKey, store.setValue [2019-09-12 09:12:16.786] [DEBUG] Helper - [ecdsa/key.js]: ECDSA curve param X: c93658d3386293eed8cbbd07d9124d7e0bb354ceb1bbbba80099dc9a942b9ed3 [2019-09-12 09:12:16.787] [DEBUG] Helper - [ecdsa/key.js]: ECDSA curve param Y: 3444c31a9342c0bedae13aff1e5d43ed610ca641a597355e5af25c973708c4ef [2019-09-12 09:12:16.791] [DEBUG] Helper - [FileKeyValueStore.js]: setValue { key: '4ef322eb862cc68caf4341999813959a931baa492a0dcd227f73bf8afa803301-priv' } [2019-09-12 09:12:16.843] [ERROR] Helper - Failed to get registered user: test with error: Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:30101] [2019-09-12 09:12:16.843] [DEBUG] SampleWebApp - -- returned from registering the username test for organization Org1 [2019-09-12 09:12:16.843] [DEBUG] SampleWebApp - Failed to register the username test for organization Org1 with::failed Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:30101]
i have given the wrong targetPort.. for CA target port is 7054. solved my issue :) apiVersion: v1 kind: Service metadata: namespace: fabrick8s name: ca0-org1 spec: selector: name: ca0-org1 type: NodePort ports: - name: grpc protocol: TCP port: 30101 targetPort: 7054 nodePort: 30101
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.
Fabric SDK Go - Peer being excluded by filter when attempting to make a query
I am attemping the to execute the following statement after instantiation of my chaincode: response, err := client.Query(channel.Request{ ChaincodeID: heligo.fsConfig.ChainCodeID, Fcn: "invoke", Args: defaultQueryArgs}, channel.WithRetry(retry.DefaultChannelOpts), ) But I am getting the following debug log errors: [fabsdk/fab] 2019/03/06 13:09:55 UTC - fab.(*EndpointConfig).PeerConfig -> DEBU Found MatchingPeerConfig for name/url [peer1.org1.example.com:7051] [fabsdk/client] 2019/03/06 13:09:55 UTC - options.(*Params).SetPeerFilter -> DEBU PeerFilter: (options.PeerFilter)(0x8ffd50) [fabsdk/util] 2019/03/06 13:09:55 UTC - lazyref.(*Reference).setTimerRunning -> DEBU Timer started [fabsdk/util] 2019/03/06 13:09:55 UTC - lazyref.checkTimeStarted -> DEBU Starting timer [fabsdk/client] 2019/03/06 13:09:55 UTC - fabricselection.(*selectionFilter).Exclude -> DEBU Calling peer filter on endpoint [peer0.org2.example.com:7051] [fabsdk/client] 2019/03/06 13:09:55 UTC - fabricselection.(*selectionFilter).Exclude -> DEBU Excluding peer [peer0.org2.example.com:7051] since it isn't in the set of peers returned by the discovery service [fabsdk/common] 2019/03/06 13:09:55 UTC - retry.(*RetryableInvoker).Invoke -> DEBU Failed with err [Failed to get endorsing peers: error getting endorsers from channel response: no endorsement combination can be satisfied] on attempt #1. Checking if retry is warranted... [fabsdk/common] 2019/03/06 13:09:55 UTC - retry.(*RetryableInvoker).Invoke -> DEBU ... retry for err [Failed to get endorsing peers: error getting endorsers from channel response: no endorsement combination can be satisfied] is NOT warranted after %!d(MISSING) attempt(s). Failed to make client query: Failed to get endorsing peers: error getting endorsers from channel response: no endorsement combination can be satisfied I cannot figure out why my peer is being excluded, I am modifying the BYFN sample project and adding my own chaincode. My endorsement policy is: -P "AND ('Org1MSP.peer','Org2MSP.peer')" And my configuration file is: name: "byfn" version: 1.0.0 client: organization: org1 logging: level: debug cryptoconfig: path: ../../crypto-config/ credentialStore: path: "/tmp/state-store" cryptoStore: path: "/tmp/crypto-store" BCCSP: security: enabled: true default: provider: "SW" hashAlgorithm: "SHA2" softVerify: true level: 256 tlsCerts: client: keyfile: certfile: channels: heligo-channel: peers: peer0.org1.example.com: endorsingPeer: true chaincodeQuery: true ledgerQuery: true eventSource: true peer1.org1.example.com: endorsingPeer: true chaincodeQuery: true ledgerQuery: true eventSource: true peer0.org2.example.com: endorsingPeer: true chaincodeQuery: true ledgerQuery: true eventSource: true peer1.org2.example.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 organizations: org1: mspid: Org1MSP cryptoPath: ../../crypto-config/peerOrganizations/org1.example.com/users/{username}#org1.example.com/msp users: Admin: cert: path: ../../crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/signcerts/Admin#org1.example.com-cert.pem User1: cert: path: ../../crypto-config/peerOrganizations/org1.example.com/users/User1#org1.example.com/msp/signcerts/User1#org1.example.com-cert.pem peers: - peer0.org1.example.com - peer1.org1.example.com certificateAuthorities: - ca_peerOrg1 org2: mspid: Org2MSP cryptoPath: ../../crypto-config/peerOrganizations/org2.example.com/users/{username}#org2.example.com/msp users: Admin: cert: path: ../../crypto-config/peerOrganizations/org2.example.com/users/Admin#org2.example.com/msp/signcerts/Admin#org2.example.com-cert.pem User1: cert: path: ../../crypto-config/peerOrganizations/org2.example.com/users/User1#org2.example.com/msp/signcerts/User1#org2.example.com-cert.pem peers: - peer0.org2.example.com - peer1.org2.example.com certificateAuthorities: - ca_peerOrg2 orderers: orderer.example.com: url: localhost:7050 grpcOptions: ssl-target-name-override: orderer.example.com keep-alive-time: 0s keep-alive-timeout: 20s keep-alive-permit: false fail-fast: false allow-insecure: false tlsCACerts: path: ../../crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem peers: peer0.org1.example.com: url: localhost:7051 eventUrl: localhost:7053 grpcOptions: ssl-target-name-override: peer0.org1.example.com keep-alive-time: 0s keep-alive-timeout: 20s keep-alive-permit: false fail-fast: false allow-insecure: false tlsCACerts: path: ../../crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem peer1.org1.example.com: url: localhost:8051 eventUrl: localhost:8053 grpcOptions: ssl-target-name-override: peer1.org1.example.com keep-alive-time: 0s keep-alive-timeout: 20s keep-alive-permit: false fail-fast: false allow-insecure: false tlsCACerts: path: ../../crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem peer0.org2.example.com: url: localhost:9051 eventUrl: localhost:9053 grpcOptions: ssl-target-name-override: peer0.org2.example.com keep-alive-time: 0s keep-alive-timeout: 20s keep-alive-permit: false fail-fast: false allow-insecure: false tlsCACerts: path: ../../crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem peer1.org2.example.com: url: localhost:10051 eventUrl: localhost:10053 grpcOptions: ssl-target-name-override: peer1.org2.example.com keep-alive-time: 0s keep-alive-timeout: 20s keep-alive-permit: false fail-fast: false allow-insecure: false tlsCACerts: path: ../../crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem certificateAuthorities: ca_peerOrg1: url: http://localhost:7054 httpOptions: verify: false registrar: enrollId: admin enrollSecret: adminpw caName: ca_peerOrg1 tlsCACerts: path: ../../crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem ca_peerOrg2: url: http://localhost:7064 httpOptions: verify: false registrar: enrollId: admin enrollSecret: adminpw caName: ca_peerOrg2 tlsCACerts: path: ../../crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem entityMatchers: peer: - pattern: (\w*)peer0.org1.example.com(\w*) urlSubstitutionExp: localhost:7051 eventUrlSubstitutionExp: localhost:7053 sslTargetOverrideUrlSubstitutionExp: peer0.org1.example.com mappedHost: peer0.org1.example.com - pattern: (\w*)peer1.org1.example.com(\w*) urlSubstitutionExp: localhost:8051 eventUrlSubstitutionExp: localhost:8053 sslTargetOverrideUrlSubstitutionExp: peer1.org1.example.com mappedHost: peer1.org1.example.com - pattern: (\w*)peer0.org2.example.com(\w*) urlSubstitutionExp: localhost:9051 eventUrlSubstitutionExp: localhost:9053 sslTargetOverrideUrlSubstitutionExp: peer0.org2.example.com mappedHost: peer0.org2.example.com - pattern: (\w*)peer1.org2.example.com(\w*) urlSubstitutionExp: localhost:10051 eventUrlSubstitutionExp: localhost:10053 sslTargetOverrideUrlSubstitutionExp: peer1.org2.example.com mappedHost: peer1.org2.example.com orderer: - pattern: (\w*)orderer.example.com(\w*) urlSubstitutionExp: localhost:7050 sslTargetOverrideUrlSubstitutionExp: orderer.example.com mappedHost: orderer.example.com certificateAuthorities: - pattern: (\w*)ca_peerOrg1(\w*) urlSubstitutionExp: localhost:7054 mappedHost: ca_peerOrg1 - pattern: (\w*)ca_peerOrg2(\w*) urlSubstitutionExp: localhost:7064 mappedHost: ca_peerOrg2 I have really tried to get to grasp with the issue but am not5 getting anywhere due to the lack of depth in the documentation. Any help is greatly appreciated!!
The issue was that I had the wrong values for urlSubstitutionExp and eventUrlSubstitutionExp in the entity matcher section. Instead of localhost the values should have been the peer name.
Cannot access user attribute using Attribute Based Access Control (ABAC) in Hyperledger Fabric 1.1
I am trying out Attribute based access control using GoLang and facing an issue in getting the attribute in the chaincode. I'm using cid.GetAttributeValue() function and the function returns nothing. It prints blank and the found variable is set to false. The things I have done are: Registered a user defined attribute named "firstName" with value "*" to the admin. (Also tried setting it to a specific value) Enrolled that admin to the network Registered and enrolled the user with the same attribute "firstName" (with ecert flag set to true) Invoked a chaincode to get the attribute value using the enrolled user Snippets of relevant code have been attached below: Fabric-CA-Server Config File identities: - name: admin pass: adminpw type: client affiliation: "" attrs: hf.Registrar.Roles: "*" hf.Registrar.DelegateRoles: "*" hf.Revoker: true hf.IntermediateCA: true hf.GenCRL: true hf.Registrar.Attributes: "firstName" hf.AffiliationMgr: true firstName: "*" Code for registering and enrolling an user. user = { enrollmentID: username, affiliation: orgName + '.department1', maxEnrollments: 5, role: 'client', attrs: [{ name: 'firstName', value: 'Mathan_sir', ecert: true }] } console.log(user); var enrollmentSecret = await fabric_CA_Client.register(user, admin); console.log('client registered'); console.log('Successfully registered user - secret:' + enrollmentSecret); var enrollment = await fabric_CA_Client.enroll({ enrollmentID: username, enrollmentSecret: enrollmentSecret, attr_reqs: [ { name: "firstName", optional: false } // { name: "lastName", optional: false } ] }); Chaincode. value, found, err := cid.GetAttributeValue(stub, "firstName") if err != nil { return shim.Error("could not do abac") } fmt.Println("value is ", value) fmt.Println("found is ", found) Log in Fabric - CA : 2018/07/17 04:23:00 [INFO] Created default configuration file at /etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml 2018/07/17 04:23:00 [INFO] Starting server in home directory: /etc/hyperledger/fabric-ca-server 2018/07/17 04:23:00 [INFO] Server Version: 1.2.0-stable 2018/07/17 04:23:00 [INFO] Server Levels: &{Identity:1 Affiliation:1 Certificate:1 Credential:1 RAInfo:1 Nonce:1} 2018/07/17 04:23:00 [DEBUG] Default CA configuration, if necessary, will be used to replace missing values for additional CAs: {Version:1.2.0-stable Cfg:{Identities:{AllowRemove:false} Affiliations:{AllowRemove:false}} CA:{Name: Keyfile: Certfile:ca-cert.pem Chainfile:ca-chain.pem} Signing:0xc420555bc0 CSR:{CN:fabric-ca-server Names:[{C:US ST:North Carolina L: O:Hyperledger OU:Fabric SerialNumber:}] Hosts:[e3c7da43b062 localhost] KeyRequest:<nil> CA:0xc4200ffec0 SerialNumber:} Registry:{MaxEnrollments:-1 Identities:[{ Name:**** Pass:**** Type:client Affiliation: MaxEnrollments:0 Attrs:map[hf.GenCRL:1 hf.Registrar.Attributes:* hf.AffiliationMgr:1 hf.Registrar.Roles:* hf.Registrar.DelegateRoles:* hf.Revoker:1 hf.IntermediateCA:1] }]} Affiliations:map[org2:[department1] org1:[department1 department2]] LDAP:{ Enabled:false URL:ldap://****:****#<host>:<port>/<base> UserFilter:(uid=%s) GroupFilter:(memberUid=%s) Attribute:{[uid member] [{ }] map[groups:[{ }]]} TLS:{false [] { }} } DB:{ Type:sqlite3 Datasource:fabric-ca-server.db TLS:{false [] { }} } CSP:0xc4204e5080 Client:<nil> Intermediate:{ParentServer:{ URL: CAName: } TLS:{Enabled:false CertFiles:[] Client:{KeyFile: CertFile:}} Enrollment:{ Name: Secret:**** CAName: AttrReqs:[] Profile: Label: CSR:<nil> Type:x509 }} CRL:{Expiry:24h0m0s} Idemix:{IssuerPublicKeyfile: IssuerSecretKeyfile: RevocationPublicKeyfile: RevocationPrivateKeyfile: RHPoolSize:0 NonceExpiration: NonceSweepInterval:}} 2018/07/17 04:23:00 [DEBUG] Additional CAs to be started: [/etc/hyperledger/fabric-ca-server/ca/ca-config.yaml] 2018/07/17 04:23:00 [INFO] Loading CA from /etc/hyperledger/fabric-ca-server/ca/ca-config.yaml 2018/07/17 04:23:00 [DEBUG] CA configuration after checking for missing values: &{Version:1.1.0 Cfg:{Identities:{AllowRemove:false} Affiliations:{AllowRemove:false}} CA:{Name:ca-org1 Keyfile:/etc/hyperledger/fabric-ca-server-config/3099498edb13f731965246b01e74514e4b80e978a058cf4cb9b99ab1408e2569_sk Certfile:/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem Chainfile:ca-chain.pem} Signing:0xc4205a0e50 CSR:{CN:fabric-ca-server Names:[{C:US ST:North Carolina L: O:Hyperledger OU:Fabric SerialNumber:}] Hosts:[e3c7da43b062 localhost] KeyRequest:<nil> CA:0xc42059cea0 SerialNumber:} Registry:{MaxEnrollments:-1 Identities:[{ Name:**** Pass:**** Type:client Affiliation: MaxEnrollments:0 Attrs:map[hf.Registrar.Roles:* hf.Registrar.DelegateRoles:* hf.Revoker:1 hf.IntermediateCA:1 hf.GenCRL:1 hf.Registrar.Attributes:firstName hf.AffiliationMgr:1 firstName:*] }]} Affiliations:map[org2:[department1] org1:[department1 department2]] LDAP:{ Enabled:false URL:ldap://****:****#<host>:<port>/<base> UserFilter:(uid=%s) GroupFilter:(memberUid=%s) Attribute:{[uid member] [{ }] map[groups:[{ }]]} TLS:{false [] { }} } DB:{ Type:sqlite3 Datasource:fabric-ca-server.db TLS:{false [] { }} } CSP:0xc42059eba0 Client:<nil> Intermediate:{ParentServer:{ URL: CAName: } TLS:{Enabled:false CertFiles:[] Client:{KeyFile: CertFile:}} Enrollment:{ Name: Secret:**** CAName: AttrReqs:[] Profile: Label: CSR:<nil> Type:x509 }} CRL:{Expiry:24h0m0s} Idemix:{IssuerPublicKeyfile: IssuerSecretKeyfile: RevocationPublicKeyfile: RevocationPrivateKeyfile: RHPoolSize:1000 NonceExpiration:15s NonceSweepInterval:15m}} 2018/07/17 04:23:00 [DEBUG] Init CA with home /etc/hyperledger/fabric-ca-server/ca and config {Version:1.1.0 Cfg:{Identities:{AllowRemove:false} Affiliations:{AllowRemove:false}} CA:{Name:ca-org1 Keyfile:/etc/hyperledger/fabric-ca-server-config/3099498edb13f731965246b01e74514e4b80e978a058cf4cb9b99ab1408e2569_sk Certfile:/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem Chainfile:ca-chain.pem} Signing:0xc4205a0e50 CSR:{CN:fabric-ca-server Names:[{C:US ST:North Carolina L: O:Hyperledger OU:Fabric SerialNumber:}] Hosts:[e3c7da43b062 localhost] KeyRequest:<nil> CA:0xc42059cea0 SerialNumber:} Registry:{MaxEnrollments:-1 Identities:[{ Name:**** Pass:**** Type:client Affiliation: MaxEnrollments:0 Attrs:map[hf.AffiliationMgr:1 firstName:* hf.Registrar.Roles:* hf.Registrar.DelegateRoles:* hf.Revoker:1 hf.IntermediateCA:1 hf.GenCRL:1 hf.Registrar.Attributes:firstName] }]} Affiliations:map[org2:[department1] org1:[department1 department2]] LDAP:{ Enabled:false URL:ldap://****:****#<host>:<port>/<base> UserFilter:(uid=%s) GroupFilter:(memberUid=%s) Attribute:{[uid member] [{ }] map[groups:[{ }]]} TLS:{false [] { }} } DB:{ Type:sqlite3 Datasource:fabric-ca-server.db TLS:{false [] { }} } CSP:0xc42059eba0 Client:<nil> Intermediate:{ParentServer:{ URL: CAName: } TLS:{Enabled:false CertFiles:[] Client:{KeyFile: CertFile:}} Enrollment:{ Name: Secret:**** CAName: AttrReqs:[] Profile: Label: CSR:<nil> Type:x509 }} CRL:{Expiry:24h0m0s} Idemix:{IssuerPublicKeyfile: IssuerSecretKeyfile: RevocationPublicKeyfile: RevocationPrivateKeyfile: RHPoolSize:1000 NonceExpiration:15s NonceSweepInterval:15m}} 2018/07/17 04:23:00 [DEBUG] CA Home Directory: /etc/hyperledger/fabric-ca-server/ca 2018/07/17 04:23:00 [DEBUG] Checking configuration file version '1.1.0' against server version: '1.2.0-stable' 2018/07/17 04:23:00 [DEBUG] Initializing BCCSP: &{ProviderName:SW SwOpts:0xc42059ec00 PluginOpts:<nil> Pkcs11Opts:<nil>} 2018/07/17 04:23:00 [DEBUG] Initializing BCCSP with software options &{SecLevel:256 HashFamily:SHA2 Ephemeral:false FileKeystore:0xc4205a1890 DummyKeystore:<nil>} 2018/07/17 04:23:00 [DEBUG] Initialize key material 2018/07/17 04:23:00 [DEBUG] Making CA filenames absolute 2018/07/17 04:23:00 [INFO] The CA key and certificate files already exist 2018/07/17 04:23:00 [INFO] Key file location: /etc/hyperledger/fabric-ca-server-config/3099498edb13f731965246b01e74514e4b80e978a058cf4cb9b99ab1408e2569_sk 2018/07/17 04:23:00 [INFO] Certificate file location: /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem 2018/07/17 04:23:00 [DEBUG] Validating the CA certificate and key 2018/07/17 04:23:00 [DEBUG] Check CA certificate for valid dates 2018/07/17 04:23:00 [DEBUG] Check CA certificate for valid usages 2018/07/17 04:23:00 [DEBUG] Check CA certificate for valid IsCA value 2018/07/17 04:23:00 [DEBUG] Check that key type is supported 2018/07/17 04:23:00 [DEBUG] Check that key size is of appropriate length 2018/07/17 04:23:00 [DEBUG] Check that public key and private key match 2018/07/17 04:23:00 [DEBUG] Validation of CA certificate and key successful 2018/07/17 04:23:00 [DEBUG] Loading CN from existing enrollment information 2018/07/17 04:23:00 [DEBUG] Initializing DB 2018/07/17 04:23:00 [DEBUG] Initializing 'sqlite3' database at '/etc/hyperledger/fabric-ca-server/ca/fabric-ca-server.db' 2018/07/17 04:23:00 [DEBUG] Using sqlite database, connect to database in home (/etc/hyperledger/fabric-ca-server/ca/fabric-ca-server.db) directory 2018/07/17 04:23:00 [DEBUG] Creating SQLite database (/etc/hyperledger/fabric-ca-server/ca/fabric-ca-server.db) if it does not exist... 2018/07/17 04:23:00 [DEBUG] Creating users table if it does not exist 2018/07/17 04:23:00 [DEBUG] Creating affiliations table if it does not exist 2018/07/17 04:23:00 [DEBUG] Creating certificates table if it does not exist 2018/07/17 04:23:00 [DEBUG] Creating credentials table if it does not exist 2018/07/17 04:23:00 [DEBUG] Creating revocation_authority_info table if it does not exist 2018/07/17 04:23:00 [DEBUG] Creating nonces table if it does not exist 2018/07/17 04:23:01 [DEBUG] Creating properties table if it does not exist 2018/07/17 04:23:02 [DEBUG] Successfully opened sqlite3 DB 2018/07/17 04:23:02 [DEBUG] Checking database schema... 2018/07/17 04:23:02 [DEBUG] Update SQLite schema, if using outdated schema 2018/07/17 04:23:02 [DEBUG] Upgrade identities table 2018/07/17 04:23:02 [DEBUG] Creating users table if it does not exist 2018/07/17 04:23:03 [DEBUG] Upgrade affiliation table 2018/07/17 04:23:03 [DEBUG] Creating affiliations table if it does not exist 2018/07/17 04:23:04 [DEBUG] Upgrade certificates table 2018/07/17 04:23:04 [DEBUG] Creating certificates table if it does not exist 2018/07/17 04:23:05 [DEBUG] Initializing identity registry 2018/07/17 04:23:05 [DEBUG] Initialized DB identity registry 2018/07/17 04:23:05 [DEBUG] DB: Get properties [identity.level affiliation.level certificate.level] 2018/07/17 04:23:05 [DEBUG] Checking database levels 'map[affiliation.level:0 certificate.level:0 identity.level:0]' against server levels '&{Identity:1 Affiliation:1 Certificate:1 Credential:1 RAInfo:1 Nonce:1}' 2018/07/17 04:23:05 [DEBUG] Loading identity table 2018/07/17 04:23:05 [DEBUG] Loading identity 'admin' 2018/07/17 04:23:05 [DEBUG] DB: Getting identity admin 2018/07/17 04:23:05 [DEBUG] Max enrollment value verification - User specified max enrollment: 0, CA max enrollment: -1 2018/07/17 04:23:05 [DEBUG] DB: Add identity admin 2018/07/17 04:23:05 [DEBUG] Successfully added identity admin to the database 2018/07/17 04:23:05 [DEBUG] Registered identity: { Name:**** Pass:**** Type:client Affiliation: MaxEnrollments:-1 Attrs:map[hf.Revoker:1 hf.IntermediateCA:1 hf.GenCRL:1 hf.Registrar.Attributes:firstName hf.AffiliationMgr:1 firstName:* hf.Registrar.Roles:* hf.Registrar.DelegateRoles:*] } 2018/07/17 04:23:05 [DEBUG] Successfully loaded identity table 2018/07/17 04:23:05 [DEBUG] Loading affiliations table 2018/07/17 04:23:05 [DEBUG] DB: Add affiliation org2 2018/07/17 04:23:06 [DEBUG] Affiliation 'org2' added 2018/07/17 04:23:06 [DEBUG] DB: Add affiliation org2.department1 2018/07/17 04:23:07 [DEBUG] Affiliation 'org2.department1' added 2018/07/17 04:23:07 [DEBUG] DB: Add affiliation org1 2018/07/17 04:23:07 [DEBUG] Affiliation 'org1' added 2018/07/17 04:23:07 [DEBUG] DB: Add affiliation org1.department1 2018/07/17 04:23:08 [DEBUG] Affiliation 'org1.department1' added 2018/07/17 04:23:08 [DEBUG] DB: Add affiliation org1.department2 2018/07/17 04:23:08 [DEBUG] Affiliation 'org1.department2' added 2018/07/17 04:23:08 [DEBUG] Successfully loaded affiliations table 2018/07/17 04:23:08 [DEBUG] Checking and performing migration, if needed 2018/07/17 04:23:18 [DEBUG] Initializing enrollment signer 2018/07/17 04:23:18 [DEBUG] No key found in BCCSP keystore, attempting fallback 2018/07/17 04:23:18 [DEBUG] validating configuration 2018/07/17 04:23:18 [DEBUG] validate local profile 2018/07/17 04:23:18 [DEBUG] profile is valid 2018/07/17 04:23:18 [DEBUG] validate local profile 2018/07/17 04:23:18 [DEBUG] profile is valid 2018/07/17 04:23:18 [DEBUG] validate local profile 2018/07/17 04:23:18 [DEBUG] profile is valid 2018/07/17 04:23:18 [DEBUG] CA initialization successful 2018/07/17 04:23:18 [INFO] The issuer key was successfully stored. The public key is at: /etc/hyperledger/fabric-ca-server/IssuerPublicKey, secret key is at: /etc/hyperledger/fabric-ca-server/msp/keystore/IssuerSecretKey 2018/07/17 04:23:18 [INFO] The revocation key was successfully stored. The public key is at: /etc/hyperledger/fabric-ca-server/IssuerRevocationPublicKey, private key is at: /etc/hyperledger/fabric-ca-server/msp/keystore/IssuerRevocationPrivateKey 2018/07/17 04:23:18 [DEBUG] Comparing DNs from certificates: /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem and /etc/hyperledger/fabric-ca-server/ca-cert.pem 2018/07/17 04:23:18 [DEBUG] Loading DNs from certificate /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem 2018/07/17 04:23:18 [DEBUG] Loading DNs from certificate /etc/hyperledger/fabric-ca-server/ca-cert.pem 2018/07/17 04:23:18 [DEBUG] Check to see if two DNs are equal - &{issuer:CN=ca.org1.example.com,O=org1.example.com,L=San Francisco,ST=California,C=US subject:CN=ca.org1.example.com,O=org1.example.com,L=San Francisco,ST=California,C=US} and &{issuer:CN=example.com,OU=WWW,O=Internet Widgets\, Inc.,L=San Francisco,ST=California,C=US subject:CN=example.com,OU=WWW,O=Internet Widgets\, Inc.,L=San Francisco,ST=California,C=US} 2018/07/17 04:23:18 [INFO] Home directory for default CA: /etc/hyperledger/fabric-ca-server 2018/07/17 04:23:18 [DEBUG] 2 CA instance(s) running on server 2018/07/17 04:23:18 [INFO] Listening on http://0.0.0.0:7054 2018/07/17 04:38:12 [DEBUG] Cleaning up expired nonces for CA 'ca-org1' 2018/07/17 04:38:18 [DEBUG] Cleaning up expired nonces for CA '' 2018/07/17 04:46:57 [DEBUG] Received request for /api/v1/enroll 2018/07/17 04:46:57 [DEBUG] ca.Config: &{Version:1.1.0 Cfg:{Identities:{AllowRemove:false} Affiliations:{AllowRemove:false}} CA:{Name:ca-org1 Keyfile:/etc/hyperledger/fabric-ca-server-config/3099498edb13f731965246b01e74514e4b80e978a058cf4cb9b99ab1408e2569_sk Certfile:/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem Chainfile:/etc/hyperledger/fabric-ca-server/ca/ca-chain.pem} Signing:0xc4205a0e50 CSR:{CN:ca.org1.example.com Names:[{C:US ST:North Carolina L: O:Hyperledger OU:Fabric SerialNumber:}] Hosts:[e3c7da43b062 localhost] KeyRequest:<nil> CA:0xc42059cea0 SerialNumber:} Registry:{MaxEnrollments:-1 Identities:[{ Name:**** Pass:**** Type:client Affiliation: MaxEnrollments:0 Attrs:map[hf.Registrar.DelegateRoles:* hf.Revoker:1 hf.IntermediateCA:1 hf.GenCRL:1 hf.Registrar.Attributes:firstName hf.AffiliationMgr:1 firstName:* hf.Registrar.Roles:*] }]} Affiliations:map[org2:[department1] org1:[department1 department2]] LDAP:{ Enabled:false URL:ldap://****:****#<host>:<port>/<base> UserFilter:(uid=%s) GroupFilter:(memberUid=%s) Attribute:{[uid member] [{ }] map[groups:[{ }]]} TLS:{false [] { }} } DB:{ Type:sqlite3 Datasource:/etc/hyperledger/fabric-ca-server/ca/fabric-ca-server.db TLS:{false [] { }} } CSP:0xc42059eba0 Client:<nil> Intermediate:{ParentServer:{ URL: CAName: } TLS:{Enabled:false CertFiles:[] Client:{KeyFile: CertFile:}} Enrollment:{ Name: Secret:**** CAName: AttrReqs:[] Profile: Label: CSR:<nil> Type:x509 }} CRL:{Expiry:24h0m0s} Idemix:{IssuerPublicKeyfile:/etc/hyperledger/fabric-ca-server/ca/IssuerPublicKey IssuerSecretKeyfile:/etc/hyperledger/fabric-ca-server/ca/msp/keystore/IssuerSecretKey RevocationPublicKeyfile:/etc/hyperledger/fabric-ca-server/ca/IssuerRevocationPublicKey RevocationPrivateKeyfile:/etc/hyperledger/fabric-ca-server/ca/msp/keystore/IssuerRevocationPrivateKey RHPoolSize:1000 NonceExpiration:15s NonceSweepInterval:15m}} 2018/07/17 04:46:57 [DEBUG] DB: Getting identity admin 2018/07/17 04:46:57 [DEBUG] DB: Login user admin with max enrollments of -1 and state of 0 2018/07/17 04:46:57 [DEBUG] DB: identity admin successfully logged in 2018/07/17 04:46:57 [DEBUG] DB: Getting identity admin 2018/07/17 04:46:57 [DEBUG] Processing sign request: id=admin, CommonName=admin, Subject=<nil> 2018/07/17 04:46:57 [DEBUG] Request is not for a CA signing certificate 2018/07/17 04:46:57 [DEBUG] Checking CSR fields to make sure that they do not exceed maximum character limits 2018/07/17 04:46:57 [DEBUG] Finished processing sign request 2018/07/17 04:46:57 [DEBUG] DB: Getting identity admin 2018-07-17T04:46:57.558556370Z 2018/07/17 04:46:57 [DEBUG] Attribute extension being added to certificate is: &{ID:[1 2 3 4 5 6 7 8 1] Critical:false Value:7b226174747273223a7b2266697273744e616d65223a222a222c2268662e5265676973747261722e41747472696275746573223a2266697273744e616d65227d7d} 2018/07/17 04:46:57 [DEBUG] Adding attribute extension to CSR: &{ID:[1 2 3 4 5 6 7 8 1] Critical:false Value:7b226174747273223a7b2266697273744e616d65223a222a222c2268662e5265676973747261722e41747472696275746573223a2266697273744e616d65227d7d} 2018/07/17 04:46:57 [INFO] signed certificate with serial number 624665886532998504441151201588115183399742601456 2018/07/17 04:46:57 [DEBUG] DB: Insert Certificate 2018/07/17 04:46:57 [DEBUG] Saved serial number as hex 6d6afcb3ed661e7f059b8a0b51829330fdfdf8f0 2018/07/17 04:46:57 [DEBUG] saved certificate with serial number 624665886532998504441151201588115183399742601456 2018/07/17 04:46:57 [DEBUG] Successfully incremented state for identity admin to 1 2018/07/17 04:46:57 [INFO] 172.18.0.1:47506 POST /api/v1/enroll 201 0 "OK" 2018/07/17 04:47:02 [DEBUG] Received request for /api/v1/register 2018/07/17 04:47:02 [DEBUG] Checking for revocation/expiration of certificate owned by 'admin' 2018/07/17 04:47:02 [DEBUG] DB: Get certificate by serial (6d6afcb3ed661e7f059b8a0b51829330fdfdf8f0) and aki (3099498edb13f731965246b01e74514e4b80e978a058cf4cb9b99ab1408e2569) 2018/07/17 04:47:02 [DEBUG] DB: Getting identity admin 2018/07/17 04:47:02 [DEBUG] Successful token authentication of 'admin' 2018/07/17 04:47:02 [DEBUG] Received registration request from admin: { Name:vijay Type:client Secret:**** MaxEnrollments:5 Affiliation:org1.department1 Attributes:[{firstName Lohith true}] CAName:ca-org1 } 2018/07/17 04:47:02 [DEBUG] canRegister - Check to see if user 'admin' can register 2018/07/17 04:47:02 [DEBUG] Checking to see if caller 'admin' can act on type 'client' 2018/07/17 04:47:02 [DEBUG] Checking to see if caller 'admin' is a registrar 2018/07/17 04:47:02 [DEBUG] Validating affiliation: org1.department1 2018/07/17 04:47:02 [DEBUG] Checking to see if affiliation 'org1.department1' contains caller's affiliation '' 2018/07/17 04:47:02 [DEBUG] Caller has root affiliation 2018/07/17 04:47:02 [DEBUG] DB: Get affiliation org1.department1 2018/07/17 04:47:02 [DEBUG] Checking to see if registrar can register the requested attributes: [{Name:firstName Value:Lohith ECert:true}] 2018/07/17 04:47:02 [DEBUG] Validating that registrar with the following values for hf.Registrar.Attributes 'firstName' is authorized to register the requested attribute '&{Name:firstName Value:Lohith ECert:true}' 2018/07/17 04:47:02 [DEBUG] Checking if registrar can register attribute: firstName 2018/07/17 04:47:02 [DEBUG] Performing authorization check... 2018/07/17 04:47:02 [DEBUG] Registering user id: vijay 2018/07/17 04:47:02 [DEBUG] Max enrollment value verification - User specified max enrollment: 5, CA max enrollment: -1 2018/07/17 04:47:02 [DEBUG] DB: Getting identity vijay 2018/07/17 04:47:02 [DEBUG] DB: Add identity vijay 2018/07/17 04:47:02 [DEBUG] Successfully added identity vijay to the database 2018/07/17 04:47:02 [INFO] 172.18.0.1:47512 POST /api/v1/register 201 0 "OK" 2018/07/17 04:47:02 [DEBUG] Received request for /api/v1/enroll 2018/07/17 04:47:02 [DEBUG] ca.Config: &{Version:1.1.0 Cfg:{Identities:{AllowRemove:false} Affiliations:{AllowRemove:false}} CA:{Name:ca-org1 Keyfile:/etc/hyperledger/fabric-ca-server-config/3099498edb13f731965246b01e74514e4b80e978a058cf4cb9b99ab1408e2569_sk Certfile:/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem Chainfile:/etc/hyperledger/fabric-ca-server/ca/ca-chain.pem} Signing:0xc4205a0e50 CSR:{CN:ca.org1.example.com Names:[{C:US ST:North Carolina L: O:Hyperledger OU:Fabric SerialNumber:}] Hosts:[e3c7da43b062 localhost] KeyRequest:<nil> CA:0xc42059cea0 SerialNumber:} Registry:{MaxEnrollments:-1 Identities:[{ Name:**** Pass:**** Type:client Affiliation: MaxEnrollments:0 Attrs:map[hf.GenCRL:1 hf.Registrar.Attributes:firstName hf.AffiliationMgr:1 firstName:* hf.Registrar.Roles:* hf.Registrar.DelegateRoles:* hf.Revoker:1 hf.IntermediateCA:1] }]} Affiliations:map[org2:[department1] org1:[department1 department2]] LDAP:{ Enabled:false URL:ldap://****:****#<host>:<port>/<base> UserFilter:(uid=%s) GroupFilter:(memberUid=%s) Attribute:{[uid member] [{ }] map[groups:[{ }]]} TLS:{false [] { }} } DB:{ Type:sqlite3 Datasource:/etc/hyperledger/fabric-ca-server/ca/fabric-ca-server.db TLS:{false [] { }} } CSP:0xc42059eba0 Client:<nil> Intermediate:{ParentServer:{ URL: CAName: } TLS:{Enabled:false CertFiles:[] Client:{KeyFile: CertFile:}} Enrollment:{ Name: Secret:**** CAName: AttrReqs:[] Profile: Label: CSR:<nil> Type:x509 }} CRL:{Expiry:24h0m0s} Idemix:{IssuerPublicKeyfile:/etc/hyperledger/fabric-ca-server/ca/IssuerPublicKey IssuerSecretKeyfile:/etc/hyperledger/fabric-ca-server/ca/msp/keystore/IssuerSecretKey RevocationPublicKeyfile:/etc/hyperledger/fabric-ca-server/ca/IssuerRevocationPublicKey RevocationPrivateKeyfile:/etc/hyperledger/fabric-ca-server/ca/msp/keystore/IssuerRevocationPrivateKey RHPoolSize:1000 NonceExpiration:15s NonceSweepInterval:15m}} 2018/07/17 04:47:02 [DEBUG] DB: Getting identity vijay 2018/07/17 04:47:02 [DEBUG] DB: Login user vijay with max enrollments of 5 and state of 0 2018/07/17 04:47:02 [DEBUG] DB: identity vijay successfully logged in 2018/07/17 04:47:02 [DEBUG] DB: Getting identity vijay 2018/07/17 04:47:02 [DEBUG] Processing sign request: id=vijay, CommonName=vijay, Subject=<nil> 2018/07/17 04:47:02 [DEBUG] Request is not for a CA signing certificate 2018/07/17 04:47:02 [DEBUG] Checking CSR fields to make sure that they do not exceed maximum character limits 2018/07/17 04:47:02 [DEBUG] Finished processing sign request 2018/07/17 04:47:02 [DEBUG] DB: Getting identity vijay 2018/07/17 04:47:02 [DEBUG] Attribute extension being added to certificate is: &{ID:[1 2 3 4 5 6 7 8 1] Critical:false Value:7b226174747273223a7b2266697273744e616d65223a224c6f68697468227d7d} 2018/07/17 04:47:02 [DEBUG] Adding attribute extension to CSR: &{ID:[1 2 3 4 5 6 7 8 1] Critical:false Value:7b226174747273223a7b2266697273744e616d65223a224c6f68697468227d7d} 2018/07/17 04:47:02 [INFO] signed certificate with serial number 124540954052671924407683868974981960232864106719 2018/07/17 04:47:02 [DEBUG] DB: Insert Certificate 2018/07/17 04:47:02 [DEBUG] Saved serial number as hex 15d09c09d65b92d0f28dc7287fdd01d52764c8df 2018/07/17 04:47:02 [DEBUG] saved certificate with serial number 124540954052671924407683868974981960232864106719 2018/07/17 04:47:02 [DEBUG] Successfully incremented state for identity vijay to 1 2018/07/17 04:47:02 [INFO] 172.18.0.1:47516 POST /api/v1/enroll 201 0 "OK"
I suggest trying the following: Adding more conditional statements in order to evaluate what is going wrong with your application, such as something like: func (t* SimpleChaincode) get_attribute(stub shim.ChaincodeStubInterface, args []string) pb.Response { var attribute_name string if len(args) != 1 { return shim.Error("Incorrect number of arguments. Expecting only attribute name") } attribute_name = args[0] val, ok, err := cid.GetAttributeValue(stub, attribute_name) if err != nil { return shim.Error("Error retriving attribute " + attribute_name + ", error: " + err.Error()) } if !ok { return shim.Error("User does not have attribute " + attribute_name) } return shim.Success([]byte(val)) } Reviewing an example of how to query chaincode: var Fabric_Client = require('fabric-client'); var path = require('path'); var util = require('util'); var os = require('os'); // var fabric_client = new Fabric_Client(); var attribute = '' var user = '' if ((process.argv).length > 3) { user = process.argv[2] attribute = process.argv[3] } else { console.log("Usage: node " + process.argv[1] + " username attribute") process.exit(1) } // setup the fabric network var channel = fabric_client.newChannel('mychannel'); var peer = fabric_client.newPeer('grpc://peer0.org1.example.com:7051'); channel.addPeer(peer); // var member_user = null; var store_path = path.join(__dirname, 'hfc-key-store'); console.log('Store path:'+store_path); var tx_id = null; // create the key value store as defined in the fabric-client/config/default.json 'key-value-store' setting Fabric_Client.newDefaultKeyValueStore({ path: store_path }).then((state_store) => { // assign the store to the fabric client fabric_client.setStateStore(state_store); var crypto_suite = Fabric_Client.newCryptoSuite(); // use the same location for the state store (where the users' certificate are kept) // and the crypto store (where the users' keys are kept) var crypto_store = Fabric_Client.newCryptoKeyStore({path: store_path}); crypto_suite.setCryptoKeyStore(crypto_store); fabric_client.setCryptoSuite(crypto_suite); // get the enrolled user from persistence, this user will sign all requests return fabric_client.getUserContext(user, true); }).then((user_from_store) => { if (user_from_store && user_from_store.isEnrolled()) { console.log('Successfully loaded ' + user + ' from persistence'); member_user = user_from_store; } else { throw new Error('Failed to get ' + user + ' run registerUser.js'); } // queryCar chaincode function - requires 1 argument, ex: args: ['CAR4'], // queryAllCars chaincode function - requires no arguments , ex: args: [''], const request = { //targets : --- letting this default to the peers assigned to the channel chaincodeId: 'acl', fcn: 'get_attribute', args: [attribute] }; // send the query proposal to the peer return channel.queryByChaincode(request); }).then((query_responses) => { console.log("Query has completed, checking results"); // query_responses could have more than one results if there multiple peers were used as targets if (query_responses && query_responses.length == 1) { if (query_responses[0] instanceof Error) { console.error("error from query = ", query_responses[0]); } else { console.log("Response is ", query_responses[0].toString()); } } else { console.log("No payloads were returned from query"); } }).catch((err) => { console.error('Failed to query successfully :: ' + err); }); Source URL for code: https://gist.github.com/tboloo/e06e2a86f99fc8e7fca295daf4d3f34c Implementing ABAC It wasn't clear to me how you are enforcing the decision making for your ABAC with Hyperledger Fabric. My understanding is that Hyperledger Fabric doesn't come with a built in architecture to handle this (PDP, etc.). I suggest using an implementation of XACML to externally handle dynamic authorization.
If you are using var tx_id = client.newTransactionID(true); try setting it to var tx_id = client.newTransactionID();
Error trying to invoke chaincode using Node.js SDK
I am trying to implement Node.js SDK for my Hyperledger Fabric business network. My network has one organisation, four peers, one channel, solo ordered and one CA. I have successful managed to issue the JWT identity for user Jim and org1 organization. When I try to invoke the the chaincode using: curl -s -X POST \ http://localhost:4000/channels/c1/chaincodes/txman \ -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MTAwODIyNzMsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE1MTAwNDYyNzN9.NTDYky6jj_y1COP163Z_HA6q4v7S1_jN6BxL00Bo-Xo" \ -H "content-type: application/json" \ -d '{ "fcn":"queryTx", "args":["TX0"] }' I am getting the following error: 2017-11-07 11:18:34.286] [DEBUG] SampleWebApp - Decoded from JWT token: username - Jim, orgname - org1 [2017-11-07 11:18:34.287] [DEBUG] SampleWebApp - ==================== INVOKE ON CHAINCODE ================== [2017-11-07 11:18:34.287] [DEBUG] SampleWebApp - USERNAME: Jim [2017-11-07 11:18:34.287] [DEBUG] SampleWebApp - ORGNAME: org1 [2017-11-07 11:18:34.287] [DEBUG] SampleWebApp - channelName : c1 [2017-11-07 11:18:34.288] [DEBUG] SampleWebApp - chaincodeName : txman [2017-11-07 11:18:34.288] [DEBUG] SampleWebApp - fcn : queryTx [2017-11-07 11:18:34.288] [DEBUG] SampleWebApp - args : TX0 [2017-11-07 11:18:34.292] [DEBUG] invoke-chaincode - ============ invoke transaction on organization org1 ============ [2017-11-07 11:18:34.292] [DEBUG] Helper - [FileKeyValueStore.js]: FileKeyValueStore.js - constructor [2017-11-07 11:18:34.293] [DEBUG] Helper - [FileKeyValueStore.js]: FileKeyValueStore -- getValue [2017-11-07 11:18:34.298] [DEBUG] Helper - [crypto_ecdsa_aes]: importKey - start [2017-11-07 11:18:34.298] [DEBUG] Helper - [crypto_ecdsa_aes]: importKey - have the key [Circular] [2017-11-07 11:18:34.300] [DEBUG] Helper - [utils.CryptoKeyStore]: _getKeyStore resolving store [2017-11-07 11:18:34.300] [DEBUG] Helper - [ecdsa/key.js]: ECDSA curve param X: c3cd1a318e957b0200852e4ed6c9601eadc8225eb9f79acc11b1c65df142446a [2017-11-07 11:18:34.300] [DEBUG] Helper - [ecdsa/key.js]: ECDSA curve param Y: f7bbe9fd43eaae1a0a1d2eb3024ecd79bd63c39a8d1b3b978bc8b4a652d0ef63 [2017-11-07 11:18:34.301] [DEBUG] Helper - [FileKeyValueStore.js]: FileKeyValueStore -- setValue [2017-11-07 11:18:34.303] [DEBUG] Helper - [utils.CryptoKeyStore]: _getKeyStore resolving store [2017-11-07 11:18:34.303] [DEBUG] Helper - [FileKeyValueStore.js]: FileKeyValueStore -- getValue [2017-11-07 11:18:34.304] [DEBUG] Helper - [ecdsa/key.js]: ECDSA curve param X: c3cd1a318e957b0200852e4ed6c9601eadc8225eb9f79acc11b1c65df142446a [2017-11-07 11:18:34.304] [DEBUG] Helper - [ecdsa/key.js]: ECDSA curve param Y: f7bbe9fd43eaae1a0a1d2eb3024ecd79bd63c39a8d1b3b978bc8b4a652d0ef63 [2017-11-07 11:18:34.305] [DEBUG] Helper - [ecdsa/key.js]: ECDSA curve param X: c3cd1a318e957b0200852e4ed6c9601eadc8225eb9f79acc11b1c65df142446a [2017-11-07 11:18:34.306] [DEBUG] Helper - [ecdsa/key.js]: ECDSA curve param Y: f7bbe9fd43eaae1a0a1d2eb3024ecd79bd63c39a8d1b3b978bc8b4a652d0ef63 [2017-11-07 11:18:34.308] [DEBUG] Helper - [ecdsa/key.js]: ECDSA curve param X: c3cd1a318e957b0200852e4ed6c9601eadc8225eb9f79acc11b1c65df142446a [2017-11-07 11:18:34.308] [DEBUG] Helper - [ecdsa/key.js]: ECDSA curve param Y: f7bbe9fd43eaae1a0a1d2eb3024ecd79bd63c39a8d1b3b978bc8b4a652d0ef63 [2017-11-07 11:18:34.309] [DEBUG] Helper - [FileKeyValueStore.js]: FileKeyValueStore -- setValue [2017-11-07 11:18:34.309] [INFO] Helper - Successfully loaded member from persistence [2017-11-07 11:18:34.313] [DEBUG] invoke-chaincode - Sending transaction "{"_nonce":{"type":"Buffer","data":[218,130,209,154,87,123,73,36,118,155,194,91,27,250,14,216,117,202,164,5,16,237,96,208]},"_transaction_id":"dba107be47745c51eb75b6a927d68f0afd58b325c5e36326b40a729f9d858f43"}" [2017-11-07 11:18:34.341] [DEBUG] Helper - [crypto_ecdsa_aes]: ecdsa signature: Signature { r: <BN: cf5e0aaef0fd10d9abf468e025c6f6c1e8991d0dcddf5f5aa6b285ebdcd920ad>, s: <BN: 8de356dcfda3ba3fb0d6decfc0e43995b3297bc7037fd3997bfba561e6d626d>, recoveryParam: 0 } error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com") at /home/brankoterzic/Desktop/devGC/txman/node_modules/grpc/src/client.js:554:15 error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com") at /home/brankoterzic/Desktop/devGC/txman/node_modules/grpc/src/client.js:554:15 error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com") at /home/brankoterzic/Desktop/devGC/txman/node_modules/grpc/src/client.js:554:15 error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com") at /home/brankoterzic/Desktop/devGC/txman/node_modules/grpc/src/client.js:554:15 error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com") at /home/brankoterzic/Desktop/devGC/txman/node_modules/grpc/src/client.js:554:15 [2017-11-07 11:18:34.400] [ERROR] invoke-chaincode - transaction proposal was bad [2017-11-07 11:18:34.401] [ERROR] invoke-chaincode - transaction proposal was bad [2017-11-07 11:18:34.401] [ERROR] invoke-chaincode - transaction proposal was bad [2017-11-07 11:18:34.401] [ERROR] invoke-chaincode - transaction proposal was bad [2017-11-07 11:18:34.401] [ERROR] invoke-chaincode - transaction proposal was bad [2017-11-07 11:18:34.401] [ERROR] invoke-chaincode - Failed to send Proposal or receive valid response. Response null or status is not 200. exiting... [2017-11-07 11:18:34.401] [ERROR] invoke-chaincode - Failed to order the transaction. Error code: undefined I was following the balance-transfer Node.js example: https://github.com/hyperledger/fabric-samples/tree/release/balance-transfer Thank you for your answers!
I have solved this by setting up the generated crypto for CA crypto-config/peerOrganizations/org1.example.com/ca/361a9254173cb1a97c057432094a20db9578ca69a152725f96323e00379c5ad6_sk to FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/361a9254173cb1a97c057432094a20db9578ca69a152725f96323e00379c5ad6_sk in docker-compose-base.yaml env variable.