In the last issue, we discussed cryptography and how it is used on the Blockchain to approve transactions.
In this issue, we will talk about how Cryptography secures the Blockchain. Let's get started, shall we?
The Blockchain can be thought of as a Decentralized distributed ledger that every participant (node) has, this ledger is used to store information and every node has an identical copy of it. This ledger is a hypothetical "chain of blocks" in which each block is linked to a previous one, Cryptographically.
To update this ledger, a new transaction that contains data is created and is added to a block. Transactions are picked from a region called the mempool (a reserved area for transactions that have not been added to the Blockchain), a node picks a transaction and validates the data it contains.
A transaction is created when data (amount to send, sender's address, recipient's address, nonce, gas fees etc.) is hashed to produce a unique transaction hash and it is signed with a private key to produce a unique digital signature. The transaction is then added to a block, a block can contain more than one transaction, all with different hashes and signatures, the different transaction hashes are combined to produce the block hash.
A node picks up a transaction, confirms that its data is correct and adds it to a block, this process of validating the data in the block requires computational work, like solving a math puzzle, this process is called mining. The node then broadcasts the mined block to the rest of the Blockchain network, the nodes confirm that the block was mined and is valid before adding it to their copy of the Blockchain and updating the Blockchain state.
The newly mined block is then added to the Blockchain, the hash of the new block is linked to the hash of the previous one which is linked to the hash of its previous one, this goes on and on, till the beginning of the chain, where the first block is called the Genesis block.
Linking blocks to their predecessors secures the Blockchain such that a change to the last block on the chain changes it's hash but the other nodes still have the initial hash, the Blockchain follows the superior number rule and to re-mine these blocks on other nodes is almost impossible as it takes a lot of computational power to achieve that.
Also changing any block within the chain, changes it's hash, this invalidates any blocks after it, these blocks will need to be re-mined on that node and other nodes and again, this will incur a lot of computational cost.
This way, the Blockchain creates a tamper-proof record of data without the need of a central entity.
How do the nodes agree on the state of the Blockchain, how do they agree on what is valid and what is not? That is where consensus algorithms come in and we have subtly discussed one here. Watch out for the next issue!
Top comments (0)