Deploy and expose chaincode as REST api on amazon managed blockchain hyperledger fabric 1.2
I have configured amazon managed blockchain setup with Hyperledger 1.2. The network is prepared with a single member and a single peer node.
Hyperledger Fabric Client setup is with Golang 1.10.3. I have installed, Instantiated, Queried and Invoked mycc chaincode example given in AWS tutorial. Which works perfectly. Complete exercise was done following this link.
I want to deploy and expose the chaincode as REST api.
There is a sample project Amazon Managed Blockchain Workshop.
They have used RESTful API, running as a Node.js Express application, using the Hyperledger Fabric Client SDK to query and invoke chaincode.
I want to run non-profit chaincode example on Hyperledger Fabric Client prepared for AWS managed Blockchain Hyper Ledger 1.2
I have performed below steps:
Part 2: Deploy the non-profit chaincode)
Part 3: RESTful API to expose the Chaincode
Here are the steps how am I am running and testing the REST API.
cd ~/non-profit-blockchain/ngo-rest-api
nvm use lts/carbon
node app.js &
If I execute Register/enroll a user request
curl -s -X POST http://localhost:3000/users -H "content-type: application/x-www-form-urlencoded" -d 'username=john&orgName=Org1'
Instead of showing: response:
{"success":true,"secret":"","message":"michael enrolled Successfully"}
It shows below error message.
{"success":false,"message":"failed Error: Missing mspid parameter"}
I have also tried by adding mspid in the request but the error message is still same. What am I missing?
Here are contents of ngo-connection-profile.yaml
channels:
mychannel:
orderers:
- orderer.com
peers:
peer1:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
<pre><code>
organizations:
Org1:
mspid:
peers:
- peer1
certificateAuthorities:
- ca-org1
orderers:
orderer.com:
url: grpcs://orderer.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.managedblockchain.us-east-1.amazonaws.com:30001
grpcOptions:
ssl-target-name-override: orderer.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.managedblockchain.us-east-1.amazonaws.com
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
</pre></code>
peers:
peer1:
url: grpcs://nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS....
eventUrl: grpcs://nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.....
grpcOptions:
ssl-target-name-override: nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.xxx
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
certificateAuthorities:
ca-org1:
url: https://ca.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS....
httpOptions:
verify: false
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
registrar:
- enrollId: aaaaaaaa
enrollSecret: XXXXXXXXXXX
caName: m-AAAAAAAAAAAAAAAAAAAAAAAAA
node.js amazon-web-services go hyperledger-fabric blockchain
add a comment |
I have configured amazon managed blockchain setup with Hyperledger 1.2. The network is prepared with a single member and a single peer node.
Hyperledger Fabric Client setup is with Golang 1.10.3. I have installed, Instantiated, Queried and Invoked mycc chaincode example given in AWS tutorial. Which works perfectly. Complete exercise was done following this link.
I want to deploy and expose the chaincode as REST api.
There is a sample project Amazon Managed Blockchain Workshop.
They have used RESTful API, running as a Node.js Express application, using the Hyperledger Fabric Client SDK to query and invoke chaincode.
I want to run non-profit chaincode example on Hyperledger Fabric Client prepared for AWS managed Blockchain Hyper Ledger 1.2
I have performed below steps:
Part 2: Deploy the non-profit chaincode)
Part 3: RESTful API to expose the Chaincode
Here are the steps how am I am running and testing the REST API.
cd ~/non-profit-blockchain/ngo-rest-api
nvm use lts/carbon
node app.js &
If I execute Register/enroll a user request
curl -s -X POST http://localhost:3000/users -H "content-type: application/x-www-form-urlencoded" -d 'username=john&orgName=Org1'
Instead of showing: response:
{"success":true,"secret":"","message":"michael enrolled Successfully"}
It shows below error message.
{"success":false,"message":"failed Error: Missing mspid parameter"}
I have also tried by adding mspid in the request but the error message is still same. What am I missing?
Here are contents of ngo-connection-profile.yaml
channels:
mychannel:
orderers:
- orderer.com
peers:
peer1:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
<pre><code>
organizations:
Org1:
mspid:
peers:
- peer1
certificateAuthorities:
- ca-org1
orderers:
orderer.com:
url: grpcs://orderer.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.managedblockchain.us-east-1.amazonaws.com:30001
grpcOptions:
ssl-target-name-override: orderer.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.managedblockchain.us-east-1.amazonaws.com
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
</pre></code>
peers:
peer1:
url: grpcs://nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS....
eventUrl: grpcs://nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.....
grpcOptions:
ssl-target-name-override: nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.xxx
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
certificateAuthorities:
ca-org1:
url: https://ca.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS....
httpOptions:
verify: false
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
registrar:
- enrollId: aaaaaaaa
enrollSecret: XXXXXXXXXXX
caName: m-AAAAAAAAAAAAAAAAAAAAAAAAA
node.js amazon-web-services go hyperledger-fabric blockchain
add a comment |
I have configured amazon managed blockchain setup with Hyperledger 1.2. The network is prepared with a single member and a single peer node.
Hyperledger Fabric Client setup is with Golang 1.10.3. I have installed, Instantiated, Queried and Invoked mycc chaincode example given in AWS tutorial. Which works perfectly. Complete exercise was done following this link.
I want to deploy and expose the chaincode as REST api.
There is a sample project Amazon Managed Blockchain Workshop.
They have used RESTful API, running as a Node.js Express application, using the Hyperledger Fabric Client SDK to query and invoke chaincode.
I want to run non-profit chaincode example on Hyperledger Fabric Client prepared for AWS managed Blockchain Hyper Ledger 1.2
I have performed below steps:
Part 2: Deploy the non-profit chaincode)
Part 3: RESTful API to expose the Chaincode
Here are the steps how am I am running and testing the REST API.
cd ~/non-profit-blockchain/ngo-rest-api
nvm use lts/carbon
node app.js &
If I execute Register/enroll a user request
curl -s -X POST http://localhost:3000/users -H "content-type: application/x-www-form-urlencoded" -d 'username=john&orgName=Org1'
Instead of showing: response:
{"success":true,"secret":"","message":"michael enrolled Successfully"}
It shows below error message.
{"success":false,"message":"failed Error: Missing mspid parameter"}
I have also tried by adding mspid in the request but the error message is still same. What am I missing?
Here are contents of ngo-connection-profile.yaml
channels:
mychannel:
orderers:
- orderer.com
peers:
peer1:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
<pre><code>
organizations:
Org1:
mspid:
peers:
- peer1
certificateAuthorities:
- ca-org1
orderers:
orderer.com:
url: grpcs://orderer.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.managedblockchain.us-east-1.amazonaws.com:30001
grpcOptions:
ssl-target-name-override: orderer.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.managedblockchain.us-east-1.amazonaws.com
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
</pre></code>
peers:
peer1:
url: grpcs://nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS....
eventUrl: grpcs://nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.....
grpcOptions:
ssl-target-name-override: nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.xxx
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
certificateAuthorities:
ca-org1:
url: https://ca.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS....
httpOptions:
verify: false
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
registrar:
- enrollId: aaaaaaaa
enrollSecret: XXXXXXXXXXX
caName: m-AAAAAAAAAAAAAAAAAAAAAAAAA
node.js amazon-web-services go hyperledger-fabric blockchain
I have configured amazon managed blockchain setup with Hyperledger 1.2. The network is prepared with a single member and a single peer node.
Hyperledger Fabric Client setup is with Golang 1.10.3. I have installed, Instantiated, Queried and Invoked mycc chaincode example given in AWS tutorial. Which works perfectly. Complete exercise was done following this link.
I want to deploy and expose the chaincode as REST api.
There is a sample project Amazon Managed Blockchain Workshop.
They have used RESTful API, running as a Node.js Express application, using the Hyperledger Fabric Client SDK to query and invoke chaincode.
I want to run non-profit chaincode example on Hyperledger Fabric Client prepared for AWS managed Blockchain Hyper Ledger 1.2
I have performed below steps:
Part 2: Deploy the non-profit chaincode)
Part 3: RESTful API to expose the Chaincode
Here are the steps how am I am running and testing the REST API.
cd ~/non-profit-blockchain/ngo-rest-api
nvm use lts/carbon
node app.js &
If I execute Register/enroll a user request
curl -s -X POST http://localhost:3000/users -H "content-type: application/x-www-form-urlencoded" -d 'username=john&orgName=Org1'
Instead of showing: response:
{"success":true,"secret":"","message":"michael enrolled Successfully"}
It shows below error message.
{"success":false,"message":"failed Error: Missing mspid parameter"}
I have also tried by adding mspid in the request but the error message is still same. What am I missing?
Here are contents of ngo-connection-profile.yaml
channels:
mychannel:
orderers:
- orderer.com
peers:
peer1:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
<pre><code>
organizations:
Org1:
mspid:
peers:
- peer1
certificateAuthorities:
- ca-org1
orderers:
orderer.com:
url: grpcs://orderer.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.managedblockchain.us-east-1.amazonaws.com:30001
grpcOptions:
ssl-target-name-override: orderer.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.managedblockchain.us-east-1.amazonaws.com
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
</pre></code>
peers:
peer1:
url: grpcs://nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS....
eventUrl: grpcs://nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.....
grpcOptions:
ssl-target-name-override: nd-NDNDNDNDNDNDNDNDNDNDND.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS.xxx
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
certificateAuthorities:
ca-org1:
url: https://ca.m-AAAAAAAAAAAAAAAAAAAAAAAAA.n-XDXDXDXDXDSXDSXDXSDXSDXDSXDSXDS....
httpOptions:
verify: false
tlsCACerts:
path: /opt/home/managedblockchain-tls-chain.pem
registrar:
- enrollId: aaaaaaaa
enrollSecret: XXXXXXXXXXX
caName: m-AAAAAAAAAAAAAAAAAAAAAAAAA
node.js amazon-web-services go hyperledger-fabric blockchain
node.js amazon-web-services go hyperledger-fabric blockchain
edited Jan 20 at 7:58
James Z
11.2k71935
11.2k71935
asked Jan 20 at 7:13
Moolshanker KothariMoolshanker Kothari
141110
141110
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I am also exploring Amazon Managed Blockchain although its in preview. Hopefully I will be able to assist you in your issue. mspid is not a parameter to be sent in the request. It looks that you are missing some-thing in the configuration file. Can you send me the contents of below configuration file?
cat ~/non-profit-blockchain/tmp/connection-profile/ngo-connection-profile.yaml
While looking at the contents of the configuration file, it is obvious that mspid value is missing in the configuration file. Membership Service Providers (MSP) ID is a mandatory value to be set in the configuration. You can also confirm it with below command.
cat ~/non-profit-blockchain/tmp/connection-profile/ngo-connection-profile.yaml | grep mspid:
If it is showing empty value then you need to set mspid in the configuration file.
Make sure that the environment variables mentioned in
~/non-profit-blockchain/ngo-fabric/fabric-exports.sh
are properly set. If this file is missing then use ~/non-profit-blockchain/ngo-fabric/templates/exports-template.sh
You need to set the value of environment variable ${MEMBERID} in mspid in ngo-connection-profile.yaml, also see if any other required field value is missing in the configuration file. You can also see the detail of values required t be replacs in the configuration file from below script.
~/non-profit-blockchain/ngo-rest-api/connection-profile/gen-connection-profile.sh
.Let me list down those as well.
sed -i "s|%PEERNODEID%|$PEERNODEID|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%MEMBERID%|$MEMBERID|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%CAFILE%|$LOCALCA|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ORDERINGSERVICEENDPOINT%|$ORDERINGSERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ORDERINGSERVICEENDPOINTNOPORT%|$ORDERINGSERVICEENDPOINTNOPORT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEERSERVICEENDPOINT%|$PEERSERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEERSERVICEENDPOINTNOPORT%|$PEERSERVICEENDPOINTNOPORT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEEREVENTENDPOINT%|$PEEREVENTENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%CASERVICEENDPOINT%|$CASERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ADMINUSER%|$ADMINUSER|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ADMINPWD%|$ADMINPWD|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
After setting the values and verifying, stop node or kill the process running on port 3000 and run node again.
cd ~/non-profit-blockchain/ngo-rest-api
nvm use lts/carbon
node app.js &
I have added the contents of ngo-connection-profile.yaml in the main question.
– Moolshanker Kothari
Jan 20 at 7:49
Yes you were right, mspid was missing and after setting this value restarting node, now I am able to send both api requests. (Register/enroll a user), (POST a Donor) and (Get all donors). Thanks Bajwa
– Moolshanker Kothari
Jan 20 at 8:23
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54274351%2fdeploy-and-expose-chaincode-as-rest-api-on-amazon-managed-blockchain-hyperledger%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I am also exploring Amazon Managed Blockchain although its in preview. Hopefully I will be able to assist you in your issue. mspid is not a parameter to be sent in the request. It looks that you are missing some-thing in the configuration file. Can you send me the contents of below configuration file?
cat ~/non-profit-blockchain/tmp/connection-profile/ngo-connection-profile.yaml
While looking at the contents of the configuration file, it is obvious that mspid value is missing in the configuration file. Membership Service Providers (MSP) ID is a mandatory value to be set in the configuration. You can also confirm it with below command.
cat ~/non-profit-blockchain/tmp/connection-profile/ngo-connection-profile.yaml | grep mspid:
If it is showing empty value then you need to set mspid in the configuration file.
Make sure that the environment variables mentioned in
~/non-profit-blockchain/ngo-fabric/fabric-exports.sh
are properly set. If this file is missing then use ~/non-profit-blockchain/ngo-fabric/templates/exports-template.sh
You need to set the value of environment variable ${MEMBERID} in mspid in ngo-connection-profile.yaml, also see if any other required field value is missing in the configuration file. You can also see the detail of values required t be replacs in the configuration file from below script.
~/non-profit-blockchain/ngo-rest-api/connection-profile/gen-connection-profile.sh
.Let me list down those as well.
sed -i "s|%PEERNODEID%|$PEERNODEID|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%MEMBERID%|$MEMBERID|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%CAFILE%|$LOCALCA|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ORDERINGSERVICEENDPOINT%|$ORDERINGSERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ORDERINGSERVICEENDPOINTNOPORT%|$ORDERINGSERVICEENDPOINTNOPORT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEERSERVICEENDPOINT%|$PEERSERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEERSERVICEENDPOINTNOPORT%|$PEERSERVICEENDPOINTNOPORT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEEREVENTENDPOINT%|$PEEREVENTENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%CASERVICEENDPOINT%|$CASERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ADMINUSER%|$ADMINUSER|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ADMINPWD%|$ADMINPWD|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
After setting the values and verifying, stop node or kill the process running on port 3000 and run node again.
cd ~/non-profit-blockchain/ngo-rest-api
nvm use lts/carbon
node app.js &
I have added the contents of ngo-connection-profile.yaml in the main question.
– Moolshanker Kothari
Jan 20 at 7:49
Yes you were right, mspid was missing and after setting this value restarting node, now I am able to send both api requests. (Register/enroll a user), (POST a Donor) and (Get all donors). Thanks Bajwa
– Moolshanker Kothari
Jan 20 at 8:23
add a comment |
I am also exploring Amazon Managed Blockchain although its in preview. Hopefully I will be able to assist you in your issue. mspid is not a parameter to be sent in the request. It looks that you are missing some-thing in the configuration file. Can you send me the contents of below configuration file?
cat ~/non-profit-blockchain/tmp/connection-profile/ngo-connection-profile.yaml
While looking at the contents of the configuration file, it is obvious that mspid value is missing in the configuration file. Membership Service Providers (MSP) ID is a mandatory value to be set in the configuration. You can also confirm it with below command.
cat ~/non-profit-blockchain/tmp/connection-profile/ngo-connection-profile.yaml | grep mspid:
If it is showing empty value then you need to set mspid in the configuration file.
Make sure that the environment variables mentioned in
~/non-profit-blockchain/ngo-fabric/fabric-exports.sh
are properly set. If this file is missing then use ~/non-profit-blockchain/ngo-fabric/templates/exports-template.sh
You need to set the value of environment variable ${MEMBERID} in mspid in ngo-connection-profile.yaml, also see if any other required field value is missing in the configuration file. You can also see the detail of values required t be replacs in the configuration file from below script.
~/non-profit-blockchain/ngo-rest-api/connection-profile/gen-connection-profile.sh
.Let me list down those as well.
sed -i "s|%PEERNODEID%|$PEERNODEID|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%MEMBERID%|$MEMBERID|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%CAFILE%|$LOCALCA|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ORDERINGSERVICEENDPOINT%|$ORDERINGSERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ORDERINGSERVICEENDPOINTNOPORT%|$ORDERINGSERVICEENDPOINTNOPORT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEERSERVICEENDPOINT%|$PEERSERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEERSERVICEENDPOINTNOPORT%|$PEERSERVICEENDPOINTNOPORT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEEREVENTENDPOINT%|$PEEREVENTENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%CASERVICEENDPOINT%|$CASERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ADMINUSER%|$ADMINUSER|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ADMINPWD%|$ADMINPWD|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
After setting the values and verifying, stop node or kill the process running on port 3000 and run node again.
cd ~/non-profit-blockchain/ngo-rest-api
nvm use lts/carbon
node app.js &
I have added the contents of ngo-connection-profile.yaml in the main question.
– Moolshanker Kothari
Jan 20 at 7:49
Yes you were right, mspid was missing and after setting this value restarting node, now I am able to send both api requests. (Register/enroll a user), (POST a Donor) and (Get all donors). Thanks Bajwa
– Moolshanker Kothari
Jan 20 at 8:23
add a comment |
I am also exploring Amazon Managed Blockchain although its in preview. Hopefully I will be able to assist you in your issue. mspid is not a parameter to be sent in the request. It looks that you are missing some-thing in the configuration file. Can you send me the contents of below configuration file?
cat ~/non-profit-blockchain/tmp/connection-profile/ngo-connection-profile.yaml
While looking at the contents of the configuration file, it is obvious that mspid value is missing in the configuration file. Membership Service Providers (MSP) ID is a mandatory value to be set in the configuration. You can also confirm it with below command.
cat ~/non-profit-blockchain/tmp/connection-profile/ngo-connection-profile.yaml | grep mspid:
If it is showing empty value then you need to set mspid in the configuration file.
Make sure that the environment variables mentioned in
~/non-profit-blockchain/ngo-fabric/fabric-exports.sh
are properly set. If this file is missing then use ~/non-profit-blockchain/ngo-fabric/templates/exports-template.sh
You need to set the value of environment variable ${MEMBERID} in mspid in ngo-connection-profile.yaml, also see if any other required field value is missing in the configuration file. You can also see the detail of values required t be replacs in the configuration file from below script.
~/non-profit-blockchain/ngo-rest-api/connection-profile/gen-connection-profile.sh
.Let me list down those as well.
sed -i "s|%PEERNODEID%|$PEERNODEID|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%MEMBERID%|$MEMBERID|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%CAFILE%|$LOCALCA|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ORDERINGSERVICEENDPOINT%|$ORDERINGSERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ORDERINGSERVICEENDPOINTNOPORT%|$ORDERINGSERVICEENDPOINTNOPORT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEERSERVICEENDPOINT%|$PEERSERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEERSERVICEENDPOINTNOPORT%|$PEERSERVICEENDPOINTNOPORT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEEREVENTENDPOINT%|$PEEREVENTENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%CASERVICEENDPOINT%|$CASERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ADMINUSER%|$ADMINUSER|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ADMINPWD%|$ADMINPWD|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
After setting the values and verifying, stop node or kill the process running on port 3000 and run node again.
cd ~/non-profit-blockchain/ngo-rest-api
nvm use lts/carbon
node app.js &
I am also exploring Amazon Managed Blockchain although its in preview. Hopefully I will be able to assist you in your issue. mspid is not a parameter to be sent in the request. It looks that you are missing some-thing in the configuration file. Can you send me the contents of below configuration file?
cat ~/non-profit-blockchain/tmp/connection-profile/ngo-connection-profile.yaml
While looking at the contents of the configuration file, it is obvious that mspid value is missing in the configuration file. Membership Service Providers (MSP) ID is a mandatory value to be set in the configuration. You can also confirm it with below command.
cat ~/non-profit-blockchain/tmp/connection-profile/ngo-connection-profile.yaml | grep mspid:
If it is showing empty value then you need to set mspid in the configuration file.
Make sure that the environment variables mentioned in
~/non-profit-blockchain/ngo-fabric/fabric-exports.sh
are properly set. If this file is missing then use ~/non-profit-blockchain/ngo-fabric/templates/exports-template.sh
You need to set the value of environment variable ${MEMBERID} in mspid in ngo-connection-profile.yaml, also see if any other required field value is missing in the configuration file. You can also see the detail of values required t be replacs in the configuration file from below script.
~/non-profit-blockchain/ngo-rest-api/connection-profile/gen-connection-profile.sh
.Let me list down those as well.
sed -i "s|%PEERNODEID%|$PEERNODEID|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%MEMBERID%|$MEMBERID|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%CAFILE%|$LOCALCA|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ORDERINGSERVICEENDPOINT%|$ORDERINGSERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ORDERINGSERVICEENDPOINTNOPORT%|$ORDERINGSERVICEENDPOINTNOPORT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEERSERVICEENDPOINT%|$PEERSERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEERSERVICEENDPOINTNOPORT%|$PEERSERVICEENDPOINTNOPORT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%PEEREVENTENDPOINT%|$PEEREVENTENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%CASERVICEENDPOINT%|$CASERVICEENDPOINT|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ADMINUSER%|$ADMINUSER|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
sed -i "s|%ADMINPWD%|$ADMINPWD|g" $REPODIR/tmp/connection-profile/ngo-connection-profile.yaml
After setting the values and verifying, stop node or kill the process running on port 3000 and run node again.
cd ~/non-profit-blockchain/ngo-rest-api
nvm use lts/carbon
node app.js &
edited Jan 20 at 8:17
answered Jan 20 at 7:25
I BajwaI Bajwa
1,51911535
1,51911535
I have added the contents of ngo-connection-profile.yaml in the main question.
– Moolshanker Kothari
Jan 20 at 7:49
Yes you were right, mspid was missing and after setting this value restarting node, now I am able to send both api requests. (Register/enroll a user), (POST a Donor) and (Get all donors). Thanks Bajwa
– Moolshanker Kothari
Jan 20 at 8:23
add a comment |
I have added the contents of ngo-connection-profile.yaml in the main question.
– Moolshanker Kothari
Jan 20 at 7:49
Yes you were right, mspid was missing and after setting this value restarting node, now I am able to send both api requests. (Register/enroll a user), (POST a Donor) and (Get all donors). Thanks Bajwa
– Moolshanker Kothari
Jan 20 at 8:23
I have added the contents of ngo-connection-profile.yaml in the main question.
– Moolshanker Kothari
Jan 20 at 7:49
I have added the contents of ngo-connection-profile.yaml in the main question.
– Moolshanker Kothari
Jan 20 at 7:49
Yes you were right, mspid was missing and after setting this value restarting node, now I am able to send both api requests. (Register/enroll a user), (POST a Donor) and (Get all donors). Thanks Bajwa
– Moolshanker Kothari
Jan 20 at 8:23
Yes you were right, mspid was missing and after setting this value restarting node, now I am able to send both api requests. (Register/enroll a user), (POST a Donor) and (Get all donors). Thanks Bajwa
– Moolshanker Kothari
Jan 20 at 8:23
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54274351%2fdeploy-and-expose-chaincode-as-rest-api-on-amazon-managed-blockchain-hyperledger%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown