<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Avijit Srivastava</title>
    <description>The latest articles on DEV Community by Avijit Srivastava (@avijit_srivastava).</description>
    <link>https://dev.to/avijit_srivastava</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3690215%2Fdb4aac8f-ffe4-4021-b6b9-9da22c5486c2.jpg</url>
      <title>DEV Community: Avijit Srivastava</title>
      <link>https://dev.to/avijit_srivastava</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/avijit_srivastava"/>
    <language>en</language>
    <item>
      <title>Part 1: How Blockchain Works: Foundations Behind Bitcoin</title>
      <dc:creator>Avijit Srivastava</dc:creator>
      <pubDate>Sun, 01 Feb 2026 09:49:19 +0000</pubDate>
      <link>https://dev.to/avijit_srivastava/part-1-how-blockchain-works-foundations-behind-bitcoin-23an</link>
      <guid>https://dev.to/avijit_srivastava/part-1-how-blockchain-works-foundations-behind-bitcoin-23an</guid>
      <description>&lt;p&gt;&lt;em&gt;Imagine a ledger that anyone can read, no one can secretly change, and everyone collectively maintains—this is the core idea behind blockchain.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The question is "What is Blockchain ?"&lt;br&gt;
Blockchain is nothing but a chain of blocks. :) okay, but what do I mean by a block ?&lt;br&gt;
A block is a part of the ledger — a container that stores a batch of transactions.&lt;br&gt;
Hahaha, now what is a ledger ? So many questions right now...&lt;br&gt;
A ledger is kind of a book or a database where we can write down who paid whom, when and how much.&lt;/p&gt;

&lt;p&gt;Okay, got it—so a block is basically a box that contains information about transactions.&lt;/p&gt;

&lt;p&gt;But a block doesn’t stop there. Along with transactions, it also contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A reference (hash) to the previous block&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A timestamp&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And some additional metadata used for verification&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because each block points to the one before it, they form a chain—hence the name Blockchain.&lt;/p&gt;

&lt;p&gt;A block would look something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcbuzr32rsyq3rnpcn7rb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcbuzr32rsyq3rnpcn7rb.png" alt=" " width="800" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will see, all these jargon in later parts of the blog.&lt;/p&gt;

&lt;p&gt;This linking is done using cryptography, which means if someone tries to change a past transaction, every block after it would also need to be changed. In practice, that makes tampering extremely difficult.&lt;/p&gt;

&lt;p&gt;I will introduce one more jargon here, then we will go in-depth of every thing i mentioned.&lt;br&gt;
There is this one term, you will hear a lot - "&lt;strong&gt;Node&lt;/strong&gt;".&lt;br&gt;
&lt;em&gt;A node is a computer that helps store, verify and distribute blockchain data, ensuring the network remains decentralized and trustworthy.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Okay. so who creates node ?&lt;br&gt;
Literally anyone can create a node in public blockchain. But, we have to understand very important thing here.&lt;br&gt;
Running a node comes with a cost:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Storage costs (Because we are storing every blocks created in a network).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;24*7 up-time (Because a node must be fully up to date).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Running a node requires consistent internet bandwidth.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There are various other factors a well, therefore, we can observe it in any blockchain,there would be millions and billions of users but node will be limited in numbers.&lt;/p&gt;

&lt;p&gt;Like in case of Bitcoin, there are millions of users, but i guess, total of approximately, 22000 nodes are present.  &lt;/p&gt;

&lt;p&gt;Okay, let's create a mind map for summarizing above things:&lt;br&gt;
Blockchain&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9t7qgy8ahfvlk9ucfxe6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9t7qgy8ahfvlk9ucfxe6.png" alt=" " width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Okay, so Blockchain fundamentals are clear. Let's move to some of the cryptocurrency. We will start with Bitcoin and go deep into its internals.&lt;/p&gt;

