You are currently viewing Private Blockchain – How to Build & Implement

Private Blockchain – How to Build & Implement

Table of Content

  1. Introduction
  2. Types of Chains
    1. What Is A Public Blockchain
    2. What Is A Private Blockchain
    3. What Is A Permissioned Blockchain
  3. Why Pick A Private Blockchain
  4. Ethereum
    1. Why You Should Use Ethereum
    2. Limitations To Private Ethereum Blockchain Development
    3. Techology Stack Recommendations
  5. Building A Private Blockchain
    1. Why Are You Building A Private Chain
    2. Hire The Right Team
    3. Building The Private Chain
    4. Deploy Your First dApp
  6. Use Cases For Blockchain
  7. Conclusion

Introduction

Since the rise of Bitcoin, blockchain technology has seen an exponential evolution in both functionalities and use cases. As blockchain technology has increased, so have the demands to implement it in more areas. This demand has given birth to the shift from Web2 to Web3. More and more companies are exploring the many uses of blockchain and how those applications can solve current business headaches.

In this article, we will explore the various types of blockchains and dive specifically into the use of private blockchain implementations. You will also learn about recommended technology stacks, implementation examples, limitations to a private chain, and examples of how you might use a private chain.

Types of Chains

If you’ve made it this far, I will assume you have pre-existing knowledge of what a private chain is, have been tasked to implement or research one by a business stakeholder within your organization, or are exploring it because it is something you have read or heard about and wanted to learn more.

Regardless of your intentions for pursuing this topic, reviewing the three types of blockchains you can implement is relevant. Our customers have found that they most often have a mistaken idea of what a private chain is or what it does. They find they are approaching the wrong type of chain, could be using a public chain and saving both time and money, or that blockchain doesn’t solve their problem.

What Is A Public Blockchain

To start, we will look at public blockchains. The primary reason for starting with this type of chain is because it will be the chain you probably have the most exposure to. When you think of blockchain, you probably think of Bitcoin or Ethereum, although there are many public chains out there (i.e., Polygon). It is referred to as a public blockchain because everyone can join and participate in the blockchain network. The most common participation activity is buying or selling cryptocurrency, actually writing transactions to the public blockchain, or reviewing transactions for interest or auditing purposes.

Since the transactions on the blockchain, known as a ledger, are public and decentralized (or distributed), it creates a few problems when building your decentralized application (dApp) on a public chain. Specifically, the public chain requires a lot of processing power and lacks any privacy features. Let’s look at these two a bit closer.

The first issue lies in the decentralized aspect of the public blockchain or any chain for that matter. To distribute the ledger, process transactions, and retrieve transactions, the chain needs nodes to run it. The fewer nodes there are the higher likelihood of the chain becoming unavailable if all nodes were to go down and create performance issues. As a result, adding transactions to the chain results in a large amount of processing power due to the cryptographic nature of the blockchain.

To address the issue of node distribution, many public chains will incentivize the public to create and host nodes to contribute to the network. These nodes either reward contributors by minting a new token and assigning it to their wallet, which holds a dollar value, or collecting fees from the end-user, which the system uses to reward the node contributors for completing transaction blocks. This is most popularly known as ‘mining’ and is often the second most popular term associated with blockchain terminology.

The second issue, which is most likely what led you to this article, is privacy. All transactions on the public blockchain are visible to the public. Therefore, applications like banking might not be ideal. Even if you hide user information behind a wallet address, many Machine Learning algorithms can follow everywhere that wallet address is accessed to establish a pattern that leads back to the owner. Once a malicious user identifies a customer on the blockchain, the entirety of their banking history becomes a public record.

Some companies have explored and implemented different cryptography concepts when transacting data to a public chain. While they fix the privacy problem today, you should remember that the chain is immutable, meaning transactions can not be modified or deleted and permanent (assuming the chain never ceases to exist and all nodes go offline). The reason this is important is for the same reason that wallet addresses aren’t as secure as they might seem in protecting a user’s identity. As processing power and data science become more popular and growing at a staggering rate, our current cryptographic methods are just a near cry from being cracked and becoming ineffective at protecting data.

What Is A Private Blockchain

