Blockchain Network Composer for Hyperledger Fabric. BNC is the CLI deployment tools for Enterprise Blockchain projects. It supports mainly Hyperledger Blockchain umbrella.
Using BNC everyone can easily:
-
Start a network with a configured number of organizations/peers/orderers.
-
Deploy, configure and channels
-
Deploy, configure and upgrade chaincodes
-
Add a new organization or a new orderer to the network
sudo curl -L https://raw.githubusercontent.com/bxforce/bnc-hlf/master/bin/bnc -o /usr/local/bin/bnc && sudo chmod +x /usr/local/bin/bnc
The following command will start a network of a single orderer orderer1.bnc.com , a single peer peer1.org1.bnc.com and a certificate authority ca1.
It will also deploy the default chaincode which is the abstore chaincode of fabric-samples.
To start the network run the following command:
bnc run
By running the command above without specifying --config-folder $PWD
it will take the default config files.
We will see how you can use --config-folder
to provide your own configuration files.
Shutdown network:
The following command will remove all containers and remove the related volumes.
bnc rm
curl https://raw.githubusercontent.com/bxforce/bnc-hlf/master/tests/single_machine/config.yaml > config.yaml
bnc run --config-folder $PWD
The command above will start a single organization with single peer and orderer.
It will deploy the default absotre chaincode embedded in the image.
Shutdown network:
bnc rm --config-folder $PWD
In this section we will explain how to provide your own chaincode.
We will be running a single org on a single machine.
curl https://raw.githubusercontent.com/bxforce/bnc-hlf/master/tests/single_machine/config.yaml > config.yaml
Open the config.yaml file in the config directory with your favorite editor.
In the chaincode section, notice we have this attribute root_path_chaincode: "volume_chaincode"
Instead of _volume_chaincode_
put the absolute path to the folder example: root_path_chaincode: "/home/ubuntu/bnc-hlf/tests/chaincode/"
Notice we have : path_chaincode: "abstore" which is the folder containing your .go files.
Notice we have : lang_chaincode if chaincode is in golang leave it to "golang", if it is in nodeJS put: "node"
You can override the default chaincode configuration by passing the flag -c as we will show later
The following command will start the network and deploy the chaincode
bnc run --config-folder $PWD
If you want to start your network first, and deploy your chaincode seperately, you can do it like this:
bnc run --config-folder $PWD --no-chaincode
bnc chaincode deploy --config-folder $PWD
Otherwise you can override the default chaincode configuration:
bnc chaincode deploy --config-folder $PWD -c config-chaincode.yaml
docker ps
You should be able to see running the orderers/peers configured in the config.yaml file and most importantly you
should be able to see the dev-peer containers of your chaincode.
If you want to test your chaincode do the following: (this is testing fabric-samples abstore)
abstore is just doing init of two variables a,b and then substracting from one or the other a specific value
bnc chaincode invoke --config-folder $PWD -i "Init,a,100,b,100"
query chaincode
bnc chaincode query --config-folder $PWD -i "query,a"
call the invoke fct to move 10 from a to b
bnc chaincode invoke --config-folder $PWD -i "invoke,a,b,10"
The following command will remove all containers and remove the related volumes.
bnc rm --config-folder $PWD
- Run two org on a single machine
- Run two org on two machines
- Add orderer to your running organization
- Add new organization to your network
- Run external chaincode
- Fork it! 🍴
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request 😁 🎉
- Lead - Wassim Znaidi (@Wassimz)
- Developer - Ahmed Souissi (@ahmeds)
- Developer - Sahar Fehri (@sharf)
- Product owner - Chiraz Chaabane (@chirazc)
- @worldsibu for inspiration and some part of the util code.