Reputation: 97
My company have a blockchain network used fabric image version 1.4.0 which deployed on Portainer And I have installed and instantiated my chaincode (javascript) on that blockchain network.
I have created an application (typescript) to interract with this chaincode. But it seem that only evaluationTransaction (query) is call successfully. I have tried to perform a submitTransaction (invoke) but it always return an error:
2021-03-11T09:48:43.964Z - warn: [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G2:0 - endorsement failed - Error: 14 UNAVAILABLE: failed to connect to all addresses
2021-03-11T09:48:43.967Z - error: [DiscoveryEndorsementHandler]: _endorse - endorsement failed::Error: Endorsement has failed
When I check log in dev-peer0.xxx.xxx.xx container, it show that the query (evaluationTransaction) commands always reach this peer, but invoke (submitTransaction) not have any logs.
Here is the dev-peer0.xxx.xxx.xx log:
Here is my network-config.json:
"name": "connection",
"version": "1.0.0",
"client": {
"organization": "MyOrg",
"connection": {
"timeout": {
"peer": {
"endorser": "300"
},
"orderer": "300"
}
}
},
"channels": {
"channelorg": {
"orderers": [
"orderer0.myorg.com",
"orderer1.myorg.com"
],
"peers": {
"peer0.myorg.com": {},
"peer1.myorg.com": {}
}
}
},
"organizations": {
"MyOrg": {
"mspid": "MyOrg",
"peers": [
"peer0.myorg.com",
"peer1.myorg.com"
],
"certificateAuthorities": [
"ca.myorg.com"
]
}
},
"orderers": {
"orderer0.myorg.com": {
"url": "grpcs://10.10.10.1:7050",
"grpcOptions": {
"ssl-target-name-override": "orderer0.myorg.com",
"hostnameOverride": "orderer0.myorg.com"
},
"tlsCACerts": {
"path": "src/blockchain-network/crypto-config/ordererOrganizations/myorg.com/orderers/orderer0.myorg.com/tls/ca.crt"
}
},
"orderer1.myorg.com": {
"url": "grpcs://10.10.10.2:7050",
"grpcOptions": {
"ssl-target-name-override": "orderer1.myorg.com",
"hostnameOverride": "orderer1.myorg.com"
},
"tlsCACerts": {
"path": "src/blockchain-network/crypto-config/ordererOrganizations/myorg.com/orderers/orderer1.myorg.com/tls/ca.crt"
}
}
},
"peers": {
"peer0.myorg.com": {
"url": "grpcs://10.10.10.3:7051",
"grpcOptions": {
"ssl-target-name-override": "peer0.myorg.com",
"hostnameOverride": "peer0.myorg.com"
},
"tlsCACerts": {
"path": "src/blockchain-network/crypto-config/peerOrganizations/myorg.com/peers/peer0.myorg.com/tls/ca.crt"
}
},
"peer1.myorg.com": {
"url": "grpcs://10.10.10.4:7051",
"grpcOptions": {
"ssl-target-name-override": "peer1.myorg.com",
"hostnameOverride": "peer1.myorg.com"
},
"tlsCACerts": {
"path": "src/blockchain-network/crypto-config/peerOrganizations/myorg.com/peers/peer1.myorg.com/tls/ca.crt"
}
}
},
"certificateAuthorities": {
"ca.myorg.com": {
"url": "https://10.10.10.5:7054",
"caName": "ca.myorg.com",
"httpOptions": {
"verify": false
},
"tlsCACerts": {
"path": "src/blockchain-network/crypto-config/peerOrganizations/myorg.com/ca/ca.myorg.com-cert.pem"
}
}
}
}
Please advise me to fix it. Thanks so much.
Updated:
When I make a submitTransaction, it will occur an error below.
So I have changed "discovery: {enabled} option" from true to false in gateway.connect() arguments and the submitTransaction has been sent successfully.
Thanks very much.
Upvotes: 0
Views: 541
Reputation: 610
The issue is that the private key of the organization is missing here in the connection profile. I have attached the connection-profile. Please copy the admin keys from the blockchain-network crypto-config directory into your connection profile. In the organization description,the adminPrivateKey and signedCert is missing in your connection configuration.
name: "Network"
version: "1.0"
channels:
mychannel:
orderers:
- orderer.example.com
peers:
peer0.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
peer0.org2.example.com:
endorsingPeer: true
chaincodeQuery: false
ledgerQuery: true
eventSource: false
organizations:
Org1:
mspid: Org1MSP
peers:
- peer0.org1.example.com
certificateAuthorities:
- ca-org1
adminPrivateKey:
path: test/fixtures/channel/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/keystore/9022d671ceedbb24af3ea69b5a8136cc64203df6b9920e26f48123fcfcb1d2e9_sk
signedCert:
path: test/fixtures/channel/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/signcerts/[email protected]
Org2:
mspid: Org2MSP
peers:
- peer0.org2.example.com
certificateAuthorities:
- ca-org2
adminPrivateKey:
path: test/fixtures/channel/crypto-config/peerOrganizations/org2.example.com/users/[email protected]/keystore/5a983ddcbefe52a7f9b8ee5b85a590c3e3a43c4ccd70c7795bec504e7f74848d_sk
signedCert:
path: test/fixtures/channel/crypto-config/peerOrganizations/org2.example.com/users/[email protected]/signcerts/[email protected]
orderers:
orderer.example.com:
url: grpcs://localhost:7050
grpcOptions:
ssl-target-name-override: orderer.example.com
grpc-max-send-message-length: 4194304
tlsCACerts:
path: test/fixtures/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tlscacerts/example.com-cert.pem
peers:
peer0.org1.example.com:
url: grpcs://localhost:7051
grpcOptions:
ssl-target-name-override: peer0.org1.example.com
grpc.keepalive_time_ms: 600000
tlsCACerts:
path: test/fixtures/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tlscacerts/org1.example.com-cert.pem
peer0.org2.example.com:
url: grpcs://localhost:8051
grpcOptions:
ssl-target-name-override: peer0.org2.example.com
tlsCACerts:
path: test/fixtures/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tlscacerts/org2.example.com-cert.pem
certificateAuthorities:
ca-org1:
url: https://localhost:7054
httpOptions:
verify: false
tlsCACerts:
path: test/fixtures/channel/crypto-config/peerOrganizations/org1.example.com/ca/org1.example.com-cert.pem
registrar:
- enrollId: admin
enrollSecret: adminpw
caName: caorg1
ca-org2:
url: https://localhost:8054
httpOptions:
verify: false
tlsCACerts:
path: test/fixtures/channel/crypto-config/peerOrganizations/org2.example.com/ca/org2.example.com-cert.pem
registrar:
- enrollId: admin
enrollSecret: adminpw
caName: caorg2
Upvotes: 1