Generally, records in a computer are stored in a text format or in a tabular format. The user can open the file, change the contents of that file as and when he wants and then save the file with the new contents. Files in a computer usually have some associated metadata which helps us know when the file was created or when it was last modified. But what if we want our data to be resistant to changes? We can make the file read-only and forget about it. But a person, or more specifically a hacker, can get access to the file by bypassing or changing its read-only permission and change the content of the file without changing the associated metadata. The real user will not even come to know that the file has been changed by someone. The user can keep a copy of the data on another computer (i.e. distributed data storage) which can then be compared with the real data. But here again, what if the hacker gets access to this also? Also, how will the user know which data is real and which data is the modified one? This is where a blockchain comes in.
To understand what a it is, we first need to understand what a block is. A block is basically a chunk of data that stores the following items for a particular transaction:
- The details of entities participating in the transaction.
- The details of the transaction, i.e. what the transaction is about and what & how much is getting exchanged.
- The date, time and unique identification of the transaction.
- A unique identifier which links the current block to the previous block. This unique block is generally a cryptographic hash of the previous block.
- A cryptographic hash of the current block.
As we see, each block of the blockchain is connected with the previous block. This sequence of blocks is called blockchain. The first block is called “Genesis Block” since it does not have a previous block. Now, keeping this blockchain on one computer runs the risk of a hacker changing the data in it. But if we keep it on multiple computers (called nodes) while making all of it publicly accessible, anyone can make copies of it. Now, as there will be multiple copies of the blockchain, any new transaction can be verified with some of the nodes before adding it onto the blockchain. If a transaction (i.e. a block) is added to a blockchain on one node after verification of its validity with a certain percentage of other nodes (atleast 50%), the transaction is propagated and added onto all other nodes too. This is the basic fundamental of a blockchain – every block is a permanent piece of record, and once a block is created, it cannot be altered or destroyed.
Even if a hacker tries to alter one of the blocks, he will have to alter all the subsequent blocks too since every nth block will contain the cryptographic hash of the (n-1)th block and so on till the last block. Also, changing one blockchain will not have the desired outcome for a hacker since all other nodes will still have the original blockchain. This makes actually changing the blockchain virtually impossible.
For addressing the trust issues with a blockchain, every blockchain implements tests called “Consensus models” for devices that want to be add blocks to the blockchain. These models require that the devices will have to submit some “proof” for participating in a blockchain. “Proof of work” is the most common model where the device has to do some work which is moderately hard for the device, but easy to cross-check for the nodes. The device does the work for sometime, comes up with a proof and the transaction gets added onto the blockchain if the proof is correct.
Thus, we see that there are 3 principles on which blockchain works:
- Decentralisation (as the data is not stored on a single node)
- Immutability (the data on a blockchain cannot be changed)
- Transparency (the blockchain is a basically a public ledger of transactions)
Now moving onto the uses of blockchain, there are numerous uses of blockchain, some of which are as follows:
- It can be used to maintain records which are immutable, e.g. health records of patients, property related records, official file movements records, etc.
- Low cost transactions – The cost of a blockchain transaction is very low as compared to the cost in usual banking systems. This has given rise to cryptocurrencies like Bitcoin and Ethereum.
- Smart contracts – Smart contracts verify the conditions that two users agree on and execute the terms of contract when the conditions are met.
- It can be used for protection of intellectual property by using smart contracts wherein items can be sold upon meeting specific conditions.
- It can even be used in conducting voting as vote once cast cannot be altered.
- It can be used for supply chain auditing in various companies to verify their claims.
For Wikipedia entry on Blockchain, click here.
For more posts on Advanced Topics, click here.
For more posts in The Cyber Cops project, click here.