Building Your Own Private Blockchain on Kubernetes with Geth

Jan. 22, 2019

BY TARA MATAMOROS CARTER

 

You’ve got time. The problem is that your time is fragmented and scattered throughout your day. Everyone is crunched, especially those trying to launch a business or manage investment portfolios. What somebody really needs to build is an app that can identify and productively fill up all the wasted fragments of time in your day based on some method of optimizing your pathway through responsibilities. It would be like a Waze for task planning. As a temporary placeholder, I’ll call that hypothetical app Navi-Gator.

Nobody has done that, as far as I know, so there’s something you could do. A private blockchain would be the ideal backbone for that kind of project. A startup that has done something similar for the shipping industry is the Fr8 Network. They built their own blockchain to minimize all of the wasted space in partially empty trucks that drove 30 billion miles across the U.S. last year. Brokers, shippers, truck drivers, customers waiting for packages – everybody wins.

That’s the sort of breakthrough thinking that blockchain enables, which is why anyone serious about saving time or conserving resources should devote some time to investigating blockchain.

In this article, the third in my Blockchain on Kubernetes (BoK) series, I’ll delve into the requirements for and uses of private blockchains. While the first two blog articles introduced elemental concepts in BoK and Helm, now it’s time to get your hands dirty with your own private blockchain. To be more specific, consider the business applications of running a permissioned Ethereum node off the central net, allowing you to transfer secure funding strings between endpoints, create smart contracts, explore block history and conduct several other operations that have market-defining implications.

Before devoting the time and expense involved in connecting to the public Ethereum net, it is a good idea to experiment with your own private instance of a blockchain, using Ethereum as a scaffold. To do that, you should probably take some time to get to know Geth, short for Go Ethereum, a widely used command line interface for running a private blockchain implementation.

There are plenty of online resources to help you with installing and running Geth, like this walkthrough from Mercury Protocol. You will use Geth to create a Genesis block, the first block in your private chain, and set your own parameters with fields like “difficulty” and “gasLimit” that specify how easy it is to add blocks. You’ll instantiate your data directory, mine your own private Ethereum (which has only the value you give it inside this node), generate peers, and start communicating between peers.

This is what you need to start experimenting safely and learn firsthand how to do common tasks like create basic decentralized apps like Navi-Gator.

Creating a Private Blockchain on Azure

I’ll talk about serverless architectures in an upcoming blog, but if you are using Microsoft Azure as your cloud client, it’s even easier because you can use a pre-built template from the Ethereum Consortium.

Creating a Private Blockchain on Azure

You can configure both mining and transaction nodes, so your own private functional blockchain is up and running in a matter of minutes. You will still need to be familiar with Geth commands, so I recommend a video tutorial, like:

or an interactive online course like this one from Udemy.

Course

What Do I Do with My New Blockchain?

There are a few high profile private blockchain projects under development now. Three of the best documented are the Hyperledger Fabric project from Linux (which I will examine in an upcoming blog), the Corda developer training platform from R3, and a patient-centric healthcare exchange from Gem Health and Phillips. If you are straining at the limits of your imagination to figure out what to do with a private node of Ethereum, here are some real-world examples.

1) Profiting from predictions

Chess grandmasters see a few moves ahead and are ready for the most likely futures. Bring that kind of advantage to business operations. If you could predict how the market would respond, that would be an enormous advantage for company leaders weighing potential outcomes for various types of software or marketing strategies. Smart contracts on Ethereum are the underpinnings of Augur, which facilitates peer-to-peer agreements and then rewards accurate predictions. Companies can thrive by making intelligent decisions based on uncertainties such as political probabilities, emerging global cultural shifts, and technological disruption vectors. It’s worth brainstorming around the concept of a stock exchange where investments are made in actual futures and without the need to share profits with proxies.

2) Solving the privacy puzzle

Nobody really knows whether or not their company is in compliance with the EU’s GDPR guidelines right now. The rules are poorly defined and still in flux. Enforcement is practically impossible for small to mid-sized firms operating in the US. Meanwhile, California and other local authorities are making their own versions of data protection standards. Private blockchains built on Ethereum are uniquely able to resolve some of the thorniest of data-sharing issues, provide temporary access to customer data and prevent it from being copied indiscriminately. As marketers seek to get more accurate data into their CRMs and consumers try to balance customization with privacy, more companies will turn to blockchain to find solutions.

3) Using Ingress for traffic control

Every private blockchain needs a load balancer to control the traffic coming in from an open network. For any deployment of Kubernetes clusters, Ingress serves as a set of rules that authorize the access to the clusters and balance the loads. Ingress makes it possible for your app to achieve high reliability by eliminating a single point of failure where traffic enters the application. You’ll deploy with multiple copies of Ingress as the access layer to your Kubernetes clusters. The Ingress node should be exclusive to your development team so other business applications aren’t trying to compete for network resources. You can see how the Ingress layer handles routing resource clusters in the following private Ethereum network topology.

Ethereum network topology

Traffic and load balancing are managed by rules you define, and the NGINX ingress controller is one of the most common options, especially for Kubernetes on Azure. Ingress is essential for routing based on content, i.e. real-time personalization, and the related problem of gating information behind authentication without the user being inconvenience or even aware of what’s going on behind the scenes. Here’s a real-world use case of two content sets, a green and a blue website, where the sensitive information is served up to the user based on the origin of the web request. In this walkthrough, you create two files, one for each content set that represents an entire website. Each file runs 5 pods for a total of 10 containers. Then you create an Ingress level that maps DNS names to specific services. The NGINX controller syncs up rules to pods, bringing up the green or blue website and the associated content dynamically.

4) Blockchain for a Better World

The world is full of problems. If you don’t know where to start in solving them all, start here. The UN’s 17x30 Initiative is a set of 17 goals that the organization is calling for help in resolving before 2030. No. 1 on that list is to end poverty everywhere, measured by individuals living on less than US $1.25 a day. That is realistic and achievable given that the UN met its prior goal of halving the number of people living in poverty from 1990 to 2015. A great example of how blockchain has been instrumental in attacking the problems on the UN’s list is the Impact PPA project, which created a decentralized utility made up of micro-grids to generate, store and deliver power for the 1.2 billion people living without electricity around the world.

5) What Else?

The blockchain examples above suggest business models based on prediction markets, new data privacy regulations, dynamic website content, and sustainability initiatives. Other creative applications include a platform that rewards users for creating popular videos, an peer-to-peer ecosystem for influencers, and AI-driven freelancer ranking site using IBM’s Watson. We could include the Navi-gator app I proposed at the start of this article, which still needs a great deal of work in terms of ideation and development. No matter what kind of business problems you are trying to solve, you will get a new perspective on how to solve them by testing out the limits of your own private blockchain. The next step is to bring in the collective brain power of open source developers around the world to solving your problems in the form of Hyperledger.

Evolving the Blockchain

Hyperledger, as I mentioned earlier, is a blockchain development project created and hosted by the Linux Foundation. Although there are many leading technologists involved from finance, banking, IoT, logistics, manufacturing, and the tech world, no one is in charge, true to the distributed nature of blockchain itself. In the next article, I will explore the limits of Hyperledger for helping you build permissioned blockchains, particularly the difference between Hyperledger Fabric and Hyberledger Composer. Blockchain seems to be still early in the hype cycle, with promises outweighing results. Hyperledger is about to change all that, converting the idea of blockchain from an arcane and futuristic curiosity into a business essential as common as a website.

BY TARA MATAMOROS CARTER

Subscribe to Insights at Tangelo

Accelerate your growth with key industry insights.