Blockchain Fundamentals: For Beginners
Master the Blockchain Basics for Web3
What is Blockchain?
A blockchain is a growing list of records, called blocks, that are linked together using cryptography.
- Wikipedia
Okay, now the definition is pretty self-explanatory but now what is a block?
A block is actually a record of data on the blockchain, it consists of the Data and along with it the Hash of the block and also the Hash of the previous block.
Another term now, Hash what is Hash?
Think of it as a fingerprint, A unique 64 characters long Hexadecimal number that represents the data of the block, The number is created cryptographically using Hash Algorithms like SHA256, The number accurately describes a data.
What do I mean by this is that if the data in the block,
for eg. is the string "Hello World" the corresponding hash let's assume will be 034DFA357, If I were to change anything in the string "Hello World" the hash would change completely and entirely, It is called the Avalance Effect, but if I put "Hello World" again in the block the corresponding hash would be the same i.e. 034DFA357, basically, A set of these 64 characters represent only and only 1 data, In this case, the hash 034DFA357 will represent only and only the string "Hello World" and nothing else like how a fingerprint would represent only 1 person and no one else.
Understand Hash Algorithms as fingerprint creators for Data, The Data could be anything Digital eg. Text Documents, Videos, Audios, Executable Files or even an entire Operating System, anything Digital you put into the Algo it will return its fingerprint i.e. a 64 Characters long Hexadecimal Number.
If you want to try and create some hashes yourself, try this -> Hash Creator
5 Requirements for a Hash Algorithm ->
It needs to be one way
You need not be able to create the original data from the hash, you can go from data -> hash but not hash -> data
It needs to be deterministic
One data will always have one hash like how 1 fingerprint represents only one human
Fast Computation
Calculation of the Hash needs to be fast
Avalanche Effect
Changing even a tiny thing of the data will change the hash of the data entirely and completely
It must withstand collisions
Since the hash is only 64 Characters it is limited and we have vast amounts of digital documents so it is possible but also very very unlikely that some documents will have the same hash and this is what we call collision, this should not be possible and the hash algorithm should look to it because this could result in forging of documents.
Now, How do these blocks form a chain?
All the blocks consist of the data, hash of the previous block and hash of itself and this is how the blocks are linked together i.e by holding the hash of the previous block.
Now, what about the first block? The block with no previous hash to hold?
It is called the genesis block and it will stay like that forever and ever.
How does the blockchain prevent the data from being tampered with?
We now know that when you change the data the hash changes along with it, so if someone were to change the data of the block the hash of the block would change and it would no longer match with the (previous hash) property of the next block and from there we will know that the blockchain has been tampered with.