Blockchain: Everything you need to know
What is blockchain?
Simply put, Blockchain is a decentralized peer-to-peer (P2P) distributed ledger that is secure and records transactions across multiple nodes or computers.
It provides a platform where people are allowed to transact with each other without any central authority acting as a middleman.
Block A “block” in the blockchain refers to a packaged data structure. It holds information like:
1. Timestamp- creation time of block.
2. Nonce- counter used for Proof of work algorithm.
3. Block hash- current block hash.
4. Previous block hash- reference to previous block in the chain.
These blocks are linked together to form a chain which records the entire his- tory of transactions and is distributed across the network.
How blockchain transactions work
1. Person requests a transaction.
2. The requested transaction is broadcasted to a P2P network of nodes.
3. The network nodes pickup the transaction, confirm its data and create a new block in which the transaction is then sent.
4. This block is then added to the chain hence completing the transaction.
Pillars of Blockchain technology
In a centralized environment like a client-server model, all the data is stored in one spot, thus making them an easy target for hackers. Also during software upgrades the entire system comes to a halt thus decreasing their availability. Further transaction fees involved are generally high especially for international transfers.
A decentralized network on the other hand is distributed and has no core authority. Anyone can become a node in the network. Being distributed, the system is available at all times. There are also no additional fees for international transfers and compared to centralized model fees and very low.
While a person’s real identity is secure, you can see all transactions performed by them, through their public address. This kind of transparency never existed within a financial system. They usually require customers to share their personal identity data just to use their services. Whereas in a blockchain all customers need is a digital wallet, which can be created in seconds without and additional information.
Data in the blockchain cannot be tampered with, the reason behind is the use of various cryptographic functions and algorithms working together to provide a secure environment. These mainly include PoW, Hashing Consensus algorithms.
Can the blockchain be hacked?
One may argue that “If someone was able to gain access to this extremely powerful system, which can crack these algorithms, can the blockchain be hacked then?
The answer is still “no,” because even though you might get access to this system, they would still be required to gain access to 51% of the network, which will not only require a huge amount of power but also a very large sum of money. Access to this amount of money is impossible, this is because every transaction and block creation requires a small amount of money which when scaled becomes huge in a developed blockchain.
Some of the most common used algorithms for the security of blockchain networks are:
1. SHA-256 (secure hash algorithm)
2. PoW(proof of work) algorithm
SHA-256 is actually a part of the SHA-2 family. It’s used to generate a fixed length of string (256 bits) by using cryptographically secure hashing functions to convert the input data.
The hash generated is one-way, meaning it can generate a fixed random string from a piece of data, but the data cannot be generated back from the hash.
- Block size- 64 bytes.
- Maximum message size- 264bit.
- Message digest size- 32 bytes.
- Parsed message size- 512 bits.
- Input blocks- 16.
- Output hash- 32 byte.
This algorithm will be used to hash blocks in the network, the blocks will then be connected using their hashes to form a chain. It will also be used by the PoW Chain validation algorithm to verify the added block is valid or not by comparing previous and current hashes.
Proof of Work(PoW)
To make sure that every block in the Blockchain is accurate, has the real transactions, and has the correct data inside of it, we use PoW algorithm. This is because if it doesn’t have the correct data, then people could fake how much money they have and essentially steal money from other people. So, every time a new block is created, we first have to make sure that it is a legitimate block by mining it through PoW.
We do this by using the SHA-256 algorithm, we repeatedly hash our block until we find the correct hash it is similar to a puzzle game. To do this we change the input to our PoW method by constantly incrementing the nonce value. Since the hash generated is random, thus it secures our chain.
If someone wanted to change a transaction, they would have to go back and re- mine block that already exists, they would also have to re-mine and recreate every single block that comes after the first one that they recreated, because blocks in the blockchain are linked together by their data. This would take an incredible amount of energy, which is nearly impossible for a well developed chain.
Originally published at (https://www.engati.com)