&lt;p&gt;The first and important question is, Who creates these blocks ?&lt;br&gt;
The answer is "&lt;strong&gt;Miner&lt;/strong&gt;".&lt;br&gt;
Okay, so  is it like, Miner comes with some transactions, creates a block and adds it into the blockchain network ? Hell Noooooo ... :(&lt;/p&gt;

&lt;p&gt;Two questions are coming in my mind right now ?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How will Miner know about the transactions to include in the block?&lt;/li&gt;
&lt;li&gt;How will Miner create a block ?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's answer these questions first, and things will be clear afterwards.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;There are various transactions that occurs in the network, it's the work of the Node to verify the transaction and add it to the mempool.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Wtf is this mempool ?&lt;br&gt;
A temporary storage area where transactions wait before being included in a block.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens when a transaction is broadcast?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When someone sends a transaction:&lt;/li&gt;
&lt;li&gt;The transaction is broadcast to the network&lt;/li&gt;
&lt;li&gt;Nodes receive the transaction&lt;/li&gt;
&lt;li&gt;Each node verifies it (valid signature, enough balance, etc.)&lt;/li&gt;
&lt;li&gt;If valid, the transaction is stored in the node’s mempool.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then what?&lt;br&gt;
From mempool, Miners pick-up the transactions to include in the block.&lt;/p&gt;

&lt;p&gt;Okay, so we got the answer for the first question. Now the point is, how will miner create a block successfully ?&lt;/p&gt;

&lt;p&gt;Miners now have transactions, but to create a block, he needs to show "&lt;strong&gt;Proof Of Work&lt;/strong&gt;".&lt;br&gt;
Bitcoin network works on Proof Of Work.&lt;br&gt;
It is a system where miners solve complex mathematical puzzles to prove that they did computational work and earned the right to add block in the blockchain.&lt;/p&gt;

&lt;p&gt;Okay, thik hai, But how does the whole process work ?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Miners gather valid transactions into a block.&lt;/li&gt;
&lt;li&gt;Miners compete to find a number(nonce) that makes the block's hash meet a specific condition.&lt;/li&gt;
&lt;li&gt;The miner broadcasts the block, and if it’s valid, the network accepts it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I can show you some of the problem statements of Proof Of Work:&lt;br&gt;
&lt;em&gt;Note: these are simplified examples to explain the concept. Bitcoin’s actual difficulty target is more complex.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Find a number (nonce) such that when you hash the block data with that number, the resulting hash starts with at least three zeros.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A miner must find a nonce so that the SHA-256 hash of the block header ends with two zeros.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Okay, so let's just summarize this:&lt;br&gt;
&lt;strong&gt;Proof of Work is the process of finding a nonce such that the resulting hash of a block meets a specific condition (difficulty target).&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Okay, so now, we know little bit about Bitcoin network. Let's ask ourselves more questions.&lt;/p&gt;

&lt;p&gt;What will happen if let's say two miners completes the mining process at the same time ?&lt;/p&gt;

&lt;p&gt;Think about it little bit, what could be the best possible answer for this?&lt;/p&gt;

&lt;p&gt;In this case, the blockchain temporarily splits into two versions. This situation is known as temporary fork.&lt;/p&gt;

&lt;p&gt;Okay, ye sab to thik hai, but what's the solution ?&lt;br&gt;
"&lt;strong&gt;Longest Chain Rule&lt;/strong&gt;": Chain with the most cumulative Proof Of Work wins.&lt;/p&gt;

&lt;p&gt;Cool, but what will happen to the discarded block and transactions inside it?&lt;/p&gt;

&lt;p&gt;Don't worry :) Transactions from the discarded block are not lost instead,&lt;br&gt;
     1. They go back into the mempool.&lt;br&gt;
     2. They can be mined again in future blocks.&lt;/p&gt;

&lt;p&gt;You know what, this is why confirmation matters a lot.&lt;br&gt;
When you hear: "Wait for 6 confirmations" etc.&lt;br&gt;
It is because:&lt;br&gt;
    A transaction in block might be reversed.&lt;br&gt;
Bitcoin’s creator, Satoshi Nakamoto, suggested 6 confirmations as a good balance between:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;security&lt;/li&gt;
&lt;li&gt;waiting time&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Wait Wait Wait !!! &lt;br&gt;
When i transfer money using a wallet, I don't see any confirmation message, instead I see that money is transferred ?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Your wallet shows “money transferred” because it’s tracking the transaction in the mempool, not necessarily waiting for confirmations.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What actually happens when you send Bitcoin?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You create a transaction
_Your wallet creates a signed transaction and broadcasts it to the network.
_&lt;/li&gt;
&lt;li&gt;The transaction enters the mempool
_&lt;em&gt;Nodes receive and verify it, then store it in their mempool.&lt;/em&gt;
_&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your wallet shows it as “sent”&lt;br&gt;
&lt;em&gt;Because your wallet has successfully broadcasted the transaction and the network has accepted it into the mempool.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now it waits for confirmations&lt;br&gt;
&lt;em&gt;Miners pick it up from the mempool and include it in a block.&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Most wallets are designed for user convenience, not technical detail.&lt;br&gt;
So instead of showing “0 confirmations” they show:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Transaction sent
or&lt;/li&gt;
&lt;li&gt;Pending&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Because from a user experience perspective:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The transaction is already broadcast&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The user doesn’t need to know the exact confirmation count&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So does that mean the money is already transferred?&lt;br&gt;
Technically: Not fully.&lt;br&gt;
It’s pending until it gets confirmed.&lt;/p&gt;

&lt;p&gt;Everything is fine, but How does a Miner know what Proof Of Work, he needs to perform to create a block?&lt;/p&gt;

&lt;p&gt;There are two possibilities here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Miner runs their own full node.&lt;/li&gt;
&lt;li&gt;Miner does not run a node:

&lt;ol&gt;
&lt;li&gt;Mining Pool Setup:

&lt;ul&gt;
&lt;li&gt;The pool operator runs full nodes.&lt;/li&gt;
&lt;li&gt;Miner only:&lt;/li&gt;
&lt;li&gt;Receives block templates.
Pool Operator decides which chain to mine on or which      transactions to include.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Connecting to a public / remote node:

&lt;ul&gt;
&lt;li&gt;Miners connects via RPC to someone else's node.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;You can read more about Pool Operators and their functionalities in the web.&lt;/p&gt;

&lt;p&gt;In the next blog, I will be covering some of the technical aspects of the same. Like, how node verifies the transaction ? What actually happens if someone tries to fraud? etc etc.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;_THANK YOU ! _&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>web3</category>
      <category>blockchain</category>
      <category>bitcoin</category>
    </item>
  </channel>
</rss>
