A hyperledger fabric network to demonstrate certificate creation, exchange and verification between education providers.
- 3 Organizations (IIT, MHRD, UpGrad)
- TLS Disabled
- 2 Peers per org
- Create a student account
- Issue a new certificate
- Verify certificate
- Pre-setup
- Generate Crypto Materials
MacBook-Pro:network aakash$ cryptogen generate --config=./crypto-config.yaml
- Generate Channel Artifacts
MacBook-Pro:network aakash$ configtxgen -profile OrdererGenesis -channelID upgrad-sys-channel -outputBlock ./channel-artifacts/genesis.block MacBook-Pro:network aakash$ configtxgen -profile CertificationChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID certificationchannel MacBook-Pro:network aakash$ configtxgen -profile CertificationChannel -outputAnchorPeersUpdate ./channel-artifacts/iitMSPanchors.tx -channelID certificationchannel -asOrg iitMSP MacBook-Pro:network aakash$ configtxgen -profile CertificationChannel -outputAnchorPeersUpdate ./channel-artifacts/mhrdMSPanchors.tx -channelID certificationchannel -asOrg mhrdMSP MacBook-Pro:network aakash$ configtxgen -profile CertificationChannel -outputAnchorPeersUpdate ./channel-artifacts/upgradMSPanchors.tx -channelID certificationchannel -asOrg upgradMSP
- Generate Crypto Materials
- Docker Network Setup
- Start Docker Network
MacBook-Pro:network aakash$ docker-compose -f ./docker-compose.yml up -d
- Start Docker Network
- Fabric Network Setup
- SSH Into CLI Container
MacBook-Pro:network aakash$ docker exec -it cli /bin/bash
- Create Channel
MacBook-Pro:network aakash$ CORE_PEER_LOCALMSPID="iitMSP" MacBook-Pro:network aakash$ CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/iit.certification-network.com/users/[email protected]/msp MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer0.iit.certification-network.com:7051 MacBook-Pro:network aakash$ peer channel create -o orderer.certification-network.com:7050 -c certificationchannel -f ./channel-artifacts/channel.tx
- Join Peer 0 - IIT
MacBook-Pro:network aakash$ peer channel join -b certificationchannel.block
- Join Peer 1 - IIT
MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer1.iit.certification-network.com:8051 MacBook-Pro:network aakash$ peer channel join -b certificationchannel.block
- Join Peer 0 - MHRD
MacBook-Pro:network aakash$ CORE_PEER_LOCALMSPID="mhrdMSP" MacBook-Pro:network aakash$ CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/mhrd.certification-network.com/users/[email protected]/msp MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer0.mhrd.certification-network.com:9051 MacBook-Pro:network aakash$ peer channel join -b certificationchannel.block
- Join Peer 1 - MHRD
MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer1.mhrd.certification-network.com:10051 MacBook-Pro:network aakash$ peer channel join -b certificationchannel.block
- Join Peer 0 - UPGRAD
MacBook-Pro:network aakash$ CORE_PEER_LOCALMSPID="upgradMSP" MacBook-Pro:network aakash$ CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/upgrad.certification-network.com/users/[email protected]/msp MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer0.upgrad.certification-network.com:11051 MacBook-Pro:network aakash$ peer channel join -b certificationchannel.block
- Join Peer 1 - UPGRAD
MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer1.upgrad.certification-network.com:12051 MacBook-Pro:network aakash$ peer channel join -b certificationchannel.block
- Update Anchor Peer for IIT
MacBook-Pro:network aakash$ CORE_PEER_LOCALMSPID="iitMSP" MacBook-Pro:network aakash$ CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/iit.certification-network.com/users/[email protected]/msp MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer0.iit.certification-network.com:7051 MacBook-Pro:network aakash$ peer channel update -o orderer.certification-network.com:7050 -c certificationchannel -f ./channel-artifacts/iitMSPanchors.tx
- Update Anchor Peer for MHRD
MacBook-Pro:network aakash$ CORE_PEER_LOCALMSPID="mhrdMSP" MacBook-Pro:network aakash$ CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/mhrd.certification-network.com/users/[email protected]/msp MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer0.mhrd.certification-network.com:9051 MacBook-Pro:network aakash$ peer channel update -o orderer.certification-network.com:7050 -c certificationchannel -f ./channel-artifacts/mhrdMSPanchors.tx
- Update Anchor Peer for UPGRAD
MacBook-Pro:network aakash$ CORE_PEER_LOCALMSPID="upgradMSP" MacBook-Pro:network aakash$ CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/upgrad.certification-network.com/users/[email protected]/msp MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer0.upgrad.certification-network.com:11051 MacBook-Pro:network aakash$ peer channel update -o orderer.certification-network.com:7050 -c certificationchannel -f ./channel-artifacts/upgradMSPanchors.tx
- SSH Into CLI Container
- Run Chaincode in Dev Mode
- SSH Into Chaincode Container
MacBook-Pro:network aakash$ docker exec -it chaincode /bin/bash
- Run Chaincode Node App In Dev Mode
MacBook-Pro:network aakash$ npm run start-dev
- SSH Into Chaincode Container
- Install Chaincode
- SSH Into CLI Container
MacBook-Pro:network aakash$ docker exec -it cli /bin/bash
- Install Chaincode on Peer 0 - IIT
MacBook-Pro:network aakash$ CORE_PEER_LOCALMSPID="iitMSP" MacBook-Pro:network aakash$ CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/iit.certification-network.com/users/[email protected]/msp MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer0.iit.certification-network.com:7051 MacBook-Pro:network aakash$ peer chaincode install -n certnet -v 1.1 -l node -p /opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/
- Install Chaincode on Peer 0 - MHRD
MacBook-Pro:network aakash$ CORE_PEER_LOCALMSPID="mhrdMSP" MacBook-Pro:network aakash$ CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/mhrd.certification-network.com/users/[email protected]/msp MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer0.mhrd.certification-network.com:9051 MacBook-Pro:network aakash$ peer chaincode install -n certnet -v 1.1 -l node -p /opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/
- Install Chaincode on Peer 0 - UPGRAD
MacBook-Pro:network aakash$ CORE_PEER_LOCALMSPID="upgradMSP" MacBook-Pro:network aakash$ CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/upgrad.certification-network.com/users/[email protected]/msp MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer0.upgrad.certification-network.com:11051 MacBook-Pro:network aakash$ peer chaincode install -n certnet -v 1.1 -l node -p /opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/
- SSH Into CLI Container
- Instantiate Chaincode
- SSH Into CLI Container
MacBook-Pro:network aakash$ docker exec -it cli /bin/bash
- Instantiate Chaincode on Channel Using Peer 0 - IIT
MacBook-Pro:network aakash$ CORE_PEER_LOCALMSPID="iitMSP" MacBook-Pro:network aakash$ CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/iit.certification-network.com/users/[email protected]/msp MacBook-Pro:network aakash$ CORE_PEER_ADDRESS=peer0.iit.certification-network.com:7051 MacBook-Pro:network aakash$ peer chaincode instantiate -o orderer.certification-network.com:7050 -C certificationchannel -n certnet -l node -v 1.1 -c '{"Args":["org.certification-network.certnet:instantiate"]}' -P "OR ('iitMSP.member','mhrdMSP.member','upgradMSP.member')"
- SSH Into CLI Container
- View Container Logs
- Start Peer 0 - IIT Container Logs
MacBook-Pro:network aakash$ docker logs -f peer0.iit.certification-network.com
- Start Peer 0 - IIT Container Logs
- Test Chaincode
- SSH Into Peer 0 - IIT
MacBook-Pro:network aakash$ docker exec -it peer0.iit.certification-network.com /bin/bash
- Invoke Create Student Function
MacBook-Pro:network aakash$ peer chaincode invoke -o orderer.certification-network.com:7050 -C certificationchannel -n certnet -c '{"Args":["org.certification-network.certnet:createStudent","0001","Aakash Bansal","[email protected]"]}'
- Invoke Get Student Function
MacBook-Pro:network aakash$ peer chaincode invoke -o orderer.certification-network.com:7050 -C certificationchannel -n certnet -c '{"Args":["org.certification-network.certnet:getStudent","0001"]}'
- SSH Into Peer 0 - IIT