The anatomy of Blockchain

In plain(ish) english.

In a previous article, I outlined the rise of Blockchain and how it went from the obscure tech that backed Bitcoin to being considered as an answer for some of the greatest modern questions in technology.

But what is Blockchain? And how does it provide the security and permanent storage that’s been promised? Let’s take a dive into what exactly makes a blockchain function starting with a basic transaction, apply it to a block, and build up from there…


The basic principle of a blockchain is storing transactions. For simplicity, the examples I will use follow monetary exchanges between people but can also be applied to more complex scenarios such as real estate purchases or keeping a medical history.

When we think about a transaction between two people, we generally think about it like this —

Person A give money to Person B

Which is a fine way to do it if you deal exclusively in person and in cash, but in general, most exchanges today happen electronically and via our banks.

Person A gives Person B money via their bank

When I’m paying for goods or services I pay through my bank who in turn follows certain rules and conditions before transmitting money:

  1. Check that I have enough money to pay for the goods
  2. I have authorized the transfer
  3. The destination account is valid

The bank determines if this is a valid transfer and creates a new item in their own centralized ledger (more on this later), which tracks all transactions of incoming and outgoing money as more transactions are made.

Now that we have a baseline of transactions, let’s talk about how we can keep a ledger on a blockchain.

The Block

The block is the core of the blockchain and is where we will keep transactions for our ledger. You can think of each block as a page out of the ledger book you would have at your bank.

The structure of a block can vary, but in general, it consists of this handful of properties:

  • Header
    Has identifying information about the block and where it is in the chain. This information includes the hash of the previous block, a time stamp, and a arbitrary value that may be used once, or the nonce
    - The previous hash is what ties the blocks together to form the chain. It is how we know for a fact the sequence in which the blocks are ordered and is used when calculating the new hash for the current block. In essence, the previous hash is the summation of all the blocks leading up to the new one.
    - We’ll explore the nonce more in-depth in the mining section, but for now, let’s just say the nonce is needed in order for the block to be accepted into the chain.
  • Data 
    Our ledger will contain all the transactions that have occurred since the last block was committed to the chain.
  • Merkle Root result 
    A Merkle Tree Hash is run against all the transactions for this block. The root hash is saved to the block and is a way to verify the integrity of the transaction data should it ever come into question. 
    - In a contested scenario you would simply run the Merkle hash against the transactions again and compare it against the stored result in the block. If even the slightest change has been made, the resulting hash will be completely different and invalidate the transaction list.

Mining the block

We have our block, we’ve added our transaction to a list of potentially many other transactions and hashed it out. Now we want to commit the block to the blockchain. But how do we do it?

In order to submit a block, a complex hash problem needs to be completed before being accepted. This problem takes the various inputs from the block and puts them through a hash function to generate a 32-bit string. This result is very difficult to calculate and will go into more detail why in the Show your work section, but for now, let’s say it’s tough and requires a lot of specialized hardware and software to effectively complete. When the answer is found, it is assigned to the block as the digital fingerprint of the block and the block is added to the chain.

This is called mining the block and is done in competition with the other nodes of the blockchain network. These computation heavy nodes are called miners and they work to be the first to find that answer, because the miner that finds the answer, gets a reward.

Showing your work. 
Remember in the header section, the nonce is a required value of the block header? This is where it comes into play. In order to commit to the chain, the hash generated from mining the block must fall below a target value set by the chain. This wouldn’t be possible if my hash was solely composed of the Merkle root, timestamp, and previous hash because there’s no way to control whether the result falls within the range or not. We, therefore, must introduce a flex variable, the nonce. A nonce is a 32-bit number that when introduced to the hash input will change the result. Since we as the miners are in control of the nonce we can change the value until the resulting hash has met the target requirement.

There is no way to predict what the correct nonce value would be other than trial and error with the block values. This, as a result, requires an incredibly large amount of computing power to go through and test potentially 2 billion values. [Nonce values can range from 0 to 2³²]

To add further complexity, a chain can change the target value. The more preset leading spaces (ie. the first 7 character of the hash must be 0’s) the more complex it will be to resolve the nonce.

When the nonce value is correctly identified it is put out to the other nodes to validate and accept the block into the chain. This is also known as the Proof of Work.

The Blockchain

We’ve done it, our transaction has been permanently stored in the blockchain ledger. At this point, let discuss what the blockchain network looks like.

I’ve mentioned a couple times, there are nodes participating in the blockchain network. Each node is independent of the other nodes and contains a full copy of the blockchain. Whenever a node reports a transaction, it is broadcast across the node network for the other members to use and compute the next block.

Person A broadcasts to the node network he’s paying B

You might be wondering, what is the incentive for the nodes to participate in the network? Remember, I also said nodes compete with each other. When a node is mining the current block, it is trying to find the nonce before the rest of the network. This is because the first node that correctly reports a valid nonce is rewarded. In the Bitcoin network, the node is given Bitcoin, the Ethereum network has Ether, and other networks could have their own reward system established.

The distributed network 
Herein lies the beauty of the blockchain network. I as a node am incentivized to participate in the mining process, collect a reward, and maintain an accurate ledger while keeping the other nodes honest.

If there is ever a dispute about the accuracy of a node’s ledger, we need only ask the other nodes in the network for their ledgers and the 51% majority answer is the authority.

Disputed claims needs a 51% majority to identify the correct blocks.

To revisit our banking model, we spoke about it being based on a centralized authority. If there is a breakdown in the banking network or it is somehow corrupted, that’s it, game over and trust in the system is very hard to get back. With a distributed network, each node is independently maintained and authority is democratically spread across all the nodes. In fact, to corrupt this network, you would have to have more computing power than virtually all the other combined nodes and re-mine the corrupt blocks to gain controlling authority of the blockchain. At that point, one must really question whether they’re willing to risk getting caught corrupting the network, or put those same (expensive) resources into mining blocks properly and collect the legitimate reward.

Public vs Private Blockchain

The final piece of the puzzle is the concept of a public or private blockchain.

In a public blockchain, anyone who wants to participate in the network only need request to be part of it and you’re accepted. As we discussed earlier data is replicated and maintained independently so authority is determined by a democratic vote. As such, there is no logical point of attack. This is how we guarantee the ledgers integrity.

Your drawbacks come from the level of infrastructure required to have a viable blockchain. While you technically only need three participants, the strength of the blockchain comes from many participants acting as validation nodes. The more nodes, the more secure the chain is. So there is a heavy reliance on the community of nodes to be present and maintain their compute power. This can be expensive.

In a private blockchain, we have a network in which we control the hardware and cost associated with running the nodes. We also control who can participate in the network. This means we know all of the entities participating which is especially good for industries that are heavily regulated or even companies that are apprehensive about how their data is stored.

The major drawbacks here are you don’t have that massive node participation that provides unbiased immutable validation from several thousands of nodes and therefore losing one of the great benefits of using blockchain. You essentially have a database at this point.

So there we have it, from transaction to chain. Block models can vary from implementation to implementation but the general idea and goals are the same. Producing a decentralized, secure and immutable way to store transactions.

Happy Mining!