Let's Chat
Menu
Let's Chat

What Is A Blockchain and How Do I Use One?

by Nick Marshall, on October 4, 2016

If you're following any Business Intelligence blogs or Data Influencers on Twitter, you've probably heard the term "blockchain" and how it's the next big thing in data- but what is it exactly, and how is it useful? 

 

What is a Blockchain?

A Blockchain is a shared multi-user ledger that is ideal to keep track of transnational data.  The decentralized nature of this system allows every participant to be able to trust the contents of this ledger without having to trust every one of the other participants.  This system could be used for an innumerable amount of applications such as inventory management of an organization,  tamper-resistant event logging, or even a massive distributed anonymous currency (e.g. Bitcoin!)

 

How Do I Use One?

Lets start with an example.  Lets say a company wants to use a blockchain to track their assets.  To get started the person responsible for the initial inventory enters it into the first "Block"

image2016-9-30_13-0-39.png

Now that we have this first block in place,  lets say Jimmy in accounting wants to check out a laptop, keyboard, and mouse.  He populates a block with his new allocations and attaches it to the first block.  In order to prevent someone from going in and changing any blocks before he hashes the previous block in the chain and adds it to his new block.  This makes it so if any block in the chain is changed it will break the hashes of all of the blocks down the line.  This continues with each new change to the inventory.

image2016-9-30_13_6_41.png
Now you may be asking yourself,  what is to stop someone from changing a previous block and quickly recalculating the hashes down the line?  Indeed this is a problem with this system as it stands,  which is why we will now introduce the concept of "Proof of Work".  What we want to do now is increase the difficulty and time it takes to add a new block to the chain.  This is done by adding a number called a 'nonce' to the block you wish to add.  You set it to a number and hash it together with the previous block.  If the resulting hash has a pre-determined amount of zeros to the left then the attachment is successful.  Otherwise you just increase the nonce and try again.  Due to the nature of hashing,  it is impossible to predict what value of the nonce will result in a successful hash, and by increasing the number of zeros required you can tune the difficulty to the level you would like.

image2016-9-30_13_8_44.png
Now if someone wants to change something far back it will take an unreasonable amount of time and computing power to recalculate all of the hashes for each block upstream of the one changed.  With a difficulty level high enough it becomes mathematically impossible. 

And that is how a blockchain works!  It is a nifty little system that we think is super cool and we hope you do too!

 

Topics:Data Science