Blockchain — A visual explanation

Alexander Lee
5 min readJun 15, 2017

--

These past few months, I’ve taken a break from web development applications like React and Phoenix. Don’t get me wrong, I still code everyday at work but what I do on my free time has taken a turn of events. I was chatting with a fellow Flatiron alumni about what he was working on and he mentioned words like Ethereum, EVM, blockchain, bitcoin, Solidity, etc. What he was trying to explain over Slack made no sense at all and honestly I really didn’t care too much about it. However, the more we talked…the more intrigued I got…. which led me to start watching videos and reading articles.

I won’t really go over what problem bitcoin/alt coins try to solve. There are plenty of articles on medium that can go over that. You can refer to the links below.

https://medium.com/@Magnr/centralized-vs-decentralized-banking-5c2a657e94b7

From a high level perspective, we used a middle man to handle our transactions from point A to point B. Usually this middle man is a institution like a bank. A decentralized system however will confirm transactions via peer to peer blocks. It will not just be one entity of blocks confirming the transaction, but a multitude of entities with the same copy of blocks confirming that transaction. In other words, if one area of the block gets corrupted in a single entity, the other entities will invalidate that transaction! Doesn’t make much sense does it? Luckily for you (and me) I hope this visualization helps. (Entity = blockchain)

Scenario 1: Comparing Single Entity Flow

Explanation

Each square will represent a block. The collection of all the square pieces will represent a blockchain. In block 1, there are 2 activities occurring, $25 from John to Alex & $30 from Terry to Bob. Once those activities have been validated via mining, the block will create a hash like “0000438d7625b86a6f366545b1929975a0d3ff1f8847e56cc587cadddb0ab781”. For simplicity sake, I just called it Hash1a. The blockchain is continued via block 2 and 3 with actions similar to that of block 1.

But what would happen if I was to change the activity in block 2? For example, changing the value from Bob to Alex from $20 to $30?

As you can see by the background color, block 2 and 3 would be invalidated. In other words, these blocks need to be mined again and perform the proper calculations.. thus leading to a different hash value. Also to note is that since block 2 has changed, block 3 will have to mine again as well!

Now that block has been re-mined, the hash value changes from 2a to 2b and 3a to 3b respectively. This is great for a single blockchain, however, in the real world there are many distributed blockchains that retain the same copy of transactions that validate the blocks. Lets look at our next example.

Scenario 2: Distributed Blockchain

In a distributed blockchain, there are copies of the same blockchain that validate the nodes on the blockchain. Every blockchain has the same hash values from 1a to 3a. I always read/heard the advantages of a decentralized system was that it was very hard to hack. Similar to the example in the single entity flow, if a hacker trying to change the transaction value in block 2 for blockchain 1 what would happen?

Based on the image above, the blocks in blockchain 1 need to be re-mined as shown below.

I marked the re-mined hash blocks in yellow. This is to emphasize that the blocks in blockchain 1 is different than that of blockchain 2 and 3. There is definitely something wrong! The hash value on blockchain 1 went from 2a → 2b & 3a → 3b! Blockchain 2 and 3 will flag to the network that something is wrong with blockchain 1 and invalidate that blockchain. Hopefully this makes more sense now! A hacker can not easily just change 1 value in the block because the gazillion other blockchains will know an invalid transaction had occurred.

Conclusion:

As you can tell based on images and hash values, every blockchain contains the same nodes and will perform activities/mining to validate the transactions. To a certain extent, you only need to check the last node in the block to confirm valid transactions. If the hash value output is the same on the last node you can ensure that the transactions were valid.

I watched a lot of videos about how blockchain works and to the best of my knowledge this is how I interpreted it. I am still relatively new to this space and would love some feedback if I may have missed something.

I plan on transitioning into the development side of blockchain technology. Specifically, Ethereum provides a lot of freedom for developers to create their own decentralized applications. For my next post, I want to start diving into geth, Solidity, etc. I still plan on writing more high level overviews as well. Suggestions welcome!

Donate ETH if you want to support me: 0x5BeD0Aa3c32359d80B6b19FCFA2D7c98Fc280601

BTC:
1M7qbncL9mXZehBkUMyUx1632jdWgGiE7L

Litecoin:

LcVtyseGBhnTNLEXF8CUc3cNvzYNxvy2Wk

--

--