A private blockchain is precisely as the name implies. A business or entity that wants to run a blockchain where only those selected are allowed entry can implement a private blockchain. This form of blockchain requires the user to authenticate each time they wish to interact with the private chain. All activities on the blockchain (mining, consensus, transacting, etc.) are then regulated by the private chain and the authentication method.

Depending on the implementation of your chain, precisely, the nodes that run your chain determine whether or not your chain is genuinely private. Whether by cost or resources, most businesses are limited in how many nodes they can run. This limitation can remove or minimize many of the benefits of blockchain applications that involve decentralization, security, and failover.

What Is A Permissioned Blockchain

The final type of chain we will look at is a permissioned blockchain. This implementation is a hybrid approach of both public and private chains. Users typically join the network through some form of identity verification process. Their access to the network is permission-based, and those permissions control what a user can or can not do. Many businesses are finding ways to implement permissioned-based blockchains while maintaining business privacy policies for employees and customers and satisfying any business regulations required of them.

Applications in banking would prevent customers from seeing each other’s transactions or retailers from seeing the wholesale price their competition pays for the same product from the manufacturer or warehouse. Using such a hybrid approach means it includes all of the privacy of a private blockchain and all of the processing power of the public chain nodes.

Why Pick A Private Blockchain

At this point, you might be asking yourself why you wouldn’t pick a permissioned blockchain implementation for your dApp. You already understand that a public blockchain is riddled with pitfalls when dealing with sensitive data and customer protection. A permissioned blockchain offers many benefits compared to the other types, but the downsides of a permissioned chain are usually the deciding factor for most of our customers.

Because a permissioned chain is on a shared network, it becomes more vulnerable to attacks by malicious users. You will recall from earlier in the article that technology such as Machine Learning is constantly evolving while everything committed to a blockchain is eternal, making it only a matter of time until someone figures out how to bypass the current security protocols and encryption methods.

Suppose your business is in a vertical heavily regulated by industry standards, auditors, government or regional regulations, or other types of requirements. In that case, you will find it is much harder to meet those standards on a permissioned chain. A private chain provides the extra layer of security and protection for the data you store on the blockchain to help pass regulatory requirements. This alone can be the primary driving decision-maker in choosing between the three types of chains.

Finally, there is the control aspect. A private blockchain implementation provides a business with complete control over who can access the chain, what functions they can perform, how dApps are deployed and maintained, and control where nodes are located (geographically).

Ethereum

Chances are you have heard of Ethereum. It is, after all, the second-largest public blockchain behind Bitcoin. Unlike Bitcoin, however, Ethereum is a programmable blockchain. This makes Ethereum more than just a cryptocurrency chain. It allows it to act as a provider for applications (dApps), games, and more. The immutability of the chain, and its resistance to censorship, make it the ideal place to launch your dApp strategically.

Some of the most popular uses of Ethereum are ETH (the cryptocurrency of choice for Ethereum), custom cryptocurrencies (such as Shiba or LITH Token), NFTs, dApps, and DAOs (Decentralized Autonomous Organisations).

Why You Should Use Ethereum

If the above explanation of Ethereum isn’t enough to answer the question, here are a few more reasons why Ethereum is the ideal technology for your private chain. The first, and most important reason, is due to Ethereum Virtual Machines (or EVMs). The virtual machines create an abstraction layer between your dApp and the underlying server. When you develop an application for the Ethereum chain, you are actually coding a smart contract that interacts with the underlying EVM.

Anyone with a bit of server knowledge can download the latest copy of an EVM and deploy it to their server. This is known as creating a node. Nodes can be full copies of the Ethereum chain, partial copies, or fast copies (the list is not exclusive of all types of copies) The more nodes there are, the cheaper the gas fees and the quicker transactions run. Later, you’ll see why EVMs are vital to a private blockchain.

The second reason for using Ethereum is the ability to deploy smart contracts. A smart contract can represent many things, but for the sake of our discussion, we will focus specifically on their ability to be decentralized applications (dApps). Smart contracts are a unique concept to the blockchain, so you will need to be running a chain that supports them. Think of them like a PHP or Ruby file that you deploy to a web server. Ethereum smart contracts are written in Solidity, a language specifically created to develop Ethereum smart contracts.

