Categorygithub.com/ibm-silvergate/netcomposer
repositorypackage
0.1.0-beta
Repository: https://github.com/ibm-silvergate/netcomposer.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Fabric Network Composer

Fabric Network Composer automates the generation of an operational Hyperledger Fabric Network based on a configuration file where basic aspects of the network are defined in a simple way.

This simple tool is useful when getting started with Hyperledger Fabric and for bootstrapping development/testing Hyperledger Fabric Networks based on customized Hyperledger Fabric images.

Hyperledger Network Composer flow

Configuration file

The tool takes as input a config file specifying the network components:


    DOCKER_NS: hyperledger
    ARCH: x86_64
    VERSION: 1.0.2

    network:                "samplenet"
    domain:                 "samplenet.com"

    orderer:
        type: "solo"

    db:
        provider:   "goleveldb"

    ordererNodes:           1
    peerOrganizations:      1
    peersPerOrganization:   2
    usersPerOrganization:   1

    logLevel:               "debug"
    tlsEnabled:             true
    chaincodesPath:         "./sample-chaincodes"

Considerations

  • Required crypto material is generated by cryptogen tool.
  • Genesis block and channels are created with configtxgen tool included in tools folder.
  • The tool has been upgraded for Hyperledger Fabric release 1.0.2

1. Running the tool

Using the binaries for your platform (download from release folder): net-composer -config samplenet.yaml

Running the tool without binaries: go run main.go -config samplenet.yaml

2. Start the network

docker-compose -f ./samplenet/docker-compose.yaml up -d

3. Open a client in each peer

docker exec -it cli.peer1.org1.samplenet.com bash

4. Create channel (only in one peer, generated block file will be shared by peer containers)

cd channel-artifacts && peer channel create -o orderer1.samplenet.com:7050 -c bigchannel -f bigchannel.tx -t 10 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA

5. Join peers to channel (in each peer)

peer channel join -b bigchannel.block

6. Install chaincode on peers

peer chaincode install -n mycc1 -v 1.0 -p github.com/hyperledger/fabric/chaincodes/kv_chaincode_example01

7. Instantiate a chaincode (only in one peer)

peer chaincode instantiate -o orderer1.samplenet.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C bigchannel -n mycc1 -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('org1MSP.member','org2MSP.member')"

7.a Upgrade a chaincode (only in one peer)

peer chaincode install -n mycc1 -v 2.0 -p github.com/hyperledger/fabric/chaincodes/chaincode_example01

peer chaincode upgrade -o orderer1.samplenet.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C bigchannel -n mycc1 -v 2.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('org1MSP.member','org2MSP.member')"

8. Query/Invoke chaincodes

peer chaincode query -o orderer1.samplenet.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C bigchannel -n mycc1 -c '{"Args":["query","a"]}'

peer chaincode invoke -o orderer1.samplenet.com:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C bigchannel -n mycc1 -c '{"Args":["invoke", "a", "b", "10"]}'

9 Stop existing network

docker-compose -f ./samplenet/docker-compose.yaml down --remove-orphans

Prerequisites for building the tool

Go - 1.7 or higher

Building the tool

Build binaries for all supported platforms: make

Build binaries for a single platform:
    - make binaries/darwin-amd64
    - make binaries/windows-amd64
    See Makefile for all supported platforms

License

Source code files are made available under the Apache License, Version 2.0 (Apache-2.0), located in the LICENSE file.