Your First Step into Web3: What is Blockchain and Why It Matters?
If you have difficulties understanding blockchain and getting started, you are at right place. This post is designed to help complete beginners.

Overview of what You’ll learn
In this article , we’ll go through the basics of what is actually is a blockchain and how it works. Why it matters?
We’ll start with motivation for building cryptocurrency, which fortunately is an easy thing to digest and also one of the best uses of blockchain technology.
Then we’ll go through jargon which are a little bit technical mainly hashing and proof of work.
Then we’ll understand why these things are necessary and start exploring how blockchain works.
Introduction : Why Cryptocurrency?
Problems with traditional Currency:
Inflating Currencies- Currencies like US Dollar and Indian Rupees are not backed by any resource such as gold. Originally currencies were backed with gold and were just used as a contract for a certain amount of gold. Now if the government wants , it can take a loan and print currency depreciating its value.
Below is a picture of how much currency US Government Prints-

Bailouts- Bailouts happened many times where Government paid fines of Financial Institutions, pushing common people in huge financial difficulties.
The most popular example is 2008 Wall street crash.
Trust Based Model - The banking system we use is a trust based model where every transaction especially digital relies on trust . So it suffers the inherent weakness of that. There is a central Institution or Central Authority here.
These problems can be solved by decentralized money which is probably the best use case of Blockchain.
These problems motivated few cryptocurrency researchers to come up with Bitcoin in 2008.
Introduction to Hashing
Hashing is done through a mathematical function which takes an input of any size and produces an output of fixed length of characters. It is different from Encryption as a hash value can’t be reversed to find original input whereas an encrypted data can be decrypted.
Here are its properties-
Deterministic: The same input will always produce the same output.
Fast computation: The hash value can be quickly computed for any given data.
Pre-image resistance: It should be computationally infeasible to reverse the hash function (i.e., find the original input given its hash output).
Small changes in input produce large changes in output: Even a tiny change in the input should drastically change the hash output.
Collision resistance: It should be computationally infeasible to find two different inputs that produce the same hash output.
It is analogous to a digital fingerprint of data. It is nearly unique to each data, it can’t be predicted , can be used as an identification and can’t used to find original data.
An example of a hash function is SHA-256. It is available in ‘crypto’ library of Nodejs.
It outputs a 256 bit string of characters(64 characters in hexadecimal).
Here’s a code snippet-
const crypto = require('crypto');//we are using the crypto library
const input = "100xdevs";
const hash = crypto.createHash('sha256').update(input).digest('hex');
//we are using createhash function with the hashing algorithm along
//with the input data in update and encoding in digest
console.log(hash)
Here’s a Nodejs code to brute force through numeric inputs to find a hash that starts with 4 zeroes.
const crypto = require('crypto')
let i=0;
let firstfour;
let input;
do{
input=i.toString(); //converting the numeric input to a string
let output = crypto.createHash('sha256').update(input).digest('hex')
firstfour=output.slice(0,4)
//splice function returns first 4 digits of the hash
i++; //updating the input
}while(firstfour!='0000')
console.log(input)
We can easily modify the previous code to find the nonce for an input data
const crypto = require('crypto')
let i=0;
let firstfour;
let input;
do{
input="demo data"+i.toString();
let output = crypto.createHash('sha256').update(input).digest('hex')
firstfour=output.slice(0,4)
i++;
}while(firstfour!='0000')
console.log(input)
Introduction to proof of work
Proof of Work is a kind of "puzzle" that computers must solve. The puzzle involves finding a special hash for data that meets specific criteria (e.g., it must start with a certain number of zeros).
The puzzle is intentionally hard to solve but easy to verify. Finding the correct hash requires trial and error, taking up time and computing power—this is the "work" in Proof of Work.
Description of how blockchain works:
We’ll take bitcoin’s working to understand how blockchain works.Although there are some differences in ethereum and solana , the general architecture stays the same?
What is a Blockchain? It is a chain of blocks.
Each block stores information about a particular transaction between users. Every user has a copy of all the blocks and no user can change a previous block. They can only add new ones
If there are no central servers how does a user base work, who processes transactions?
Rather than a server , there is a network of nodes.Each node is called a miner.
No miner is in authority or no miner is superior. Each miner works simultaneously.
If no miner is in authority who stores the information ?
Every node on the blockchain.
How do miners process transactions?
💡A miner receives a data of a transaction , the particular block will contain block number , nonce , transaction data, and hash of previous output.💡They have to calculate the nonce, the nonce will be calculated based on the blockchain algorithm. The makers thought the hash has to always start from a particular number of zeroes .💡The number of zeroes will increase for increasing computation power of computers.💡After a nonce is calculated, the particular block is mined and broadcasted to all other nodes which they will re-verify before adding to their chain.💡At a particular time , multiple nodes can validate different blocks creating different versions of blockchain.One which is longer will win and be accepted by all.
Here’s an illustration-

Suppose T5 is calculated first , then the T5 will be added to chain and broadcasted to every body else.
Consider these two blocks,

If some dishonest miner changes block 2 , then not only block 2 but block 3 will also be invalidated as there will be a change in previous hash

Here’s an additional resource to mine yourself and learn-https://andersbrownworth.com/blockchain/
I am concluding it here. Hope you’re doubts are clear.I am happy to answer any questions you have ?
My contact- https://x.com/Sagni_kk