Finally, and not of any less importance, the created blockchain in 2015. That means it is established, well-known, stable(ish), and has widespread adoption. This benefits users because it increases security, ensures that the technology is constantly evolving to stay up with current trends, and has plenty of resources for development. I can’t stress enough how important it is to pick technologies with a strong community behind them.

Limitations To Private Ethereum Blockchain Development

Although many businesses benefit more from a private blockchain, there are still limitations that you must consider. Creating and deploying a blockchain strategy is an investment of both time and money. All stakeholders within the business need to understand the pros and cons to be successful.

The issue that is most hard to overcome is having an uptime guarantee. Since you are no longer on the public Ethereum blockchain, you lose access to the thousands of nodes that comprise the Ethereum network. Instead, you will be responsible for your own node creation, deployment, and upkeep. The primary reason is the need to keep your chain private, which means you can’t depend on the blockchain community to run nodes without the ability to see the data passing through those nodes. Thus, your uptime is only as guaranteed as the number of nodes you deploy and the reliability of those nodes.

Access management, which I’d consider a sub-issue of partial anonymity, is also a limitation. As a banker, you do not want your customers to see transactions that do not belong to them. You also want to control which employees have what level of access. As of yet, this access must live off-chain. So too are other types of data that aren’t yet ready for blockchain due to functionality or regulatory barriers.

To combat the limitation of data and services that must live off-chain, many solutions are available that help manage this data and create a tight integration between it and the information on your chain. Perhaps the most popular solution is Chainlink, a decentralized oracle network that can be leveraged in conjunction with your smart contracts to provide some resolution to this limitation.

Technology Stack

So you’ve made it this far I’ve done all that I can to educate you on the various types of chains, their strengths and weaknesses, and the underlying technology that you will need to be able to navigate. At this point, I assume you are still set on developing your blockchain solution, or you’re just curious to see what else I have to say.

Either way, the first thing you’ll want to do before building your blockchain is to identify and price your technology stack. This will help with the next section on making your private blockchain as you consider the cost-benefit of the solution, the technology you will need to support, and how your chain will run.

Still basing our approach on the assumption you will be using Ethereum, you’ll need something to create an instance of an EVM. Several software packages are available, each running on its own programming language, but GETH (Go ETH) is the most popular. As you may have guessed, it is written on Go, although your team does not need to know how to program in Go unless you plan to fork the project and make your own modifications.

Keeping in mind that we are giving recommended tech stack suggestions so as not to imply this is the only way, the next item on your procurement list is Infura. Infura will be foundational in helping you to deploy nodes, distribute requests to your various nodes, and provide many other benefits that you’d otherwise have to hire a small army of network engineers to manage. As your solution continues to grow in adoption by the business, the cost to not use Infuria will far outweigh the cost of implementing it upfront.

Since we are deploying smart contracts to Ethereum, there is no other option but to use Solidity programming language. As such, you’ll want to grab the Remix IDE. I have been using the plugin for Visual Code Studio, but it has some room for improvement. Ultimately, I don’t think you can go wrong with either IDE.

Finally, you’ll need an interface to interact with your chain. This could be a website, an intranet, or an application. Two popular choices are to use Python and a package like Flask or Javascript and a package like Node.js or React.js. You will want to also grab either Web3.py or Web3.js, depending on which language you are pursuing, as these libraries are beneficial when interacting with your chain.

There are probably another twenty things you’ll want to look into as a part of your tech stack, such as a Git repository host and a project management system. Still, most of those are optional and outside the scope of this article. World War 3 would pale in comparison to the battles that have raged on topics such as Git, issue tracking, and so forth.

Building A Private Chain

