Intro to Private Blockchains

Launch the Sample App

If you haven’t gone through the environment setup steps, please visit the previous section.

Because Hyperledger networks require multiple nodes operating with different roles, we’ll need to simulate not just a single node, but a whole network. In this case, we’ll use the docker containers provided by the Hyperledger consortium to set up a testing network. Docker allows us to run several virtual machines, each with a chosen purpose, and will help to simulate a wider network.


Before we start, you’ll want to make sure the first network example is down. Be sure to run this command from the first-network directory.


shut down the network and clear docker

[email protected]: ~/fabric-samples/ $ ./ down // shut down the network
[email protected]: ~/fabric-samples/ $ cd ../fabcar/ // Switch to the example directory
[email protected]: ~/fabric-samples/ $ docker rm -f $(docker ps -aq // clean up docker files
[email protected]: ~/fabric-samples/ $ docker network prune
[email protected]: ~/fabric-samples/ $ docker rmi

This quickly clears the old image and prunes the network. This step is important when testing multiple docker apps to avoid any overlap or interference. (More on this here.)

Now that we have everything set up on the Hyperledger end, we can install our node.js client.


Install the Node Modules

[email protected]: ~/fabric-samples/fabcar/ $ npm install

Now that everything is cleaned up, we’re ready to start experimenting!