Blockchain
Blockchain is an immutable digital ledger where all the transactions are public and transparent. Blockchain is decentralized and distributed that is linked to a P2P network. Bitcoin, Ethereum, NFTs, Collectibles are some implementations of blockchain. It can be used in different sectors such as crypto currency, banking, assets exchange, and many more.
Blockchain can be used as a database as well. We can store data on blockchain for simple use cases where data can not be modified. For example: ownership of properties, hospital records and more.
Nodes in the blockchain network store data generated by the blockchain and each node has the exact same copy of the data. Hence, it is decentralized and there is no chance for data loss.
Firstly, a transaction is requested. Each transaction is stored in blocks after the transaction is verified. Node validates the transaction to be valid. Each block contains hash from the previous block and are linked in that way. This is also the reason it is called blockchain i.e. it is a chain of blocks connected to each others forming a chain.
In every blockchain, node validates the transaction. For each validation, the validator node receives reward from the fee associated with the transaction. The transaction is validated by solving very complex cyrptographic algorithm.
There are multiple consensus mechanism for selecting which node validates the transaction. The popular mechanisms are Proof of Work(Pow) and Proof of Stake(PoS).
In PoW, multiple nodes work on solving the cyrptographic algorithm and compete against each other to validate the transaction to earn the rewards. In other words, transaction validation process in PoW is called mining. The validation process requires a lot of energy and the cost is very high.
In PoS, node is chosen randomly by the blockchain. This consensus mechanism makes it more of cost and energy efficient. Nodes must stake some coins to be able to participate. The consensus mechanism is free from 51% attack in blockchain.