RIHU Software Consulting Pvt Ltd, Hyderabad, INDIA
  • +91 9000918024
  • 24 x 365 days
/

Deploying a Hyperledger Composer business network to Fabric for single org


This document helps to demonstrate the steps that an administrator needs to take in order to deploy a blockchain business network to an instance of Hyperledger Fabric for a single organization, including how to generate the necessary Hyperledger Composer configuration.

  • First You need to setup development environment and create business network card by following Composer Development Environment Setup
  • Go to the fabric-tools directory, Stop the fabric network it will kill all the running containers and Start a clean hyperledger fabric network .
  • cd ~/fabric-tools ./stopFabric.sh ./teardownFabric.sh ./downloadFabric.sh ./startFabric.sh
  • Delete all existing business cards, It is safe to ignore errors.
  • composer card delete -n CardName
  • Look at the files which stores the configuration for the fabric tools cryptogen, configtxgen.
  • ~/fabric-tools/fabric-scripts/hlfv1/composer/crypto-config.yaml
    ~/fabric-tools/fabric-scripts/hlfv1/composer/configtx.yaml
  • copy the certificates and private key files from the msp and store them in present working directory.Path for the msp file is
  • ~/fabric-tools/fabric-scripts/hlfv1/composer/crypto-config /peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
  • Create a json file name it connection.json, which conatins all of the information required to locate and connect to the Hyperledger Fabric network.
  • i.e,
    {
    "name": "fabric-network",
    "type": "hlfv1",
    "mspID": "Org1MSP",
    "peers": [
    {
    "requestURL": "grpc://localhost:7051",
    "eventURL": "grpc://localhost:7053"
    }
    ],
    "ca": {
    "url": "http://localhost:7054",
    "name": "ca.org1.example.com"
    },
    "orderers": [
    {
    "url" : "grpc://localhost:7050"
    }
    ],
    "channel": "composerchannel",
    "timeout": 300
    }
  • Create the business network for the administrator card by using connection profile, certificate and private key.by runninig below command
  • composer card create -p connection.json -u PeerAdmin -c Admin@org1.example.com-cert.pem -k 3463f02de786d925ba8991163c340bd2860301441f2c9ce62eb64f31c617c5f9_sk -r PeerAdmin -r ChannelAdmin
  • Now import the business network card
  • composer card import -f PeerAdmin@fabric-network.card
  • Install composer run time for this we need a business network card.
  • composer runtime install -c PeerAdmin@fabric-network -n tutorial-network
  • We use yeoman to create business network. It will ask for the business network name and author name etc.
  • yo hyperledger-composer:businessnetwork
  • Edit the cto file from models directory.
  • Next edit logic.js file from lib directory.
  • Create a permission.ctl file in tutorial-network.
  • Archive the business network from tutorial-network directory
  • composer archive create -t dir -n .
  • Move the bna file to fabric-tools folder.
  • Come back, and install composer run time by using business network.
  • composer runtime install -c PeerAdmin@fabric-network -n tutorial-network
  • Start the business network, give the name of bna file just before we have created.
  • composer network start -c PeerAdmin@fabric-network -a tutorial-network.bna -A admin -S adminpw
  • Import the business network card.
  • composer card import -f admin@tutorial-network.card
  • List out the composer cards, you will find two cards one is admin card and another business network card.
  • composer card list
  • Ping the business network
  • composer network ping -c admin@tutorial-network
  • Run compose rest server to create rest api's, It will ask for the card name.
  • composer-rest-server
    Select never use name spaces
    Select No when asked whether to secure the generated API.
    Select Yes when asked whether to enable event publication.
    Select No when asked whether to enable TLS security.
    Access localhost:8080, You will find api's generated.

© 2013-2025 RIHU Software Consulting Pvt Ltd. All rights reserved