/Hyperledger-Fabric

A sample application using hyperledger fabric

Primary LanguageJavaScript

A sample application using hyperledger fabric

This is a sample app created using tuna-app code structure as the basic framework

Prerequisites for Installing Hyperledger Frameworks

  • cURL
  • Node.js
  • npm package manager
  • Go Language
  • Docker
  • Docker Compose

Installation for MacOS

Installing hyperledger Fabric

Installing hyperledger Fabric Sample Code

Getting started with the network

  • cd fabric-samples/first-network
  • ./byfn.sh -m generate
    • It generates all the certificates, keys and Genesis block required for network configuration
  • ./byfn.sh -m up
    • It starts the network
  • ./byfn.sh -m down
    • It shuts down the network

Writing a sample application

  • Download the education repository
  • git clone https://github.com/hyperledger/education.git
  • cd education/LFS171x/fabric-material/tuna-app
  • docker rm -f $(docker ps -aq) (To remove pre-existing containers)
  • ./startFabric.sh (To start the network)
  • npm install (To install required packages from package.json file)
  • node registerAdmin.js (Register the admin)
  • node registerUser.js (Register the user)
  • node server.js (Start the application)
  • open localhost:8000 and your app would be running

Deploying the modified codechain

  • Move your chaincode (i.e. invoice-chaincode.go) to /opt/gopath/src/github.com/invoice-app (Check the name in startFabric.sh and accordingly replace invoice-app)
  • If the above directory is not present, then create the directoty and move
  • Troubleshooting
      If node registerUser.js gives error, run rm -rf .hfc-key-store/ and then run the command for both admin and user in order.