A blockchain is a digital ledger of records represented by hash which is generated using some hashing algorithm like SHA 256. Blockchain is a chain of blocks where every block has a reference to previous block through a hash.
- In the figure above: T1, T2 etc are transactions or payload (transactions are also hashed)
- H(T1, T2) is the hash of child nodes
Any addition of record to the digital ledger requires approval of the network.
For a block to be added or mined a proof of work must be accomplished by miners through computation. This proof of work is a nonce (number only used once), it is generated by miners using computers with very good processing capacity running in a peer to peer or decentralised network where the control does not lie with any one computer/miner, it is distributed across many computers who are participating. They keep on processing to arrive to a solution which starts with some number of leading zeroes
Once a consensus is reached, a new block is mined.
Transactions containing the digital record/payload are created in a block, every block has a block size which is nothing but the number of transactions it can hold. The transactions are stored in a tree structure called Merkle tree. The parent node contains the hashes of child nodes, this means that the root node would contain the hashes of all the child nodes. Root node is known as Merkle root. If a random transaction is added, the value of the computed hash would not match the one for Merkle root and as such it can be easily detected that the chain is being tried to be tampered, Blockchain would not allow such transactions to be added.
It is impossible to try to remove a block, this would mean rearranging all the blocks not just on one machine but on all the peers till the beginning of block creation.