The blockchain is a digitally shared ledger to store data. This data stored in the form of blocks, so it is blocks of digital data. These blocks make the data indelible (its data can never be changed) as they are chained together. This digitally shared ledger or blocks will be publicly available to anyone who wants to see it ever again, in precisely the way it was added to the blockchain. That is a quite dramatic change because it allows us to keep track records of pretty much anything we can think, name it: identities & property rights, bank account balances, medical records, without being at risk of someone meddling with those records. The blockchain technology is what powers the cryptocurrencies like Bitcoin, and many believe that it contains more valuable applications and uses beyond cryptocurrencies as well. Financial institutions and even mainstream corporations all around the globe are beginning to explore ways that they can integrate blockchain technology into their day to day business. Take for example if someone buys a golf course in Sarasota and add a photo of the property rights to a blockchain, they will always and forever be able to prove that they owned that property rights at that point. It is tough to change that information if it is on the blockchain which makes blockchain indelible. So let’s come back to the question: How does blockchain work?
Primary Components of Blockchain:
There are three primary components of blockchain technology,
* Shared ledger & Wallet
* Transaction Data & Digital Signature
* Mining of Cryptographic Nonce
(I) Shared ledger & Wallet (A distributed network of blocks):
The widespread application of the blockchain technology is Bitcoin, a cryptocurrency that can be used to exchange services and products, just like the U.S. dollar, Euro, Japanese Yen, and other national currencies. Let’s discuss using this bitcoin blockchain, the oldest blockchain in existence and the first application to learn how blockchain works. Each block on the Bitcoin blockchain is 1 MB of data, and one bitcoin is a single unit of the Bitcoin (BTC) cryptocurrency. Like a dollar or a euro, a bitcoin has no value by itself; it gets the value on our agreement to trade goods and services. At the time of recording, it counts to 525,000 blocks, roughly around 525,000 MB stored on the blockchain. It is a significant track record and holds all the Bitcoin transactions that have ever occurred, from the very first Bitcoin transaction.
To our surprise the blockchain system does not know the amount of bitcoin each of us owns; it only records each transaction that is verified and approved on the blockchain network (i.e.,) in order to keep track of our account balances blockchain uses a decentralized, shared ledger, a digital block or file that tracks all bitcoin transactions. So to make transactions on the blockchain network; we need a Wallet, a program that allows us to store and exchange our bitcoins. Since we should only be able to spend our bitcoins, each wallet is protected by a particular cryptographic method that uses a unique pair of distinct but connected keys: a private and a public key. If we encrypt a message (transaction) with our public key, only we can decrypt that specific transaction using our paired private key. The reverse is also true: If we encrypt a message with our private key, only the paired public key can decrypt it. Although anyone can publicly check our wallet balances, the owners of those wallets remain mostly unknown.
When we encrypt a transaction request with our wallet’s private key, it gets a digital signature that is used by the blockchain system to verify the source and authenticity of the transaction. The digital signature is a complex formula resulting from our transaction request and the private key; hence it cannot be used for other transactions. If we change a single character in the transaction request message, the digital signature will entirely change, so no potential attacker can change our transaction requests or alter the amount of bitcoin we are sending. Let us see the Transaction data in detail with visual examples.
(II) Transaction data and Digital Signature:
Let’s compare blockchain shared ledger to Word documents. Doc1 describes the first transactions that have occurred up to 1 MB, whereas the next transactions described in Doc2 up to another MB, and so on. Each document is a block of data. These blocks are chained to one another using a unique (digital) signature that corresponds to accurately the transactions in that block. Even if there is just a single digit change to the block, it gets a new signature. In blockchain technology, this signature is created by a cryptographic hash function, a very complicated formula. A cryptographic hash function takes any string of input and turns it into a unique 64-digit string of output (SHA256). For example, insert the word ‘Transaction1’ into this SHA256 table, and you will see the output for this specific string of data is:
If even a single digit of the input changes, including space, changing a capital letter or adding a period, the output will be entirely different. For example, add a number 2 to this word and make it ‘Transaction2’ instead, you will see the output for this specific string of data is:
Now let’s say Doc1 registers two transactions, T1 and T2. Assume that these transactions make up a total of 1 MB (in reality in 1 MB there would be much more transactions). This Doc1 now gets a signature for the transactions T1 and T2. Let’s say the signature is ‘Sign1’. Here is what this looks like:
Remember, a single digit change to the transactions in Doc1 would cause it to get a different signature! Let’s consider there is a change in transactions in Doc1 and now it is chained to Doc2 (chain of blocks). The signature of Doc2 is now partially based on the signature of Doc1. Let’s say the signature of Doc2 is ‘Sign2’. Here is what this looks like:
Imagine adding another block, Doc3, to this chain of blocks and its signature is ‘Sign3’. Here is what this looks like:
Now if the transactions in Doc1 are altered it gets a new signature. The signature that corresponds with this new transactions is no longer Sign1. Let’s say it is now ‘SignX’ instead. Here is what happens now:
The signature SignX does not match the signature that was previously added to Doc2 anymore. Doc1 and 2 are now no longer chained to each other. This error indicates to other users of this blockchain that some transactions in Doc1 have been altered, and because the blockchain technology is indelible, they reject this change by shifting back to a previous record where all the blocks are still chained together. Each block on a blockchain are publicly available to anyone. The only way that alteration can stay undetected is if all the blocks stay chained together. This error is considered to be impossible in blockchain technology.
Also in Blockchain technology, a signature does not always qualify. Each block will only be accepted on the blockchain if its digital signature starts with a consecutive number of zeroes and every transaction has only one unique signature bound to it. Well, in order to give each block a signature that meets requirements, a specific piece of data (small) is added to every block that has no purpose except for being changed repeatedly in order to find an eligible signature, a signature starting with consecutive zeroes. This small piece of data is called the Nonce of a block. The Nonce is entirely random and could form any set of digits, ranging from spaces to exclamation marks to numbers, periods, capital letters and other digits.
Summary, each block contains;
1) Transaction data,
2) Unique Signature; the Signature of the previous block, and
3) a Nonce.
(III) What is Bitcoin Mining?
The process of changing the Nonce repeatedly to find an eligible signature is called Mining and is what miners do. Miners with more computational power (electricity) have chance to insert random Nonces faster and more likely they’ll be faster to find an eligible signature. It is a trial and error method. We can picture it like this:
Any user can participate in this mining process by downloading the mining software. When a user starts to use this software, they will only put their computational power into work to solve the Nonce for a block.
Let’s say a malicious miner has altered a block’s transactions and is now trying to calculate new signatures in order to have the rest of the network accept his change for the subsequent blocks. In order to keep all of the blocks linked, including the new ones continually being added, the miner needs more computational power than the rest of the blockchain network combined. Millions of users are mining bitcoin on the blockchain network, and he will never be able to catch up with the network finding signatures. So assuming that a malicious attacker on the blockchain network will never get his hands on advanced computational power than the rest of the network combined, meaning blockchain is indelible.
However, there is an exception though. What if a malicious entity has more computational power than the rest of the blockchain network combined? Theoretically yes, this is possible and has occurred on various blockchains in the past. It is called a 51% attack. Though, a 51% attack on the blockchain network would be far more costly to execute in reality than it would yield in return. It also requires an immense amount of hardware with cooling equipment, storage space, and electricity for computational power, but involves the risk of harming the blockchain ecosystem itself, making the Bitcoin value to drop significantly. So more users participating in the mining process makes the blockchain ecosystem more secure and long, which in turns becomes the blockchain protocol “majority of its’ users say is the truth” a governance model of democracy.