**What is BlockChain?“**Blockchain technology” is a technique by which the principles of distributed computing and hashing algorithms are applied to create a (decentralized) distributed ledger(record keeping).
BlockChain technology and principles ensures prevention(or detection) of any malicious tampering or alteration of the ledger record (without the need for an external trusted middle-party).
**How does BlockChain work?**Block chain employs the use of (a) hash algorithms (eg. SHA-256), (b) chaining of hashed blocks, and (c) peer-to-peer distributed database for a robust and secure record keeping mechanism, making malicious alteration of records infeasible (i.e. highly expensive computationally).
Even though Blockchain has gain notoriety in the late 2010s, the underlying principles and technology of Blockchain have been around since the 1990s.
The principles of BlockChain were originally described in 1991 as a means to prevent backdating of digital documents and prevent tampering with digital assets. It went largely unused, until 2009 when Satoshi Nakamoto used the technique as the underlying principle to create the cryptocurrency, Bitcoin.
**What problems does BlockChain solve?**Block chain principles (i.e. The ability to maintain trusted records/ledgers that are impervious to alteration), can be applied to any Use Case that requires “Trust Management” and “Trusted Record Keeping” (without the need for an external 3rd party or middle-man).
Blockchain makes trusted ledger and record keeping,
There are multiple real-world scenarios that require this trusted record keeping and trust management. Eg. wallet transaction, land records, financial transactions, election voting, car odometer reading etc. The principles of Blockchain (i.e. trusted record keeping) can be applied to several of these real-world Use Cases.
A BlockChain is a “chain of Blocks” secured using BlockChain principles. The Blocks may contain any digital assets, i.e. informational assets (eg. transaction records, ledgers, voting results, medical records etc.), or other digital assets (eg. computer programs etc.).
In order to understand BlockChain we must first understand Hashing Algorithms.
A Hash function is a mathematical function which takes an input and produces an output. i.e. Y= H(X) , where X is the input, H() is the hash function, and Y is the output.
Hash functions have the following special properties,
The Hashing algorithm generates a “hash” of the input text
If we know X, using the H(), we can generate Y in a matter of milliseconds.
However if we are given Y, and asked to determine what X produced Y, this is not directly computable (and will typically require a brute force approach i.e. manually checking different X’s, passing it through H() and verifying if it produces the given Y).
Adding a “1” in the input text, dramatically alters the hash ouput
The Hash output is always a fixed length: The output is always a fixed length, irrespective of the size of the input string.
Hashed Output is always FIXED length
The mathematical functions that generate Hashes are well defined.
Some of the widely used hashing algorithms are MD5, SHA1 and SHA256.
Hash functions (along with Salts and Peppers) have been in common use on the internet since the late 1990s in secure password management.
Instead of securing the user password in clear text in the database, systems usually store only the “hash” of the passwords. When a user creates a password, the system uses the Hash Algorithm to generate the “hash’” of the password and stores the hash in the password table in the database. Subsequently, when the user attempts to login, the password the user enters is hashed and the hash is checked vs. the hash stored in the password table. If the “hash”’s match, then the user is allowed to login.
This way even if the system database is hacked and the passwords table is compromised, it will be impossible for the hacker to reverse engineer the clear text passwords.
more on Hash, Salt and Peppers here..
**Resources:**SHA256 Hash Generator: https://passwordsgenerator.net/sha256-hash-generator/
BlockChain technology employs Hashing Algorithms as the building blocks to create secure Blocks of data.
In a overly simplified explination, it does this by asking the following question
Given a hashed output with some criteria, can you determine what input will generate that output? i.e. What input string, when passed through a hashing function (eg. SHA256), will generate an output string that ends in …..abc276
Given the nature of hashing algorithms (i.e. hashing algorithms are one-way), we know that to answer this question is difficult, and will possibly require brute force approach, which would translate to a great deal of computing power. After trying several million different combinations of inputs, finally one input string may generate an output string like ed892349837abd2349abc276, which will finally match the criteria.
The computation of the input string that generated this output requires a great deal of computational power, and is called “mining”.
The “?” in the above diagram which is computed during the mining process is called the Proof-of-Work or PoW
Now that we understand how hashing algorithms are used in BlockChain technology, let’s take a step back now and understand what is a “Block” and the “BlockChain”.
In simplistic terms, a Block in a BlockChain consists of three main components.
“Hash” of the Previous Block, (The Hash of the previous block + the data of the current Block (+ the Proof-of-Work(PoW)) is used to generate the Hash of the current Block. i.e.Hash of current Block = Hash( Hash of Previous Block + Data in Current Block + PoW). This is how the Blocks become “linked” in a BlockChain. Note: The first Block of the Block chain is called in the “Genesis Block”.
Every Block in the BlockChain is “sealed” with a hash signature. This hash signature is generated by passing three components to any predefined hashing algorithm.
To verify the integrity of the Block, any user can simply check the “sealing” hash signature on the Block and compare it with the “hash” generated by passing the above three components through the hashing algorithm.
Now let us examine how the BlockChain principles above are applied to generate distributed ledgers, using distributed databases.
Since BlockChain by design makes it computationally infeasible for a hackers to modify or alter the BlockChain, the longest chain in the BlockChain (to which the BlockChain group has contributed to) is typically considered the honest chain (and the source of truth).
The BlockChain technology is a technique that is built on the building blocks of hashing algorithms, chaining using previous block hash, and distributed databases. All these principles are combined together and reinforce each other to allow for BlockChain technology to create a distributed repository of secure, un-alterable, record keeping.
This robust, secure, and distributed record keeping that is (computationally) impervious to alteration and tampering is the core appeal of BlockChain technology.
While the BlockChain technology is robust and secure it does inherently have the following vulnerabilities.
**The 51% attack**BlockChains are vulnerable to the 51% attack due to the nature of the distributed database network. Since BlockChains rely on a distributed databases and the hash signing of a Block is determined through the democratized process of group consensus, in theory if >51% of the group decides to maliciously tamper with the BlockChains, the security of the Blocks in the Blockchain can be compromised.However, the general assumption is that the pool of users using the Blockchain is large and diversified the chances of the 51% attack are low.
Found this post useful? Hit the 👏 button below to show how much you liked it :)
Follow me on Medium for the latest updates and posts!
Read Next: The Microservices Approach to Mobile Application Development
Other Articles:
Resources:
What Is Hashing? Under The Hood Of Blockchainhttps://blockgeeks.com/guides/what-is-hashing/
Following is a great introduction to implementing BlockChain in JS. It drives home the fundamental concepts of BlockChain using implementation in JavaScript.
WTF is The Blockchain? The ultimate 3500-word guide in plain English to understand Blockchain.https://hackernoon.com/wtf-is-the-blockchain-1da89ba19348