Skip to content

codetit4n/first-fabric-chaincode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

first-fabric-chaincode

First hyperledger fabric chaincode written in JavaScript.

Reference: https://www.youtube.com/watch?v=azBTd3OYST0

To run the project

Linux machine recommended.

Step 1: Clone the repository ,go inside the scripts folder and install the node modules

git clone https://github.com/codeTIT4N/first-fabric-chaincode.git
cd first-fabric-chaincode
cd scripts
npm install

Step 2: Make sure you have docker and docker-compose installed then run the following command to start the fabric network test-network and deploy the chaincode to it

./startFabric.sh

Step 3: Interact with blockchain using the scripts inside the scripts/blockchain-interactions folder using node:

cd blockchain-interactions
node 1-enrollAdmin.js

This will create an admin wallet.

node 2-registerUser.js

This will register a new user.

node 3-invoke.js

This will invoke a transaction on the blockchain.

node 4-query.js

This will query the blockchain and return the data.

Step 4: Finally stop the network and remove the docker containers using:

cd ..
./networkDown.sh

Thankyou!