How Does A BlockChain Work?
February 14, 2019
Blockchain has swamped both the money and tech enthusiasts of the world equally with its awe and buzz. These days anyone who has a slight interest in technology or money business has undoubtedly heard of this evolutionary (or perhaps soon-to-be revolutionary) technology and talks about it at every possible opportunity. But what is Blockchain?
Is it a currency? Is it a new coding language? Or, is it a financial business guideline?
Blockchain is nothing of all these but is a technology. Yes, it is a technology coined in the initial years of the 1990s by Stuart Haber and W. Scott Stornetta. They wanted to secure the valuable online documents by sealing their timestamps to make them tamper proof. Satoshi Nakamoto revived it in 2008 with a practical approach in his implementation of Bitcoin.
To know more about Blockchain technology in a simple yet comprehensive way, read our post: The Blockchain Theory.
Amid the buzz of Blockchain and cryptocurrencies, let us see how this booming technology works in 7 simple steps.
How does Blockchain work?
Blockchain’s working process is apparent from the way it has been named—a chain of blocks. Now the question is what does a block have and what makes this chain, which connects two blocks?
Step1: What constitutes the blocks and the chains?
A block is a 1 MB size of the data container, which carries an entry for the transactions in case of business or otherwise, data in chronological order, i.e., time sequenced. So, each container can contain a maximum of 1 MB of data, which once pushed in the Blockchain system makes way for the next container.
To link these two containers, a coupling is created between them through cryptography technology. Cryptography in simple words is a combination of mathematical and computer-related practices, which takes a readable string as input and gives an output that is not understandable.
The coupling thus created is called the hash and is a 64-digit string of numbers and alphabets. Hash acts as a signature of a block in the chain. The second container will maintain the hash of the first data container as a part of its data.
A hash to a block is what a thumb impression is to a human—always unique. This hash depends on the data of the block. So, if the data inside a block changes, its hash also changes. Hashing allows coupling of the blocks making a chain between the blocks. Remember, the signature of the predecessor container is a part of the successor’s data and is unique. Also, the average size of each block is usually less than 1 MB, which is the maximum allowed capacity.
Step2: How Hashing couples the blocks?
For the 1st block say B1, also known as the genesis block, let us assume the signature is HK000, and for the 2nd block B2, the signature is HK0A1 then they are linked as shown in the below image.
If someone tampers a record in B1, the signature changes to a new value, say HL000, which does not match with the signature mentioned in the data of B2. This corrupts the chain between B1 and B2 and will alert all the stakeholders for validation of the blockchain with their individual copies of the blockchain. Remember, each stakeholder has a copy of their own because they are not accessing some shared copy from any server. Blockchain being a decentralized ledger enables this.
The signature of B1 is generated through crypto technology. So, if the input data changes—like the addition of space or making an upper case into lower—the output signature changes. The input is the series of transactions recorded in the container B1. The hashing technology always generates the same signature as the output for the same input. Remember, block B2 has the signature of B1 as a part of the input to the cryptographical algorithm to generate a signature of B2.
Step3: Hashing process and Mining
There are specific rules a transaction has to abide by in any blockchain system, which are documented within the blockchain. The system itself takes care of this arbitration method. The hash generated by the cryptography also has to follow certain rules. Any hash would not be right until it abides by the rules. So, the hashing is done multiple times until the right hash is generated.
But as we explained earlier, the output remains constant if the input is the same, which is the data of the block. So, arbitrary data is introduced inside the block, which does not alter the transactional data and the signature of the previous block but overall input is changed. This data is called Nonce and is entered into the block to get a desired cryptographic signature of that block. Until the desired result is obtained, the nonce is played with. This process of producing an eligible signature is called mining.
So, the nonce is a new entrant in the block besides the data and hash of the predecessor block, which can be any random string like numbers only string or a name or anything that gets a valid output.
Step4: What makes Blockchain Immutable?
Through mining, the Miners monetize their efforts. To generate the right nonce, miners have to compute fast and multiple times. With better computational power, the probability of hitting the correct nonce increases for a miner. This makes mining a costly process due to the electricity it consumes and computational power the hardware and software needs. Hence tampering a blockchain means playing a lot with the nonce and hashing program to keep the blocks chained which eventually needs the high cost of electricity and machines.
Consider that Mr. X is trying to corrupt the blockchain. Also, he is successful in tampering a block BX. However, to prevent BX from breaking the chain, all the following hashes need tampering at lightning speed. Not to forget, he has to compete with all the miners in the network with their combined speed and computational power. Suppose, he is able to overwrite a certain number of blocks, and a new chain is formed, then multiple chains will exist in the system as other miners are also pushing the blocks. In that case, the chain with the longest trail is considered correct, and the miners discard rest others. Mr. X has a feeble chance now to be accepted unless he outsmarts the existing longest chain.
Being a decentralized system and cost involved with hashing and the cryptographic algorithms, Blockchain has a thin probability of tampering and therefore makes it an immutable technology.
More Interesting Read: Will Blockchain change the World?
Step5: 51% attack
Hacking a blockchain system is very tough for an individual miner due to his minuscule resources as compared to the rest of the miners. However, what if the attackers outnumber the ethical miners?
51% of a corrupted system can hack the blockchain. Such incident is also known as ‘double spend attack’ when the hacker or a group of hackers tries to retrieve the cryptocurrencies they consumed and spend them again by dominating a minimum of 51% of the computing power and speed in the whole system.
When a miner completes a transaction, it is pushed to a local pool of unconfirmed transactions first. The miners pick transactions from this local pool and create a block. To promote each block into the blockchain system, the miners have to play with the nonce and solve the mathematical problem. If a miner cracks a nonce, he has to broadcast it to all and other miners only verify the transactions inside the block with their local copies. This is how a consensus is achieved.
Suppose, the hacker does not broadcast his success and creates his chain privately, which is hidden from another verified and authentic public chain in play. Thus, there are chances of multiple chains existing in the system, both public and hidden. Also, the truth is not the same in the chains. In the public chain, the fraud miner has spent his finances, but on the private chain, his resources are not spent, creating two versions of his assets. But, blockchain follows the longest chain in a system and hence determines the truth. In case the fraudster makes a longer chain using immense computing power and broadcasts it in the system, the majority has to accept it as the righteous chain being the longest.
The false chain does not register the fraudster’s expenses, and thus, his spent coins are reverted to him allowing him to spend one more time.
However, all these tasks are too complex to perform in the real world owing to speed and resources, which gives the blockchain a sharp edge against hacking. Hence, more the number of miners working in the system, robust will be the blockchain. So, the size of the network itself acts as the wall of security.
Step6: The buzz about Cryptocurrencies
Bitcoin is the most famous cryptocurrency, which is a public currency and only functions as a financial asset. In a Bitcoin blockchain, the miners earn bitcoins with their mathematical solutions, and other stakeholders spend them in their transactions.
All the other crypto coins are a modified version of their pioneer—Bitcoin—and are either public or private, sometimes functioning both as financial assets and beyond. Ethereum is another public blockchain system with Ether as the cryptocurrency, which is a popular cryptocurrency and is dissimilar to Bitcoin in many ways but is a financial asset. There are many cryptocurrencies, which function beyond monetary values and can be used as tokens in gaming systems backed by Blockchain, license to use core facilities like water, electricity, gas.
A cryptocurrency can be public like Bitcoin or private like Monero and ZCash. Public cryptocurrencies allow anyone to join within the system, while a private cryptocurrency needs permissions and is designed for a particular purpose.
Step7: Public and Private Keys
Every node—participating computer or a similar machine in the blockchain—maintains a wallet. You can consider it similar to a bank account, which holds the assets of the blockchain. Each crypto wallet has a public key and a private key.
Public key—a series of numbers—is like your bank account ID that is used to identify you. However, it only acts as your address and does not reveal any personal or sensitive personal information, unlike your bank account.
Private Key as the name suggests is private to the wallet owner and is never shared, just like your bank account password. If revealed, consider your blockchain wallet stolen. Like the public key, it is also a large integer, larger than the public key itself. This private key is also used in generating the signature of a message. The public key is known for each participant and is used by others to read the signed message.
The combination of these two keys helps in authentication and authorization in the Blockchain. Authentication lets a user into the system. Authorization permits them to perform a task. These keys are the part of cryptographic hashing protocols and are the foundation of security.
The above seven steps define the major building blocks, processes, and concepts which work in coordination to make Blockchain work. So to summarize, the following are the three technologies, which makes the spine of Blockchain technology.
- Cryptography – which helps use the private key to generate a hash code for the blocks
- Distributed system with public ledger – gives transparency to the system and abolishes a need of the mediator
- Incentivization – to monetize the participants’ efforts while mining
Blockchain, because the way it works by leveraging the three core pillars, is robust in nature and is evolving fast to capture the mainstream businesses like supply chain, identity management, voting mechanism, real estate to name a few and of course the pet of all—financial system.
We at CoinGrammer strive to bring you not only the latest news but also crisp and comprehensive knowledge of virtual money business. Stay tuned to CoinGrammar for in-depth articles on Blockchain, Fintech, and Cryptocurrencies.