A Blockchain is a method of storing data. Data is stored in blocks which are linked to the previous block.
But what does a “Block” look like? Each “block” contains
- Data of transactions
- A unique fingerprint for all the data in the block called a hash
- A hash of the previous block’s data
What does each of these items mean? Data in the block usually consists of transactions. A block can contain hundreds of transactions. Alice sending Bob $100 is an example of a transaction in a block
A hash is a unique combination of letters and numbers. It is like a fingerprint for the data in a block and it is always unique to every block in the Blockchain. When the data in a block changes, the hash will also change.
Hence in a transaction, if the amount being sent Alice to Bob changes from $50 to $100, the hash of the block will completely change.
A block also contains the hash of the previous block. Hence forming a chain structure. Combining the above three together, this is what a Blockchain will look like
Now if a transaction in any block changes, the hash of the block will change. When the hash of the block changes, the next block will show a mismatch with the previous hash that was recorded by it. This gives Blockchain the property of being tamper-resistant as it becomes very easy to identify when data in a Block has changed.
Hashes can be seen in action here. Try entering “Orange”, and then “orange”. See how a simple change in one alphabet completely changes the hash. Additionally, this link can be used to see how hashes secure the entire Blockchain.
Blockchain has one more property which makes them secure. A Blockchain is not stored on one person’s computer. Instead, it is stored in a large network of computers called a peer-to-peer network. A computer on this network is called a node, and every node will have a copy of the Blockchain.
Every a time a new block of transactions has to be added to this network, all members (nodes) of the network must check and verify if all transactions in the block are valid. If all nodes in the network are in agreement that the transactions in a block are correct, then the new block will get added to every node’s Blockchain. This process is called consensus.
Hence any attacker who tries to tamper with the data on a Blockchain must tamper with the data in the majority of the computers in the peer-to-peer network. This is how Blockchains proves to be a secure method of storing data.
Now, what if I wish to create a transaction in a Blockchain. How will I go about doing it?
Every computer software that uses a Blockchain, will give its users a public key and a private key. These are again just like hashes; they are a random sequence of alphabets and numbers that are generated by the software itself. Every user has to keep their private key securely and not reveal it to anyone. The public key, on the other hand, can be revealed to everyone.
Consider the example of a mailbox. The public key is like your mailbox which everyone knows about, and can drop you messages. The private key, on the other hand, is like the key to that mailbox. Only you own it, and only you can read the messages inside.
Both public and private keys have a unique property. The private key can be used to sign any message to create a digital signature. A digital signature is yet another sequence of characters and numbers. But there’s a catch!
All digital signatures can be verified using the corresponding public key. This means anyone who has a digital signature can verify whether a person truly signed the message, using the signer’s public key.
Both these keys, combined with message signing to create digital signatures can be called the cryptography in Blockchains.
Too complex? Let’s break it down step-by-step with an example. Alice wishes to record the message that she sent $100 to Bob on a Blockchain.
Once included, Alice’s transaction cannot be changed by anyone so easily!
And there you have it. That is a near-complete explanation of how data is stored on a Blockchain
- A Blockchain is a method of storing data in blocks which are linked together in the form of a chain.
- It relies on hashes and cryptography to secure the data inside a block.
- This chain of blocks resides on all computers in a peer-to-peer network.
- This network of computers use consensus methods to verify transactions in a block and include a block on the Blockchain. Hope you learned something new. If you enjoyed the read, kindly clap and follow me on Mirror.