nikita6187 / NEC

Our blockchain practical for the NEC challenge
2 stars 0 forks source link

update readme.md with API set up changes #8

Closed stefko3z closed 4 years ago

nikita6187 commented 4 years ago

1) in create-artifacts.sh, it has rm genesis.block. Should it remove the folder? It has been having issues if you have old one still there EDIT: 2) Is there any way to test the API? EDIT: 3) Some of the tutorials have ./bash ..., I think its supposed to be the other way round with the ./ EDIT: 4) In the last step of the API tutorial, where do you need to run nm run start?

stefko3z commented 4 years ago

1) for me the script works as intended and deletes all files (as long as I have the permission to do so) 2) Start server and send a http request (for example via Postman) 3) ./ is for when you set the script as executable (noted in readme.md) 4) in the api-2.0 folder (noted in readme.md)

nikita6187 commented 4 years ago

EDIT: @stefko3z 1) genesis.block is a folder for me, i.e. I get an error using rm (without the -r flag). Is it a file or folder for you? 2) Could you add an example into the docs for easy testing (only if it can be done quickly)? 🤗 3) & 4) 👍

stefko3z commented 4 years ago

For 2) I made this tutorial: https://stefko.atlassian.net/wiki/spaces/EMISSION/pages/15368193/Testing+the+Network+API+with+Fabcar

nikita6187 commented 4 years ago

Tutorial is great, 2 bugs I found: 1) In /api-2.0/app/helper.js:40, it should not be const adminIdentity .... This caused issues until I changed locally to let 2) We need to add init code logic in api-2.0/app/invoke.js or to the deployCC script and add to tutorial. I get invalid invocation: chaincode 'fabcar' has not been initialized for this version, must call as init first, but the invoke.js code doesn't allow to call init. See api-2.0/app/invoke.js:54

stefko3z commented 4 years ago

1) Can you elaborate the issues? 2) yeah, I've had initialized the fabcar via deployChaincode.sh (by uncommenting the hardcoded functions) beforehand. In a broader sense deploy.sh is crying for a rework

nikita6187 commented 4 years ago

@stefko3z 1) Its a small issue which should just have let adminIdentity ... in line 40 of /api-2.0/app/helper.js 2) theoretically we could just allow initLedger to be called via the api, right? But i completely agree it needs a rework in general EDIT: but isn't chaincodeInvokeInit a general function for all CCs? I.e. we could leave it out uncommented for all CCs in deployCC?

After changing those things the tutorial works for me :+1:

stefko3z commented 4 years ago

I've update the pull request. Now deployChaincode.sh supports the additional arguments.

nikita6187 commented 4 years ago

@stefko3z in the latest deployChaincode, all the functions at the bottom are commented out. Is that correct?