I know what you’re thinking, enough small talk already I promise we will get there but, before we dive straight into the meat and potatoes of this article (I’m a southern guy, what can I say), you need to understand the endeavor you’re about to embark on Let me break this timeline down for you:

  1. You’re first 3-4 weeks will be all administrative and politicking with your management team. You’ve identified how many initial nodes you need, where you’ll host them, what technology stack you’re going to use, and what type of team you’ll need to employ. Your business is going to want, at a minimum, to see the first year cost of implementation and then running of the solution. Any decent business is going to ask for a 5 year plan that shows the cost and the value add, whether that value add is in dollars saved or dollars earned.
  2. The next 2-4 weeks will be in planning out the project, architecting the solution, ensuring you’ve taken into account all of the pitfalls, and making sure your “strike team” fully comprehends what they are building and why. Get ready for a lot of time spent in front of a whiteboard and a lot of opinions on approaching various aspects of the project.
  3. We finally get to the point of building, deploying, and making final configuration adjustments to your private chain. Expect this to take 3-4 weeks.
  4. Ah, but you thought we were done? Now that the chain is deployed, you need to develop, test, and finally deploy your decentralized application (dApp). This could take between 3-6 months, maybe longer if you need to also build a Python or Javascript application to interface with your chain.

Do you still think you’re ready for a 6-12 month project to get your solution in place? If so, that’s fantastic. Let’s dive in.

Why Are You Building A Private Chain

Part of the first 3-4 weeks where you are getting management buy-in will be answering the question, “Why do we need this?” My experience is you have exactly two minutes to get the stakeholder on board or at least bought into learning more, or you’ll risk losing their support. You need to know exactly how this will benefit the business and align those benefits to your companies goals or values.

You don’t want to tell them how cutting edge it is or that it is entirely decentralized and immutable. Your stakeholders are going to want to hear that the solution will increase the security of our data for your customers, build confidence in your company by providing an audit that can never be altered, it will cut down on spending in the Finance department for accounting and bookkeeping, or whatever other business value or problem you can align it with to solve.

This will be the most significant part of your conversations when you bring budgets, hiring plans, and timelines to the business. Be ready for it and be prepared to overcome it.

Hire The Right Team

You need to hire a team now that you’ve got buy-in and money to burn. Your blockchain team will be entirely focused on the solution you are building. You need to trust them to understand your requirements, build them correctly, and perform regression testing on every aspect of the project. Any mistakes can undermine the entire success of the project and nullify the benefits you are seeking to achieve with the implementation.

If you’re looking for a more cost-effective and faster approach to implementation, QuadraByte provides you with experienced team members and flexible project staffing to help deliver your solution quickly, seamlessly, and save you money. A free quote can give you an idea of how much budget you will save using their services, allowing you to apply the leftover budget to other areas you may have had to compromise on during approvals.

Building The Private Chain

Once your team is in place, it is time to build and deploy the chain. Stand up your first EVM node and install GETH. This is a command-line interface, and I have found that most flavors of Linux are the easiest to use, but they’re great support for any organization that chooses to use Windows-based systems. The program has excellent documentation, and you can get the environment turned on in short order.

Once you have your EVM installed, it is time to create your genesis block. This is the very first block in the chain. Using the Ethereum public chain, it would take weeks to sync your genesis block. The machine would start with the first-ever Ethereum block and then rebuild every block from every transaction ever run. Your node, however, will be much faster. Even when adding a new node to a network that is five years old, you’ll not see such significant sync times as it is not expected that you’ll have as many transactions as the public chain. Plus, you will control the difficulty of the chain. Let’s jump to that, as it is a critical component of your genesis file.

The genesis file contains some basic information:

  • chainID – This is a unique identifier for your private chain. This can be any number, but you should ensure you do not pick an identifier that overlaps another. There are a few databases available that will show you the identifiers of all of the running chains, including the Ethereum public chain, to help ensure you pick an ID that is not in use.
  • homesteadBlock – This is the first release of Ethereum. Since you already have this via the EVM, you can set this value to 0.
  • eip155Block/eip158Block – An EIP is an Ethereum Improvement Proposal. It is useful to have an understanding of these, but your private chain can be left at 0.
  • difficulty – This is where we set the complexity behind your hashing. Have you ever wondered why mining is so profitable and new Ethereum tokens are so hard to come by? The reason is this value. The more complex the value, the harder it is to create blocks. This means it takes longer to mine Eth and it takes longer to commit transactions to a block. Set this to 0.
  • gasLimit – This creates an upper limit for executing smart contracts. You can set this arbitrarily high since you are not spending real ETH.
  • alloc – This is a wallet address to store Eth that you mine. When setting up your GETH, you should have logged into the javascript-based console and create a new Account. this account would act as a wallet for you to store Eth.

