Dockerfile:
FROM node:carbon
WORKDIR /usr/src/app
COPY package*.json ./
COPY *.card ./
RUN npm install
RUN ./node_modules/.bin/composer card import --file admin@samplenetwork.card --card admin@samplenetwork
COPY . .
EXPOSE 8080
CMD [ "npm", "start" ]
connection.js used to create admin@samplenetwork.card (I replaced "://localhost:port" with the running container names)
{
"name":"hlfv1",
"x-type":"hlfv1",
"x-commitTimeout":300,
"version":"1.0.0",
"client":{
"organization":"Org1",
"connection":{
"timeout":{
"peer":{
"endorser":"300",
"eventHub":"300",
"eventReg":"300"
},
"orderer":"300"
}
}
},
"channels":{
"composerchannel":{
"orderers":[
"orderer.example.com"
],
"peers":{
"peer0.org1.example.com":{
}
}
}
},
"organizations":{
"Org1":{
"mspid":"Org1MSP",
"peers":[
"peer0.org1.example.com"
],
"certificateAuthorities":[
"ca.org1.example.com"
]
}
},
"orderers":{
"orderer.example.com":{
"url":"grpc://orderer.example.com:7050"
}
},
"peers":{
"peer0.org1.example.com":{
"url":"grpc://peer0.org1.example.com:7051",
"eventUrl":"grpc://peer0.org1.example.com:7053"
}
},
"certificateAuthorities":{
"ca.org1.example.com":{
"url":"http://ca.org1.example.com:7054",
"caName":"ca.org1.example.com"
}
}
}
Node.js app cannot connect:
(node:17) UnhandledPromiseRejectionWarning: Error: Error trying to ping. Error: 2 UNKNOWN: error executing chaincode: transaction returned with failure: Error: The current identity, with the name 'admin' and the identifier 'fcb2071b5df74a16b4b93b14bff69af15c1104df6465a23ae4ec3473cc663d71', has not been registered
Can someone tell me how to do this?