How To Test Your Blockchain On Google Cloud Using Hyperledger Caliper


Testing blockchain applications ⛓️ can be cumbersome, mainly because they are complex, resource-demanding distributed systems. Testing your blockchain app on the cloud might improve the efficiency of the testing process, as well as achieving more realistic test environments.

This article provides a 101 guide on how to use Hyperledger Caliper (commit 302665) on Google Cloud, tackling the scenario of testing a Hyperledger Composer application, a blockchain framework which facilitates the development of Hyperledger Fabric applications. Nonetheless, this testing process applies to all blockchains supported by Hyperledger Caliper (Hyperledger Burrow, Hyperledger Fabric, Hyperledger Iroha, Hyperledger Sawtooth and more to come).

Setting the testing environment

  1. Create a private repository (e.g., on Github).
  2. Fork the Hyperledger Caliper project to your private repo:

3. Clone your private repo:

git clone

4. On CALIPER-PRIVATE-REPO/packages/caliper-samples/benchmark/composer , create a folder with the name of your application, e.g. my-network.

5. On the my-network folder, paste the contents of the configuration and test files from this repository. On a future article, I will explain how to write tests (my-network.js) and benchmark configurations (config.yaml).

6. You should have a developed business network using Composer (the BNA archive). If you have not developed a business network, you can still configure Caliper to test default business networks.

On CALIPER-PRIVATE-REPO-justicechain/packages/caliper-samples/src/contract/composer, create a folder named my-network. Paste your business network archive files (decompressed BNA file) inside the folder. You should have a lib folder, a models folder, and the files package.json, permission.acl and optionally, a

Note that on package.json, the name and version of the network have to coincide with the one on composer.json. Example package.json:

7. You have the necessary files to test your app. Push them to your repository:

git add *
git commit -m"add benchmark files"
git push origin master

Setting Google Cloud

  1. Create an account on Google Cloud. New accounts can apply for a free trial grant. Create a project, and activate the Compute Instance API.
  2. At Compute Engine -> VM Instances, click on Create a new instance.

3. Start your instance.

4. Click on Connect — SSH.

5. Install the prerequisites for Hyperledger Caliper (thanks Daz Wilkin):


sudo apt-get update
sudo apt-get install \
linux-image-extra-$(uname -r) \
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
curl -fsSL | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] \
$(lsb_release -cs) \
sudo apt-get update
sudo apt-get install docker-ce
sudo usermod -aG docker $USER
sudo systemctl enable docker
docker --version


sudo curl -L`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Golang (optional)
sudo curl \
--location$VERSION.$OS-$ARCH.tar.gz \
--output go$VERSION.$OS-$ARCH.tar.gz
sudo tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version

6. Clone your private repository with Caliper and your blockchain app to your Google Compute instance.

Testing your application

To run your benchmark, navigate to caliper/packages/caliper-samples.

To benchmark your application with CouchDB run:
caliper benchmark run -w ./ -c benchmark/composer/justice/config.yaml -n benchmark/composer/justice/composer.json

To benchmark your application with LevelDB run:
caliper benchmark run -w ./ -c benchmark/composer/justice/config.yaml -n benchmark/composer/justice/composer-level.json

The results of the benchmark will be reported on the terminal.

Do not forget to stop your machines in Google Cloud after finishing the experiments or else 💸.

Next Steps:

If you are passionate about learning blockchain technologies, feel free to join Blockchain4Students, a project I’m bootstrapping 😃 We aim to teach students the blockchain technology.

If any step is not clear, feel free to leave a comment on the comments section.

That’s it, congrats! Cheers, Keep Rocking 💪

How To Test Your Blockchain On Google Cloud Using Hyperledger Caliper was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.