This article will explain the mechanism of blockchain using a visual approach.
- Hashes
To understand blockchain, we first need to understand hash.
A hash function is any function that can be used to map data of arbitrary size to fixed-size values
No matter how you change your data, you always get a fixed-size value
Hash: Unique fixed length string to identify a piece of data
Hash algorithm: A function that computes data into a unique hash
2. Block
A block is simply a container that contains all the data
To validate the block (e.g. Transaction data) on the blockchain network and add the block on the blockchain ledger, we need to solve a complex math problem. For example, we want to find the nonce that generate a hash and that hash needs to start with 4 zeros.
Miners compete with each others to solve the math problem. The first one who successfully solve the math problem will be rewarded with cryptocurrency. For example, miners are rewarded with bitcoin in bitcoin network,
Note: The math problem varies blockchain by blockchain. Some blockchain has a more difficult math problem.
Mining: The process of finding the “solution” to a blockchain “problem”
Block: A list of transactions mined together
Nonce: A “number only used once” to find the “solution” to the blockchain problem
3. Blockchain
Blocks chain together to form the blockchain. A block will use the hash of the previous block as an input to generate its own hash. The first block in a blockchain is called genesis block.
4. Distributed blockchain
A distributed blockchain is simply a database that is consensually shared and synchronised across multiple sites.
A distributed blockchain is often described as immutable. If someone try to modify the data, the hash generated will no longer be the same when compared with its peers.
In a distributed and decentralised scenario, a blockchain network can has many peers
If one chain looks differently when compares with its peers, it will be voted out. The majority rules.
There are still many topics can be discuss.
- Public key & private key
- The Nakamoto Consensus
- Gas fee & gas limit
But keep it short & simple, we will end the article here