Simple document management system with Hyperledger Fabric blockchain using Hyperledger Composer API, IPFS, MongoDB, Express.js, GraphQL, React.js and Material-UI
- Operating Systems: Ubuntu Linux 14.04 / 16.04 LTS (both 64-bit), or Mac OS 10.12
- Docker (version 17.03 or higher)
- npm (v5.x)
- Node (version 8.9 or higher - note version 9 is not supported!)
- to install specific Node version you can use nvm. Example:
nvm install 8.12.0
nvm use v8.12.0
- to install specific Node version you can use nvm. Example:
- Hyperledger Composer
- to install composer cli
npm install -g [email protected]
- to install composer-rest-server
npm install -g [email protected]
- to install generator-hyperledger-composer
npm install -g [email protected]
- to install composer cli
- IPFS (v0.4.17 or higher)
- MongoDB
- for example you can use cloud hosted MongoDB by mlab.com
Clone the Blockchain Document Managemen System
repo locally. In a terminal, run:
git clone https://github.com/nparfen/Blockchain-Document-Management-System.git
Start Docker. The fabric setup scripts will be in the /fabric
directory. Start fabric and create peer admin card:
cd fabric/
./downloadFabric.sh
./startFabric.sh
./createPeerAdminCard.sh
Now, we are ready to deploy the business network to Hyperledger Fabric. This requires the Hyperledger Composer chaincode to be installed on the peer,then the business network archive (.bna) must be sent to the peer, and a new participant, identity, and associated card must be created to be the network administrator. Finally, the network administrator business network card must be imported for use, and the network can then be pinged to check it is responding.
- Generate a business network archive in the
root
of the project:
cd ../
composer archive create -t dir -n .
- Install the business network:
composer network install --card PeerAdmin@hlfv1 --archiveFile [email protected]
- Start the business network:
composer network start --networkName nykredit-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card
- Import the network administrator identity as a usable business network card:
composer card import --file networkadmin.card
- Check that the business network has been deployed successfully, run the following command to ping the network:
composer network ping --card admin@nykredit-network
If the command returns successfully, your setup is complete.
ipfs init
ipfs daemon
Go into the api
folder and install the dependency:
cd api/
npm install
Connect your mongodb instance to save data about transactions for filtering, searching and paginating. Create .env
file in the api
folder and fill it with yours values. Also put down JWT secret for JWT token and enter preffered port for the server.
APP_PORT=
JWT_SECRET=
DB_USERNAME=
DB_PASSWORD=
DB_HOST=
DB_PORT=
DB_NAME=
Then run the server:
npm start
If evetything is okay you will see two links of the server (basic and for websockets).
Go to the client
folder and install the dependency:
cd client/
npm install
In the client
folder create .env
file and put that server links.
REACT_APP_API=
REACT_APP_WEBSOCKET=
Then start the web application:
npm start
The application should now be running at:
http://localhost:3000