How to set up a private ethereum blockchain using open-source tools and a
look at some markets and industries where blockchain technologies can add value.

In Part I, I spent quite a bit of time exploring cryptocurrency
and the mechanism that makes it possible: the blockchain. I covered details
on how the blockchain works and why it is so secure and
powerful. In this second part, I describe how to set up and configure your very own
private ethereum blockchain using open-source tools. I also look
at where this technology can bring some value or help redefine how people
transact across a more open web.

Setting Up Your Very Own Private Blockchain Network

In this section, I explore the mechanics of an ethereum-based
blockchain network—specifically, how to create a private ethereum
blockchain, a private network to host and share this blockchain,
an account, and then how to do some interesting things with the
blockchain.

What is ethereum, again? Ethereum is an open-source and public blockchain
platform featuring smart contract (that is, scripting) functionality. It
is similar to bitcoin but differs in that it extends beyond monetary
transactions.

Smart contracts are written in programming languages, such as Solidity
(similar to C and JavaScript), Serpent (similar to Python), LLL (a
Lisp-like language) and Mutan (Go-based). Smart contracts are compiled
into EVM (see below) bytecode and deployed across the ethereum blockchain
for execution. Smart contracts help in the exchange of money, property,
shares or anything of value, and it does so in a transparent and conflict-free
way avoiding the traditional middleman.

If you recall from Part I, a typical layout for any
blockchain is one where all nodes are connected to every other node,
creating a mesh. In the world of ethereum, these nodes are referred
to as Ethereum Virtual Machines (EVMs), and each EVM will host a copy
of the entire blockchain. Each EVM also will compete to mine the next
block or validate a transaction. Once the new block is appended to the
blockchain, the updates are propagated to the entire network, so that
each node is synchronized.

In order to become an EVM node on an ethereum network, you'll need to
download and install the proper software. To accomplish this, you'll
be using Geth (Go Ethereum). Geth is the official Go implementation
of the ethereum protocol. It is one of three such implementations;
the other two are written in C++ and Python. These open-source software
packages are licensed under the GNU Lesser General Public License (LGPL)
version 3. The standalone Geth client packages for all
supported operating systems and architectures, including Linux, are available
here. The source code for
the package is hosted on GitHub.

Geth is a command-line interface (CLI) tool that's used to communicate
with the ethereum network. It's designed to act as a link between your
computer and all other nodes across the ethereum network. When a block
is being mined by another node on the network, your Geth installation
will be notified of the update and then pass the information along to
update your local copy of the blockchain. With the Geth utility, you'll
be able to mine ether (similar to bitcoin but the cryptocurrency
of the ethereum network), transfer funds between two addresses, create
smart contracts and more.

Download and Installation

In my examples here, I'm configuring this ethereum blockchain on the
latest LTS release of Ubuntu. Note that the tools themselves are
not restricted to this distribution or release.

Downloading and Installing the Binary from the Project Website

Download the latest stable release, extract it and copy it to a proper
directory:

Getting Started

Here is the thing, you don't have any ether to start with. With that in
mind, let's limit this deployment to a "private" blockchain network
that will sort of run as a development or staging version of the main
ethereum network. From a functionality standpoint, this private network
will be identical to the main blockchain, with the exception that all
transactions and smart contracts deployed on this network will be
accessible only to the nodes connected in this private network. Geth will
aid in this private or "testnet" setup. Using the tool, you'll
be able to do everything the ethereum platform advertises, without
needing real ether.

Remember, the blockchain is nothing more than a digital and public
ledger preserving transactions in their chronological order. When
new transactions are verified and configured into a block, the block
is then appended to the chain, which is then distributed across the
network. Every node on that network will update its local copy of
the chain to the latest copy. But you need to start from some point—a
beginning or a genesis. Every blockchain starts with a genesis block,
that is, a block "zero" or the very first block of the chain. It
will be the only block without a predecessor. To create
your private blockchain, you need to create this genesis block. To
do this, you need to create a custom genesis file and then tell Geth
to use that file to create your own genesis block.

Create a directory path to host all of your ethereum-related data and
configurations and change into the config subdirectory:

$ mkdir ~/eth-evm
$ cd ~/eth-evm
$ mkdir config data
$ cd config

Open your preferred text editor and save the following contents to a
file named Genesis.json in that same directory:

This is what your genesis file will look like. This simple JSON-formatted
string describes the following:

config — this block defines the settings for your custom chain.

chainId — this identifies your Blockchain, and because the
main ethereum network has its own, you need to configure your own unique
value for your private chain.

homesteadBlock — defines the version and protocol of the
ethereum platform.

eip155Block / eip158Block — these fields add support for
non-backward-compatible protocol changes to the Homestead version used. For
the purposes of this example, you won't be leveraging these, so they are set
to "0".

difficulty — this value controls block generation time of
the blockchain. The higher the value, the more calculations a miner must
perform to discover a valid block. Because this example is simply deploying a
test network, let's keep this value low to reduce wait times.

gasLimit — gas is ethereum's fuel spent during
transactions. As you do not want to be limited in your tests, keep this value
high.

alloc — this section prefunds accounts, but because you'll
be mining your ether locally, you don't need this option.

Now it's time to instantiate the data directory. Open a terminal
window, and assuming you have the Geth binary installed and that it's
accessible via your working path, type the following:

The command will need to reference a working data directory
to store your private chain data. Here, I have specified
eth-evm/data/PrivateBlockchain subdirectories in my home
directory. You'll also need to tell the utility to initialize using
your genesis file.

