๐ Note: I wrote this through a translator ๐
This application allows managers to register surveys and check students' responses
Click here to view the network architecture
- The blockchain operator sets up the Hyperledger Fabric network and the operator installs and instantiates the smart contract on the Fabric network.
- The User interacts with the Vue.js Web interface to register surveys and responses, or with the Explorer to identify blocks in the Fabric network.
- The Vue.js client uses the API gateway to interact with the overall servers.
- The API gateway uses the Express.js applications API to interact with the fabric network and uses the Flask.py application API to recognize card information.
- The Express.js application servers use the fabric-sdk-node to interact with the deployed fabric network and creates APIs for a web client.
- The Fabric network notifies the event processing Express.js application when an event occurs during an interaction.
- The Explorer identifies blocks by interacting with the fabric network through the postgresql DB.
- Hyperledger Fabric v1.4 is a platform for distributed ledger solutions, underpinned by a modular architecture that delivers high degrees of confidentiality, resiliency, flexibility, and scalability.
- Hyperledger Explorer is a user-friendly Web application tool used to view, invoke, deploy or query blocks, transactions and associated data, network information, chain codes and transaction families, as well as any other relevant information stored in the ledger.
- Node.js is an open source, cross-platform JavaScript run-time environment that executes server-side JavaScript code.
- Vue.js is an open-source JavaScript framework for building user interfaces and single-page applications.
- Flask.py is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications.
- Tesseract is an optical character recognition engine for various operating systems.
Program | Version | Program | Version |
---|---|---|---|
Hyperledger Fabric | 1.4.0 | Hyperledger Explorer | 1.0.0 |
docker | 18.09.7 | docker-compose | 1.17.1 |
node | 10.20.1 | NPM | 6.14.4 |
python | 3.6.9 | pip | 20.0.2 |
Go | 1.11 |
- Clone the Repo
- Prepare prerequisites By shell script
- Start the Fabric network By shell script
- Run the Dockerize web apps By shell script
Git clone this repo onto your computer:
ubuntu$ git clone https://github.com/woojae9488/fabric-survey-app
ubuntu$ cd fabric-survey-app/
The shell script in the fabric-survey-app folder provides simple preparation:
ubuntu$ chmod +x prepare.sh
ubuntu$ sudo ./prepare.sh light
ubuntu$ source ./environment
If your computer has less than 1.5GB of memory, you need to add an -S option or an -s <size> Option to create a swapfile.
After all the scripts are run, the version will be checked at the end. Check the versions of the other programs except python and pip.
The source command is to set the necessary environment variables for starting the fabric network.
For more details, see the contents of the prepare.sh file.
The shell script in the fabric-survey-app folder provides simple Fabric network startup:
ubuntu$ chmod +x operate.sh
ubuntu$ sudo ./operate.sh up
When you run a script, the following things happen in order:
- Generate certificates through the "artifacts/crypto-config.yaml" file.
- Generate channel artifacts through the "artifacts/configtx.yaml" file.
- Deploy the required containers on the Fabric network through the docker-compose command and the "arifacts/docker-compose.yaml" file.
- Run the "scripts/script.sh" file using the cli docker container.
When you run a script in the cli docker container, the following things happen in order:
- Create a surveynet channel.
- All peers join in the surveynet channel.
- Update anchor peers for each organization.
- Install chaincode on all peers.
- Instantiate chaincode in each peer.
- The query and Invoke are tested since all configurations are complete.
For more details, see the contents of the operate.sh file.
Now, finally, run only the deploy.sh shell script will end the whole process.
ubuntu$ cd web-app/
ubuntu$ chmod +x deploy.sh
ubuntu$ sudo ./deploy.sh start all
If everything is done well, we are ready to access our fabric network.
Go to http://[HOST-IP]:8080/ to view the client app, or http://[HOST-IP]:8888/ to view the Explorer app. ๐
Now test the web you created. The id and password of the existing manager are admin, adminpw.
If you want to run applications separately from the Explorer or just the Explorer, you can run them through the following commands:
ubuntu$ sudo ./deploy.sh start msa # Exclude the Explorer
ubuntu$ sudo ./deploy.sh start explorer # Just the Explorer
For more information, see the contents of the deploy.sh file and the resources in the docker-config directory.
It is not possible to run the Explorer when running web applications in a local deployment because only dockerized Explorer is available in this code pattern.
These steps overlap with the preceding steps(Step 1. and Step 3.). Therefore, I will explain the other parts only.
- Clone the Repo
- Prepare all prerequisites By shell script
- Start the Fabric network By shell script
- Run the web servers and client
The shell script in the fabric-survey-app folder provides simple preparation:
ubuntu$ chmod +x prepare.sh
ubuntu$ sudo ./prepare.sh all
ubuntu$ source ./environment
If your computer has less than 1.5GB of memory, you need to add an -S option or an -s <size> Option to create a swapfile.
After all the scripts are run, the version will be checked at the end. Make sure that all version of the programs are checked.
The source command is to set the necessary environment variables for starting the fabric network.
For more details, see the contents of the prepare.sh file.
To deploy without a dockerize web servers or client, each servers and client must be run directly. At this step, you can modify and execute the code as you wish.
First, let's run a fabric-manager server, a fabric-student server, and a fabric-event server that connects to the fabric network.
ubuntu$ cd web-app/servers/fabric-manager/
ubuntu$ npm install
ubuntu$ npm start
ubuntu$ cd ../fabric-student/
ubuntu$ npm install
ubuntu$ npm start
ubuntu$ cd ../fabric-event/
ubuntu$ npm install
ubuntu$ npm start
Here, the fabric-student server does not matter, but the fabric-event server must run later than the fabric-manager server. (This is because the fabric-manager server registers the certificate of the fabric-event server.)
Then, run the card-recognize server and the API gateway.
ubuntu$ cd ../card-recognize/
ubuntu$ pip3 install -r ./requirements.txt
ubuntu$ python3 app.py
ubuntu$ cd ../api-gateway/
ubuntu$ npm install
ubuntu$ npm start
If you don't want to use Chonnam National University's student card recognition, you don't have to run the card-recognize server and you have to change the client's student signup process.
Finally, run the client.
ubuntu$ cd ../../client/
ubuntu$ npm install
ubuntu$ npm run serve
If everything is done well, we are ready to access our fabric network. Go to http://localhost:8080/ to see your app. ๐
Now test the web you created. The id and password of the existing manager are admin, adminpw.
After testing network, or if an error occurs and the network must be stopped, go to the fabric-survey-app folder and the following should be done:
ubuntu$ sudo ./operate.sh down
If you also want to shut down dockerize web apps:
ubuntu$ cd web-app/
ubuntu$ sudo ./deploy.sh stop all # Or msa or explorer
This section will show pictures of the network structure or elements of the surveynet.
- hyperledger-fabricdocs (release-1.4)
- Hyperledger Fabric SDK for node.js
- Hyperledger Fabric contract SDK for node.js
- hyperledger/fabric-samples/first-network
- hyperledger/fabric-samples/balance-transfer
- hyperledger/fabric-samples/commercial-paper
- hyperledger/blockchain-explorer
- IBM/evote
- IBM/auction-events
- Vue.js
- Vue Router
- BootstrapVue
- Walkthrough of HLF Node SDK and Client App
- Exploring Fabric-CA: Registration and Enrollment
- PutState and GetState
- Private Data in Hyperledger Fabric
- Connection Profiles
- How to deploy chaincode in Hyperledger Fabric?
- MartinYounghoonKim/nodejs-authenticate-jwt-vuejs
- ์๋ฐ์คํฌ๋ฆฝํธ async์ await
- async/await์ผ๋ก ์ฝ๋ฐฑ์ง์ฅ์ ํด๊ฒฐํด๋ณด์
- RESTful API ์ค๊ณ ๊ฐ์ด๋
- ๋ชจ๋ ์์ง๋ง ๋ชจ๋ ๋ชจ๋ฅด๋ package.json
- Node.js ๊ธฐ๋ฐ์์ ํ๊ฒฝ๋ณ์ ์ฌ์ฉํ๊ธฐ
- ํน์ ์๊ฐ์ ์ด๋ฒคํธ ๋ฐ์์ํค๊ธฐ
- Nodejs lowdb ์ฌ์ฉํ๊ธฐ
- Node.js ๊ฐ ๋ก์ปฌ, ๊ธ๋ก๋ฒ ๋ชจ๋์ ํ์ํ๋ ์์๋ฅผ ํ์ธํด๋ณด์
- MSA ์ ๋๋ก ์ดํดํ๊ธฐ - MSA์ ๊ธฐ๋ณธ ๊ฐ๋
- API Gateway ๊ตฌํ
- ecojuntak/api-gateway
- Vue ์ปดํฌ๋ํธ ๋ฐ์ดํฐ ์ฃผ๊ณ ๋ฐ๊ธฐ
- Vue์์ ์ค์ฒฉ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ํ๋ ๋ฒ
- Vue.js ์ปดํฌ๋ํธ ์ฌ์ฌ์ฉํ๊ธฐ - slot ํธ
- Vue Router์ LifeCycle ์ดํดํ๊ธฐ
- Vue.js ๋ผ์ฐํฐ ๋ค๋น๊ฒ์ด์ ๊ฐ๋ ์์๋ณด๊ธฐ
- Component ๊ฐ๋ ์ ์ตํ๊ณ ๋ง๋ค์ด๋ณด์!!
- Axios ๋ฌ๋ ๊ฐ์ด๋
- javascript๋ก ์ด๋ฏธ์ง ์ ๋ก๋ ๋ฐ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ๊ธฐ๋ฅ ๊ตฌํํ๋ ๋ฐฉ๋ฒ
- LocalStorage, SessionStorage ํด๋ผ์ด์ธํธ์ ์ ๋ณด ์ ์ฅ
- Vue.js์ Chart.js๋ฅผ ์ด์ฉํ์ฌ ์๋ฆ๋ค์ด ์ฐจํธ ๋ง๋ค๊ธฐ
- Vue cli 4 ํ๊ฒฝ ๋ณ์ ์ค์ ํ๊ธฐ
- ํ์ด์ฌ Flask๋ฅผ ์ด์ฉํ์ฌ REST API ๋ง๋ค๊ธฐ
- Axios, POST request to Flask
- opencv / pytesseract๋ฅผ ํ์ฉํ image2text
- Python OpenCV ๊ฐ์ข : ์ 1๊ฐ - OpenCV ์ค์น
- ๋ฅ๋ฌ๋๊ณผ OpenCV๋ฅผ ํ์ฉํด ์ฌ์ง ์ ๊ธ์ ๊ฒ์ถํ๊ธฐ
- OpenCV - ์ด๋ฏธ์ง์์ ํ ์คํธ ์์ญ๋ง ์ฐพ์๋ด๊ธฐ
- ๋ฐ์ฝ๋ / QR์ฝ๋ ์ธ์ํ๊ธฐ
- Python์์ Open API ํธ์ถํ๊ธฐ
- How to convert base64 string to image?
- ๋์ปค ์ด๋ฏธ์ง ๋น๋ ์๋ฆฌ์ OverlayFS
- ์ด๋ณด๋ฅผ ์ํ ๋์ปค ์๋ด์ - ์ด๋ฏธ์ง ๋ง๋ค๊ณ ๋ฐฐํฌํ๊ธฐ
- ๋ฆฌ์กํธ ํ๋ก์ ํธ์ ESLint ์ Prettier ๋ผ์น๊ธฐ
- ๋งํฌ๋ค์ด ์ฌ์ฉ๋ฒ
- ParkSB/javascript-style-guide
- Apache License 2.0 ์ฌ์ฉ๋ฒ
- Fixing security vulnerabilities in npm dependencies