Building a Blockchain: What, How, and Why

DevOpsIndustry

Reading Time: 5 minutes

To put it mildly, cryptocurrency is an incredibly popular topic right now. Much of the hype around it tends to be focused on the physical value that these currencies represent. However, I believe something even more precious lies under the hood of cryptocurrencies: the concept of blockchain.

The ideas around blockchain are significant because they’re the engine that enables cryptocurrency to be so secure and cohesive. It’s crucial for us to differentiate their value from the actual data they usually contain, like Bitcoin transactions. Blockchain technology isn’t only for cryptocurrency; cryptocurrency is just what helped it break into the mainstream.

With all of this said, how do we sort through all of the buzz? I believe that by asking three questions, we’ll be able to understand the value of blockchains much more clearly:

  1. What exactly makes up a blockchain?
  2. How would we implement our own version of blockchain?
  3. Is using blockchain right for my company?

Dissecting a Blockchain

At a high level, a blockchain is a series of decentralized databases that are connected to a large, distributed network. Each database contains and generates records known as blocks. These blocks can contain literally anything, but they do have a few constant attributes:

  • An encrypted hash of the previous block
  • A timestamp
  • Payload data, eg, transaction data

Each of these pieces plays a crucial part in making the blockchain unique and secure. Most implementations use the encrypted hash of the previous block and timestamps to check the validity of a new block. No previous block can be modified without the complete change of every other block in the chain.

In other words, every block must be in chronological order and have the previous block referenced to it. Any modification of blocks outside of this wouldn’t be accepted by the blockchain at large.

Another thing that makes this architecture unique is its emphasis on decentralization. This means that an entire blockchain isn’t located on just one main machine or database. Individual blocks are distributed in numerous computers around the world.

In order for someone to maliciously control and alter a blockchain, they would have to control all blocks across all of its networked computers!

While this is certainly possible on smaller blockchains, the probability of achieving total ownership of a blockchain diminishes with each new computer added to the chain.

Reading about all of these higher-level ideas might seem like a satisfactory business pitch, but how would you actually build one from a technical perspective?

Creating a Blockchain

Bitcoin is actually a wonderful place to start on this subject. The entire framework of the cryptocurrency is open source and available online. Looking at Bitcoin’s implementation, we can see a few common themes:

  • We need something to store.
  • We need a distributed network of computers to power the transfer, creation, and verification of blocks.
  • We need a means of incentivizing other computers to join our blockchain.

Stored records

As I mentioned earlier, there’s a difference between a blockchain and the valuable things it stores. There is technical importance around what exactly is stored in each block. Historically, blocks have stored information that has a record-like format. For example, Bitcoin transactions are what Bitcoin’s blockchain stores.

However, one could argue that, due to the open-source nature of blockchain’s design, it could be extended and modified to store anything. We just need to make sure that whatever is being stored within a block can interact with previous copies or iterations of itself. This is why records tend to be the natural choice for storage on a blockchain. They’re unaffected by whatever comes before or after them; they’re simply a recording of something that occurred at a specific time.

Chained computers

Another thing we’ll need is a series of computers to power the entire chain. These computers will need to be constantly connected to each other and actively contributing computing power to the chain.

Many implementations encourage computers to help “mine” or create and verify new blocks as well as store existing ones. However, incentivizing other computers to invest all of this computing power can be tricky.

Participation incentives

This is where mining incentives come in. We need a means for our computing power to not only participate once, but also continue to participate in our blockchain.

The reason that cryptocurrency has been so popular in the past is because they’ve rewarded users with Bitcoin and the like in exchange for helping power various blockchains.

Now that we’ve explored what makes up a blockchain, why would we actually want to build one for ourselves or others? Furthermore, why would we choose this implementation over other solution architectures?

Understanding When to Utilize Blockchain

Blockchains are complex and expensive pieces of technology to build and maintain. They require a lot of computing power and the willing participation of networked computers. So, it’s safe to assume that they aren’t a solution for every problem we may have.

Public record

Furthermore, companies must ask themselves whether they want the information stored in the blockchain to be of public record or of private record. Depending on the answer, you would either have a public or private blockchain.

Both have their pros and cons, though it’s worth noting that the blockchain was designed from the public point of view, so private ones are somewhat new.

Public blockchains are chains that have a focus on incentivizing and enlisting the general public into joining their mining pools. They must not only have something valuable to the public at large, but also a valuable means to incentivize folks to help power it (again, why cryptocurrencies are so popular).

Private record

On the other hand, private blockchains are private networks that power decentralized databases. These chains are able to store information in a private and somewhat secure matter (since not everyone can join), but they increase the effort it takes to compromise a data set by quite a bit. It might be useful to store confidential transaction data, secure plans, or even simple assets like movies on these chains. These private blockchains might be able to prevent things like massive hacks of major companies in the future.

Both of these approaches come at different costs. You’ll be spending extra computing power and storage to simply verify and create the means for storing this information. Sure, technologies and methodologies for each of these aspects are getting better constantly, but whenever you jump into developing a blockchain, you’ll be committing to the current specs of the technology you’re using.

Its really important to ensure that the information you’re storing is valuable and worth putting all this effort into scattering and securing. Financial data makes a lot of sense — like many things we exchange, it has a value, and we often accumulate it privately. Yet, it would be quite costly if I just stored something like random cooking notes on a blockchain.

The computing costs are pretty high to secure pieces of information that aren’t really the valuable.

Wrapping Up

At the end of the day, the ideas behind cryptocurrency and the blockchain are very interesting. It’s just really difficult to see them at the moment because of the massive amount of attention around the value of cryptocurrency right now. If we can see through the hype and find the right use case, implementing a blockchain may very well change how many core technologies are structured and created.

Subscribe via Email

Over 60,000 people from companies like Netflix, Apple, Spotify and O'Reilly are reading our articles.
Subscribe to receive a weekly newsletter with articles around Continuous Integration, Docker, and software development best practices.



We promise that we won't spam you. You can unsubscribe any time.

Join the Discussion

Leave us some comments on what you think about this topic or if you like to add something.