Deploying Proof of Stake Blockchain Applications on IBM Cloud Using Tendermint


Blockchain is one the greatest technological innovations since the Internet. The Internet empowers free flow of information, while the Blockchain empowers frictionless flow of value. Companies from various disciplines are now adopting Blockchain for real-world business use cases. The amount of research going on in applied cryptography is unprecedented. We are right now experiencing the largest civilian deployment of public key cryptography ever, and that is the Bitcoin.

While Blockchain is very interesting technology, it is also nascent. It is challenging to do a rapid prototype of a blockchain application and run it on Cloud. Tendermint allows you to rapidly create Blockchain application as it handles the underlying blockchain layers such as networking and consensus, and allows the developer to only focus on application layer through ABCI (Application Blockchain Interface)

In this blog post, I will show you how to easily create a Blockchain chat application and deploy it to cloud using Tendermint, Lotionjs, and Ionic.

What is Tendermint?

“Tendermint is software for securely and consistently replicating an application on many machines.”

To simply put Tendermint is a software which can be used to achieve Byzantine fault tolerance (BFT) in any distributed computing platforms. From managing infrastructure to designing a distributed database, we can use Tendermint. Tendermint is built on 2 important technical components.

Consensus Engine: Also known as Tendermint core, this ensures that each transaction is recorded in every machine in the same order through Proof of Stake consensus.

ABCI (Application Blockchain Interface): Enables transaction to be processed in any programming language.

Properties of Tendermint

  1. Byzantine Fault-Tolerant: Tendermint tolerates up to one third of your machines failing arbitrarily. This includes explicitly malicious behaviour.
  2. State Machine Replication: Tendermint can replicate deterministic state machines written in any programming language.
  3. Secure P2P: Gossip protocols and peer discovery are secured via Tendermint’s authenticated encryption system.
  4. Lightning Fast: Tendermint supports thousands of transaction per second at 1000ms latencies.

What is Lotionjs

Lotion is a new way to create blockchain apps in JavaScript, which aims to make writing new blockchains fast and fun. It builds on top of Tendermint using the ABCI protocol.

Creating a Blockchain Chat Application with 2 Tendermint Validator Nodes Deployed on IBM Cloud


  1. Signup to IBM Cloud for free
  2. Install Cloud Foundry CLI
  3. Install IBM Cloud CLI
  4. Install Docker
  5. Install Kubernetes
  6. Clone the repo
$ git clone

7. ⭐ the repo :)

8. Creating the Genesis file and populating it with 2 validators

  • Navigate to creatingGenesisFile directory
$ cd creatingGenesisFile
  • Install Dependencies
$ npm i
  • You will find genesis.json directory and it will look like following below without any validators
  • Generate 2 validators
$ ./node_modules/lotion/bin/tendermint gen_validator > privkey0.json
$ ./node_modules/lotion/bin/tendermint gen_validator > privkey1.json
How Private Key looks like
  • Clean your private key: Eliminate unnecessary info like ( last_height , last_round, last_step, last_signature )
This is how your cleaned privkey0.json
This is how your cleaned privkey0.json
  • Note: Each time you will get a different combination
  • Populating genesis.json with the following keys generated, only add your public key not private :)
This is how your genesis file will look like in the end with two validators
Cool now we understood how to set our genesis file :)

10. Create your cluster on IBM Cloud

  • Click on Create Cluster
  • Give a name to your cluster and deploy
  • Wait for your cluster to be ready
  • Once ready, click on your cluster, and click on worker nodes to check its public ip and note it down
  • Click on Access tab
  • Now to Access your cluster hosted on IBM Cloud do the following steps
  • Install the container service plugin.
$ bx plugin install container-service -r Bluemix
  • Log in to your IBM Cloud account.
$ bx login -a <depends which region you deployed your cluster>
$ bx cs region-set eu-central <depends which region you deployed your cluster>
  • Get the command to set the environment variable and download the Kubernetes configuration files.
$ bx cs cluster-config nameOfYourCluster
  • Set the KUBECONFIG environment variable. Copy the output from the previous command and paste it in your terminal. The command output should look similar to the following.
$ export KUBECONFIG=/Users/ibm/.bluemix/plugins/container-service/clusters/Saif1Cluster/kube-config-mil01-nameOfYourCluster.yml
  • Verify that you can connect to your cluster by listing your worker nodes.
$ kubectl get nodes

11. Build your docker image of your validator1

  • Update node0 peer ip accordingly, your peer ip will be another peer on another cluster
  • Navigate to node1 directory
$ cd node1
  • Build your Docker image
Dockerfile of node1 (validator1)
$ docker build -t node1 .
Image being built :)
  • Go to your IBM Cloud Registery
  • Choose a name for your first namespace, and create that namespace.
$ bx cr namespace-add <my_namespace>
  • Log your local Docker daemon into the IBM Cloud Container Registry.
$ bx cr login
  • Choose a repository and tag by which you can identify the image. Use the same repository and tag for the rest of this Quick Start.
$ docker tag node1 registry.<region-short-term><my_namespace>/node1:latest
  • Push the image.
$ docker push registry.<region-short-term><my_namespace>/node1:latest
once you push you will have it uploaded in ibm’s private registry :)
  • Verify that your image is in your private registry.
$ bx cr image-list
  • Now once you have successfully deployed, you have to deploy to IBM container using kubernetes and make tendermint port and p2p port accessible publicly
  • Create service-deployment.yml accordingly to your private registry setup
Deployment file
  • Create and Deploy the service :)
$ kubectl create -f service-deployment.yml
  • Delete all deployments
$ kubectl delete deployments --all
  • Delete all services
$ kubectl delete services --all
  • Follow the same procedure with node 2 and deploy
  • Access pods and logs
$ kubectl get pods
$ kubectl logs podname
  • If both validator nodes are successfully deployed and you log one of them, you will see blocks will start committing since they are in synch with each other
Means both validators are in synch :)

12. Cook a sexy UI with ionic to interact with those 2 validators and send txs

  • Install Ionic
$ npm i -g ionic cordova
  • Open manifest.yml and give app a name from cf/manifest.yml
  • Open frontend/src/pages/congif/config.ts , and give app name you mentioned in manifest.yml
  • Navigate to frontend directory and build the app
$ ionic cordova platform rm browser
$ ionic cordova platform add browser
$ ionic cordova build browser
  • Navigate to cf folder, and push the app, this will have a fully functional Blockchain with a sexy frontend build with ionic 💖
  • Login to IBM cloud with cf cli

If you are using US South Region:

use these commands:

$ cf api
$ cf login -u bluemix_id

If you are using United Kingdom region:

use these commands:

$ cf api
$ cf login -u bluemix_id

for Sydney region

$ cf api
$ cf login -u bluemix_id

for Germany region

$ cf api
$ cf login -u bluemix_id

After logging in push your app :)

$ cd cf
$ cf push
If all works well your frontend app will be up and running

Note that your frontend app is not a validator node, its just a node that connects to 2 validator nodes on cloud

You connect it with peer port, running on 30092 as mentioned :)
  • You can access tendermint rpc api from here

13. Endpoints to interact with your blockchain by Cloud Foundry Tendermint apis

Endpoints :)

Please star the repo if you liked it :)


Tendermint Chat App Repo

Lotionjs Repo

Tendermint Repo

Tendermint Documentation


Tendermint has made it easy for business developers to write blockchain applications, and the IBM Cloud made it easy to deploy and operate such applications. I look forward to seeing your blockchain applications!