Welcome to another section of Blockchain basics.
Today we are going to learn about the Hash Function and will learn more about blocks in the system.
đź–Ą What's a Hash Function?
A "Hash" is a unique string of characters that are generated by converting your "Inputted data (letters)" into "Numbers" and then into a fixed length of “string” or “hash”. It serves to identify any piece of data. This conversion is done by Hashing Algorithms.
The hash algorithm we'll focus on today is SHA-256 (Secured Hashing Algorithm-256).
If I put "Mission Web3" into our SHA-256, it will get converted into: "b4c5d45d60353fdab4217a8006d2a45075e185549413752c20bf17724d0445e0"
This is a 64-character long hash which is encrypted using SHA-256.
Every chain uses Hashing Algorithms, some use the same or different algorithms, Ethereum uses its own version of a hashing algorithm known as Keccak256, and Solana uses an advanced version of SHA-256.
SHA-256 is a very basic hashing algorithm, you can try it over here!
Go ahead and try to encrypt some data of your own: Hash
🤔 Ever thought, "What are "Blocks" in blockchain?"
"Block" is like a container, but the data which is stored in it divides the block into three parts: 'Block Number', 'Nonce', and 'Data', but it takes only one input.
These three parts make up the hash for that particular block, even if one single data is changed, the entire hash is altered and declared invalid.
Block Mining involves the computational trial and error process of finding an acceptable value to produce a hash which typically certain pattern, such as 'starting with four zeros'. The value found, that satisfies this criterion, is known as the "Nonce".
A “Number Used Once” aka "Nonce" to find the “Solution” to the blockchain problem. It’s also used to define the transaction number for an account/address.
In a blockchain, sequence matters, each block has the data from the blog previous to it. Hence, Temperproof.
In real-time application, it will invalidate every proceeding block, until they are recalculated, or re-mined.
Blockchains are immutable which means that if we change one block’s data, the hash changes and the prev block’s hash is invalid now as the data is not the same as before. If we try to update one block then we need to update all the consecutive blocks which is computationally very expensive. But, if someone owns one blockchain, they can try to afford this method.
Genesis Block: The block having prev hash as 00000000000000, the block is known as Genesis Block. The first block in the blockchain. This prev hash does not exist.
That's a wrap for this article, see you on another read.
LFG! 🚀