This command populates your data directory with a tree of
subdirectories and files:

Notice the use of the new parameter, networkid. This
networkid helps
ensure the privacy of your network. Any number can be used here. I
have decided to use 9999. Note that other peers joining your network
will need to use the same ID.

Your private network is now live! Remember, every time you need to access
your private blockchain, you will need to use these last two
commands with the exact same parameters (the Geth tool will not remember
it for you):

Configuring a User Account

So, now that your private blockchain network is up and running, you can
start interacting with it. But in order to do so, you need to attach
to the running Geth process. Open a second terminal window. The
following command will attach to the instance running in the first
terminal window and bring you to a JavaScript console:

Remember this string. You'll need it shortly. If
you forget this hexadecimal string, you can reprint it to the console
by typing:

> eth.coinbase
"0x92619f0bf91c9a786b8e7570cc538995b163652d"

Check your ether balance by typing the following script:

> eth.getBalance("0x92619f0bf91c9a786b8e7570cc538995b163652d")
0

Here's another way to check your balance without needing to type
the entire hexadecimal string:

> eth.getBalance(eth.coinbase)
0

Mining

Doing real mining in the main ethereum blockchain requires some very
specialized hardware, such as dedicated Graphics Processing Units (GPU),
like the ones found on the high-end graphics cards mentioned in Part I.
However, since you're mining for blocks on a private chain
with a low difficulty level, you can do without that requirement. To
begin mining, run the following script on the JavaScript console:

> miner.start()
null

Updates in the First Terminal Window

You'll observe mining activity in the output logs displayed in the
first terminal window:

Remember, this is fake ether, so don't open that bottle of champagne,
yet. You are unable to use this ether in the main ethereum network.

To stop the miner, invoke the following script:

> miner.stop()
true

Well, you did it. You created your own private blockchain and mined some ether.

Who Will Benefit from This Technology Today and in the Future?

Although the blockchain originally was developed around cryptocurrency
(more specifically, bitcoin), its uses don't end there. Today,
it may seem like that's the case, but there are untapped industries and
markets where blockchain technologies can redefine how transactions
are processed. The following are some examples that come to mind.

Improving Smart Contracts

Ethereum, the same open-source blockchain project deployed
earlier, already is doing the whole smart-contract thing, but the
idea is still in its infancy, and as it matures, it will evolve to meet
consumer demands. There's plenty of room for growth in this
area. It probably and eventually will creep into governance of companies
(such as verifying digital assets, equity and so on), trading stocks,
handling intellectual property and managing property
ownership, such as land title registration.

Enabling Market Places and Shared Economies

Think of eBay but refocused to be peer-to-peer. This would mean no
more transaction fees, but it also will emphasize the importance of your
personal reputation, since there will be no single body governing the
market in which goods or services are being traded or exchanged.

Crowdfunding

Following in the same direction as my previous remarks about a decentralized
marketplace, there also are opportunities for individuals or
companies to raise the capital necessary to help "kickstart" their
initiatives. Think of a more open and global Kickstarter or GoFundMe.

Multimedia Sharing or Hosting

A peer-to-peer network for aspiring or established musicians
definitely could go a long way here—one where the content will reach
its intended audiences directly and also avoid those hefty royalty costs paid
out to the studios, record labels and content distributors. The same
applies to video and image content.

File Storage and Data Management

By enabling a global peer-to-peer network, blockchain technology
takes cloud computing to a whole new level. As the technology continues
to push itself into existing cloud service markets, it will challenge
traditional vendors, including Amazon AWS and even Dropbox and
others—and it will do so at a fraction of the price. For example, cold
storage data offerings are a multi-hundred billion dollar market today. By
distributing your encrypted archives across a global and decentralized
network, the need to maintain local data-center equipment by a single
entity is reduced significantly.

Social media and how your posted content is managed would change under
this model as well. Under the blockchain, Facebook or Twitter or anyone
else cannot lay claim to what you choose to share.

Another added benefit to leveraging blockchain here is making use of
the cryptography securing your valuable data from getting hacked or lost.

Internet of Things

What is the Internet of Things (IoT)? It is a broad term describing the
networked management of very specific electronic devices, which include
heating and cooling thermostats, lights, garage doors and more. Using
a combination of software, sensors and networking facilities, people can
easily enable an environment where they can automate and monitor home
and/or business equipment.

Supply Chain Audits

With a distributed public ledger made available to consumers,
retailers can't falsify claims made against their products.
Consumers will have the ability to verify their sources, be it food,
jewelry or anything else.

Identity Management

There isn't much to explain here. The threat is very real. Identity
theft never takes a day off. The dated user name/password systems of today
have run their course, and it's about time that existing authentication
frameworks leverage the cryptographic capabilities offered by the
blockchain.

Summary

This revolutionary technology has enabled organizations in ways that
weren't possible a decade ago. Its possibilities are enormous, and it
seems that any industry dealing with some sort of transaction-based
model will be disrupted by the technology. It's only a matter of time
until it happens.

Now, what will the future for blockchain look like? At this stage, it's
difficult to say. One thing is for certain though;
large companies, such as IBM, are investing big into the technology
and building their own blockchain infrastructure that can be sold to
and used by corporate enterprises and financial institutions. This
may create some issues, however. As these large companies build their
blockchain infrastructures, they will file for patents to protect their
technologies. And with those patents in their arsenal, there exists the
possibility that they may move aggressively against the competition in
an attempt to discredit them and their value.