Understanding the technology behind blockchain
If you have a spare 15 minutes we would recommend you watch this video and then you wont need to spend your time reading this article which probably doesn’t explain Blockchain technology anywhere near as well!
Blockchain in cryptocurrency – The Simple Version
At its simplest level Blockchain and its implementation in cryptocurrency is a very basic concept. It is a secure list of all transactions that have occured that can not be amended.
How exactly this is achieved we will touch on later, but at its most basic level the above is all that you need to know. By having a trusted list of every transaction in a currency it is then relatively simple to see exactly what balance would be in each wallet.
Some currencies do implement blockchain in different manners, for example, Navcoin has a dual blockchain and some currencies utilise alternatives such as Tangle in IOTA. We would recommend researching how any currencies that you are looking to invest in operate.
Blockchain in cryptocurrency – More In Depth
For the purposes of this article we are going to be looking at Bitcoin as this is the simplest and most “standard” implementation of Blockchain. There will be some currencies that work in the exact same way, some with other features and a very few (like IOTA) that work in a completely different manner, so, as always, make sure you do your research!
To understand how Blockchain works we need to look into what data is stored in a block and what this data means.
There are three core pieces of data in a Block in Bitcoin: A hash of the previous block, A log of transactions and a Nonce (also known as a number once). It is very easy to look into any block you wish, for example, here is Bitcoin block 300,000.
Let’s look at the “Hash of the previous block” and what this means.
Cryptocurrencies make use of a form of encryption known as One Way Encryption. Bitcoin specifically uses the SHA-256 algorithm and, whilst other currencies use different algorithms, the end result is the same.
With this form of encryption you can condense large amounts of data into a much shorter key, for example, the above paragraph when encrypted using SHA-256 via this site would be:
If I were to amend or change this text in any way it would be immediately obvious that the key was entirely different, even adding an extra space in the end of the paragraph results in a wildly different hash:
This form of encryption has many uses, for example, when you send a password to a website, rather than it being transmitted over the internet in plain text it can be encrypted at your end and the server at the other end can test if your stored password matches the hash.
In cryptocurrency by including the Hash of the previous block in the subsequent block we can be sure the data in the previous block has not been altered then the current blocks hash is added into the next making a continuous chain of Blocks.
The transaction log
The transaction log is relatively self explanatory. In a cryptocurrency block there will be a ledger of transactions that fall within a certain period when a transaction is confirmed it is added to the next cryptocurrency block and once the block is mined they are added to the currency’s ledger. Each block, in bitcoin, can contain approximately 2,000 transactions.
One important piece of information is the generation transaction. With all other transactions there in an input (sender) and output (receiver). This transaction is the mining reward and as such does not have a sender instead the input can be used a secondary “Nonce” (more on this later) and as a way to store small amounts of data on the Blockchain. This data is known as a coinbase.
The Genesis Block (First mined block) of Bitcoin famously contains this text:
The Times 03/Jan/2009 Chancellor on brink of second bailout for banks
The nonce is a 32-bit field which is used for the purposes of one way encryption.
As we have covered previously each block contains the hash of the previous block. What we didn’t mention was that there are specific rules for the Hash and its value this is known as the difficulty. In Bitcoin it is required for the hash of a block to be below the value of the target difficulty.
To find a valid hash for the block they are working on miners will encrypt it millions of times a second with various values of the nonce and time in order to find a hash below that of the difficulty target.
As we covered previously; with any small change to the data the hash is entirely different as such any value of the nonce could be a legitimate hash and, as for every second that passes, the time on the block also changes effectively resetting the nonce. If someone managed to hash the entire nonce within a second (this would require just under 4.3 billion calculations a second) they are able to utilise the input of the generator transaction an alternative nonce providing an additional 100 bytes.
Once a valid hash is found this is broadcast to the network and miners will begin to work on the next block.
It is possible for two valid hashes to be found simultaneously at this stage one of these will be broadcast to the majority of the network faster and the other will become orphaned and discarded.
The Blockchain Infrastructure
In a Blockchain there are two key operators; nodes and miners. Nodes will hold a copy of the blockchain and miners will create and add blocks to the chain. The more nodes and miners there are the more distributed they are the more secure the system is. Being a node or miner is not exclusive and most miners will also be nodes.
The Bottom Line
Whilst Blockchain technology is not a perfect technology and it does have some vulnerabilities (specifically a 51% attack) it is likely to be one of the key innovations in the 21st century. Whether via cryptocurrency use or other applications it’s highly likely that blockchain technology will become a major part of our lives due to its many real world applications to improve our existing technology and develop new systems or processes and even spawn whole new industries.