Deploy ‘fabcar’ on Hyperledger Fabric

Adventures in Blockchain

Daz Wilkin
Google Cloud - Community
4 min readNov 4, 2017

--

I’m spending time in November improving my knowledge of Blockchain technologies (and growing a moustache for Movember). I started in my comfort zone by deploying Hyperledger Fabric to a Google Cloud Platform (GCP) VM and spun through the ‘fabcar’ sample app.

Deploying Fabric and running ‘fabcar’ is straightforward so this post mostly serves as a foundational post and may be of interest if you’d like to run Fabric on GCP.

Hyperledger Fabric

I’m running everything on an Ubuntu 16.04 VM on GCP. If you don’t have a GCP account, you can get started for free here. I assume you’re using a Linux machine with Google’s Cloud SDK installed to create the VM:

From the ssh session on the ‘hyperledger-fabric-01’, we need to install multiple pre-requisite components.

Here we go!

Docker-CE

docker-compose

Golang

Node.js

Downgrade Python (on Ubuntu)

Fabric Samples: fabcar

Trick: Hyperledger hosts Fabric containers on dockerhub. Because these are built for various runtime architectures, there’s no singular “latest” container. The trick is to identify and download the most recent versions of the containers, they’re versioned in lock-step which is convenient, and then tag these with “latest”. Here’s a script for Linux X86_64:

Once this completes:

Then run the following command to run the Fabric test cluster:

You should see a stream of logs ending:

and, you should be able to:

Alright! There’s one more pre-req step:

and now you should be able to:

I won’t replicate the Fabric tutorial here, instead:

Conclusion

Pre-req’s aside, it’s straightforward to get a Fabric test cluster running and to use the ‘fabcar’ sample. Fabric is written in Golang and supports Golang and Java for contracts and, in this case, Node.js as a client.

Tear-down

To shutdown the Fabric cluster:

You may “exit” from all the ssh sessions.

You should be returned to your host session. The one from which you ran the gcloud commands. You may either stop the hyperledger-fabric-01 VM:

Or (permanently) delete it:

Or simply delete the entire GCP project:

That’s it!

--

--