Wait, why do I need to mine Eth if it has no value? The reason is that you are still using the Ethereum technology, but it is in a closed network. Therefore, you still need ETH to pay the gas fees on the EVM. This doesn’t mean you need thousands of miners to run a chain Fire up your javascript-based console and pass the command to enable mining. Let it run for about five minutes and turn it off. Your wallet should have thousands of ETH tokens in it. When it runs low, repeat the process. Since your difficulty setting is at 0, it requires minimal effort for your node to mine new blocks.

Once all of that is done, you’ll want to perform your final configurations. Make sure your firewall is in place, deploy a few starter notes in decentralized locations, and integrate your nodes with Infura. Once you have this in place, you can “flip the switch,” and you’ll have a fully functional blockchain.

Deploy Your First dApp

Now that you have a blockchain running, you need to interact with it. This is where dApps come in. While your node team was setting up your first few nodes and finalizing the configuration, your blockchain and your programming teams should have been working on a project plan for building and deploying your application.

This will be the focus of your most significant efforts and the source of your biggest headaches. If you keep with it, however, you’ll finally reach the day where you can deploy your application to the chain Congratulations, you have now implemented a blockchain solution for your company, and you are well on your way to having a business-supporting blockchain strategy.

Once all of the work is done, you’ll want to start thinking about how you will handle future development immediately. Nothing is more harmful to a blockchain solution than the first bug that pops up. You cannot implement and test a fix without impacting the production chain. To better understand what you’ll need, look up Ropsten and its relation to Ethereum. Once you understand the concept of a test network, it is a straightforward process to stand up a few test nodes for future development tasks.

Use Cases For Blockchain

If you made it this far and are still unsure how blockchain can benefit your business, I’ve included a list of some use cases for you to review. This is not an exhaustive list and is provided to help fuel your creative juices.

  • International Payments – The security inherent to blockchain through tamper-proof logging of financial activity makes it an ideal solution for international financing.
  • Capital Markets – Blockchain benefits capital markets through faster clearing and settlement, consolidated audit trails, and operational improvements.
  • P2P Transactions – Create more trust with your partners by moving all of your business transactions with them to the blockchain.
  • Healthcare – While you would want to use a solution like Chainlink to store data that would identify your patients, all other health data becomes ideal candidates for the blockchain. Demographic data such as gender and age, immunization records, a history of vital signs, and more. Your patients no longer have to worry about lost medical records and providers no longer have to worry about incomplete medical history.
  • Regulation Auditing – Since the blockchain is immutable, it makes it the ideal place to store data that must follow strict audit guidelines.
  • Insurance – This is perhaps the most widespead implementation of private blockchain application today. Moving claims to the blockchain creates transparency in the claim process, eliminates invalid claims, and would help prevent fraud through multiple claims on the same event.
  • Supply Chain Management – Keep a real-time eye on your supply chain as your products move from entity to entity.
  • Real Estate – The average homeowner will sell their home every five to seven years and the average human in the U.S. moves a total of 12 times in their lifetime. Real Estate blockchain would help in verifying financial due diligence for underwriters, reduce fraud, and creates a transparency layer between the buyer and seller.
  • Voting – No explanation is needed here. This would prevent voters from voting more than once, and would ensure that votes could not be tampered with.l
  • Taxes – Again, this is a straightforward implementation. Taxes, and even accounting, benefit from the immutability of the blockchain.

I could go on for days listing out uses for the compliance oversight, IoT devices, KYC validation, reporting, and more If you have a business need you are trying to solve and think that blockchain is the solution, let QuadraByte provide you with a free quote and guidance.

Conclusion

I hope that you can step away from this, having learned the value and benefits of implementing a blockchain solution within your business. As the adoption of the technology becomes more widespread, we can expect to see further advances in decentralized applications. I still remember both the dot-com boom of the Web and the shift to a more social-driven web with Web2. The advances we have made, and the potential behind blockchain, promises to make the shift to Web3 something amazing to witness.

Does your organization need a blockchain strategy but is unsure where to start? Our team of experts at Quadrabyte has the experience and care to help define, design, build, and deploy a strategy that will help grow your business. Reach out to our team of solution engineers at QuadraByte and get your free quote.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.