Interested in a private blockchain implementation guide?
You’ve come to the right place.
Private Blockchain Implementation
Before delving into private blockchain implementation, let‘s first understand why businesses need private blockchain.
1. Businesses have sensitive information that can’t be shared with just anyone. Therefore a public permissionless blockchain solution is not appropriate because it will divulge confidential information to anyone who wishes to access it.
Businesses require that only trusted entities can access their data, hence a private blockchain solution is required.
2. Lack of scalability and low transaction throughput in public blockchains like Bitcoin or Ethereum is a known issue.
This happens because most blockchain networks like Bitcoin use the ’proof of work‘ (POW) consensus algorithm, and it requires the participation of all nodes on the network in transaction validation.
The POW algorithm also requires the miners, i.e. the transaction validators using special hardware, to solve increasingly complex cryptographic puzzles for transaction validation and creation of each new block. This impacts scalability and transaction throughput adversely the more blocks that are created.
Most big businesses require processing speeds in excess of over 1,000 transactions per second and also need high scalability and transaction throughput.
The development community realizes the increasing importance of the private blockchain and is increasingly focusing its attention on developing new solutions.
Hire expert developers for your next project
To help give you a good idea of the process of creating a private blockchain, I will show you how to build a private blockchain network using the Ethereum platform.
However, if you aren’t well-versed in this field, it’s best to hire expert blockchain developers and be sure that the project development process goes smoothly.
Install tools for creating a private Ethereum blockchain:
To create an Ethereum Virtual Machine (EVM), i.e. a node on the Ethereum network, developers need to download a copy of the Ethereum blockchain.
The following tools can be used for this:
- Geth: This is the ’Go’ language for Ethereum blockchain implementation. Considering most developers have some web development background, this is a good tool to start with.
- Eth: It‘s the C++ client for Ethereum, and is good for developers that are also interested in mining
- Pyethapp: This is the Ethereum client for use with Python. Developers that want to learn Ethereum for academic purposes find this a very useful tool.
In this guide, I will use Geth to create our Ethereum private blockchain project.
Mac OS developers can use this installation guide, and it requires installing Homebrew.
Create the ’Genesis block‘ of the Ethereum private blockchain:
Developers can use Geth to access the Ethereum blockchain, this required that they buy some Ether, i.e. the native cryptocurrency of the Ethereum network.
Since I want to focus on the process of implementing a private blockchain, I will use dummy Ether.
A blockchain is a decentralized network where each of the computers on the network, called ’nodes’, maintains a distributed database in a shared manner.
The first block record is called the ’Genesis block’. Every block after this will be built on top of this first block in sequence. They all contain a cryptographic hash reference to the previous block. So the 2nd block will contain a reference to the genesis block, while the 3rd block will refer to the hash of the 2nd block, and so on.
To create the genesis block of the private blockchain, developers must set up a genesis file using a text editor, which is a ’.json‘ file with the required configuration parameters described below:
- ’chainId‘: A unique identifier of the new private blockchain;
- ’homesteadBlock‘: Homestead is the first production release of Ethereum and since the developers are already using this version the value of this parameter can be left as ’0‘.
- ’Eip155Block/eip158Block‘: A few Ethereum Improvement Proposals (EIPs) were implemented to release Homestead, and required a hard fork. In a private blockchain development project such as this one hard forks aren‘t needed, hence the parameter value should be left as ’0‘.
- ’Difficulty‘: In the Bitcoin network, miners solve an asymmetric cryptographic puzzle to mine new blocks. Over time the puzzle becomes easier, resulting in it eventually taking less than 10 minutes for each new block generation. Hence, the community updates the puzzle every 14 days and makes it more difficult, thus requiring even more computing power to handle the POW algorithm. The ’difficulty‘ parameter controls the complexity of the cryptographic puzzle. This parameter is also used in the Ethereum blockchain as well. Developers should assign a low value (between 0-10,000) to this parameter for this project thus enabling quicker mining.
- ’gasLimit‘: If a transaction exceeds this limit then it won‘t execute in the Ethereum blockchain, hence, the developers should set a high value to this parameter for this project.
- ’alloc’: This parameter allows allocation of Ethers to a specific address, and isn’t used for this project since the developers will mine dummy Ethers.
Note: The low difficulty level is the precise difference between the dummy Ether used in this project and the real Bitcoin or Ether. Like the dummy Ether, real cryptocurrencies are also mathematical money and aren’t backed by any tangible asset.
However, the difficulty level in the case of the real Bitcoin or Ether is very high, requiring very powerful computers and massive electrical energy to run them. This has already made crypto mining an industrial-scale operation that is intensely competitive.
Along with the speculation aspect of the crypto market, this industrial-scale economic activity contributes to the high value of the real Bitcoin or Ether.
Developers should store the genesis file in a folder on their computers. Developers should run specific Geth commands from the command prompt, which processes their genesis file and creates the genesis block.
This Hackernoon article specifies the commands for this and all other operations.
Create a private network for the new blockchain:
Developers will now need to create a private network on the blockchain for which they have created the genesis block. This will allow the developers to mine new blocks as and when required.
Developers now need to run the prescribed command on their terminal, specifying the path to their data directory and their chosen network identifier. This enables Geth to start a private blockchain network with details from the developers‘ directory.
Hire expert developers for your next project
1,200 top developers
us since 2016
Now is the time to choose a network identifier of your own. This is important as it prevents others from connecting to the network.
Developers should ensure that Geth doesn‘t ’remember‘ the parameters of their private blockchain network. They need to run two prescribed commands from their terminal in the exact order prescribed in the reference article to achieve this.
This step is needed every time developers access their private blockchain, hence they should save these two commands in their project documentation.
Create an ’Externally Owned Account‘ (EOA):
There are two types of accounts in the Ethereum blockchain:
- EOAs: owned by persons who join the network;
- Contract accounts: These contain smart contracts.
For this project, the developers need to create an EOA. With the first instance of their terminal already open and running, they need to open a second instance and enter the prescribed command for connecting the second instance to the first one.
Mine blocks to create Ether in the new Ethereum private blockchain:
Developers can invoke the prescribed commands from their terminal to mine blocks, and this will quickly result in their account balance soaring with dummy Ethers, thanks to the low difficulty level specified in the genesis block.
They can check the progress of the mining and the account balance from the other Geth instance using the prescribed commands, and finally, they can stop the miner script.
Now that they are running a private blockchain using the Ethereum protocol, our developers can proceed with writing smart contracts and developing distributed apps (DApps).
If the developers need to refresh their skills, we recommend the following resources:
- The Ethereum development tutorial;
- This online course for Solidity, i.e. the proprietary language of Ethereum for coding smart contracts;
- The dapps for beginners website for guidance on DApp development.
Examples of private blockchains and their distinguishing characteristics:
The technology giants and other companies have clearly recognized that businesses need private blockchains capable of supporting enterprise operations to realize the efficiency and transparency that this exciting new technology promises.
Multiple projects to build private blockchains are already underway. Here are some examples:
Quorum: JPMorgan Chase & Co, the American investment bank and financial services giant has developed this private blockchain by forking the Ethereum codebase. It’s suitable for the financial services industry and has incorporated many of the defining features of Ethereum including distributed ledger technology and smart contracts.
In a standard Ethereum blockchain, every node is able to view all the information and data contained on the blockchain. This solution is not suitable for the financial services industry, and Quorum has addressed this by moving some data off-chain.
The constellation protocol used in Quorum allows one node to send encrypted messages to another.
The cryptographic hash of the node-to-node encrypted transaction is stored in the blockchain; however, transactions are stored off-chain. Storing the hash on-chain allows validation of the transaction data. Since transaction data itself can‘t be reconstructed from a cryptographic hash, unauthorized parties can‘t view the transactions.
Hyperledger Fabric: The Hyperledger consortium has built this enterprise blockchain. This blockchain uses a few Ethereum concepts like smart contracts, but it isn‘t a permissionless public blockchain.
This blockchain platform was built for business enterprises and is designed to be ubiquitous and not just confined to any one industry. The nodes joining this network must follow the identity management process of the enterprise that uses it, i.e. the nodes should be trusted by the enterprise.
The platform uses container technology for hosting smart contracts. Nodes are categorized according to the roles of the organization, and the access level of the nodes varies accordingly.
Hire expert developers for your next project
Fabric doesn‘t use the POW consensus algorithm. The entire network consensus mechanism is driven by the transaction flow.
There are different roles taking part in the consensus mechanism, and these are the following:
- ’Client‘: This node creates and invokes a transaction;
- ’Orderer‘: This node provides updates to the transaction;
- ’Peer‘: It receives the updates from the orderer and maintains the distributed ledger, including committing the transaction in the ledger;
- ’Endorser‘: This is a specific type of peer, which checks the transaction validity including signature information, and endorses it for the other peers to record in the ledger.
The Hyperledger consortium is a group consisting of several members including businesses and academia, working to bring innovation to the enterprise blockchain space. The Linux Foundation leads it, while other members include IBM, Intel, SAP, CISCO, Daimler, and American Express.
The group has several other Enterprise blockchain projects at different stages of maturity and development, e.g. ’Sawtooth‘, ’Indy‘, ’Burrow‘, and ’Iroha‘.
R3 Corda: This is an enterprise blockchain platform built by R3. This is a platform specifically built for the highly regulated financial services industry.
This is a permissioned blockchain, and the nodes have accesses modeled after how organizations have different roles.
The distinguishing attribute of Corda is how its smart contracts are coded. As with smart contracts on other blockchain platforms, these also allow the execution of legal-like functions such as taking control of an entity when certain conditions are fulfilled.
However, the smart contract codes in Corda have specific legal phrases and expressions. This is important to give the required legitimacy they need in an industry operating under the stringent regulatory framework.
Note: This is also a pioneering effort toward increased adoption of smart contracts because while the traditional contracts have been around for a long time, smart contracts are relatively new, and there are gaps in how they are structured. If the smart contracts have the necessary legal expressions then that could serve as a template to bridge this gap in the future.
The consensus mechanism in Corda requires transaction validity and uniqueness. Its smart contracts ensure validity. If any of the input states of the transaction in question hasn’t been used by any other transaction, then the transaction is unique.
Critical success factors for the enterprise blockchains:
A project to implement a private blockchain needs to adequately focus on the following critical success factors:
- Performance and scale: Enterprises need blockchains that can deliver high transaction throughput. A real-world model for any growing business would see an increasing number of nodes, and therefore require the blockchain to be scalable.
- Resilience: Built-in redundancy, automated monitoring, recovery, etc. are important for the enterprise blockchain.
- Security and confidentiality: Proprietary information of the enterprise should be seen only by the people with a need to know.
- Supportability: Hardening of the underlying network components and infrastructure is important.
- Integration: Enterprise blockchains will invariably interact with the ’systems of record‘ (SORs) of the company, and appropriate integration measures such as application programming interfaces (APIs) are needed.
Planning to Build a Private Blockchain Network?
Blockchain technology is new and evolving. You will require skilled blockchain developers to implement a private blockchain network successfully.
If you do not find blockchain developers with the required skillset in your project team, we would advise you to partner with a reputed software development company.
DevTeam.Space can help you with private blockchain development via its field-expert blockchain developers community. Write to us your blockchain project specifications via this quick form, and one of our technical managers will get back to you for further details.
Frequently Asked Questions
Private blockchains are invite-only blockchains that can have a single controlling entity.
A private blockchain is an invite-only blockchain that means that who as well as what they see can be controlled by a single authority. A public blockchain network such as bitcoin can be used by anyone and is not controlled by any one individual or company.
Provided that the blockchain has been secured in the same way and with bug-free code, a private blockchain does offer more security as the users which get to access the data can be controlled.