Photo by Shubham Dhage on Unsplash
Blockchain - Explained for Noobs
A short intro to the blockchain technology
We hear the word Blockchain everywhere on the internet Nowadays! Yes, it's a new field, yes it's exciting, and yes, it's going to be used a lot in the future!
But wait, What exactly is Blockchain?
Well, let's end your curiosity with this article🤩
This article is written for both tech-savvy and non-tech folks to get an initial idea of blockchains. Expect some technical wordings.
What is Blockchain?
A Blockchain is a distributed, shared and permanent database or a ledger, that stores our data digitally.
In simple words, A ledger is a book or collection of accounts in which account transactions are recorded. Blockchain stores the transactions, or the transfer of assets done digitally, making it near impossible to hack or modify the system.
As the name suggests, data is stored on blockchains as a block of blocks. Each block contains a group of transactions. These transactions can involve moving assets throughout the network or changing the information stored on the blockchain. Every such block(containing a series of transactions) is not stored in a single place, it divides itself into multiple nodes(computers) worldwide.
One of the key features of a blockchain is that it is decentralized, meaning that it is not controlled by a single entity or authority. Instead, it is maintained by a network of computers, known as nodes, that work together to validate and record transactions. This decentralized structure makes it difficult for any single entity to manipulate or censor the data stored on the blockchain.
Types of Blockchain
There are many different types of blockchains, and each one has its own unique features and characteristics. Some common types of blockchains include public blockchains, private blockchains, and consortium blockchains.
Public blockchains, such as the Bitcoin and Ethereum networks, are open to anyone and are not controlled by any single entity. They are secured using advanced cryptographic techniques, and transactions are validated by a network of independent nodes.
Private blockchains, on the other hand, are restricted to a certain group of people or organizations and are often used for business or enterprise applications. They may be more centralized and have fewer participants, but they can still offer many of the benefits of a blockchain, such as increased security and transparency.
Consortium blockchains, also known as "permissioned" blockchains, are a hybrid of public and private blockchains. They are usually restricted to a certain group of participants, but they are not fully centralized like private blockchains. Instead, they are governed by a consortium of organizations, each of which has a certain level of control over the network.
Yeah, now you are getting a little idea about this, but let me make all this clear for you with
A short story
Let us consider, there are 4 friends namely A, B, C & You (not a name, it's you🫵) and there is a digital currency without blockchain.
They regularly circulate money among themselves and decided to track it down on a common website, consisting of a table, having- Names & Current Balances.
You are the person who is given the responsibility to manage the website and the table.
Name | Balance |
A | 100 |
B | 100 |
C | 100 |
You | 100 |
Everyone has 100 money. Justified!
Now, A pays C 20 money for the coffee and B to you, 40 for a book. You updated the table.
Name | Balance |
A | 80 |
B | 60 |
C | 120 |
You | 140 |
Good Job, fren!😉
Everything is smooth... isn't it?
But, as human beings, we are not equally connected to everyone, suppose A is your best friend, and you are having a secret cold war with C😠 (hmm... that's okay, but patch up with them soon, okay?).
Although A & B voted for you to handle all the stuff and you got the majority, but C is finding it tough to trust you. Maybe, you decrease his balance without his acceptance? Or, you get 20 money as a bribe from someone to change the real data🤨
Yeah, clear enough!
But, the system should be a trustable one to meet everyone's needs and trust.
Cryptography enthusiasts struggled with this issue for years.
Such a system was envisioned in 2008. A person or persons, under the pseudonym Satoshi Nakamoto published the Bitcoin whitepaper. They described a mechanism in this study that would build a peer-to-peer network for value exchange. To build a safe, scalable network, this system would bring together years of cryptographic research and game theoretical financial incentives. The paper describes a cryptographically linked chain of blocks. Later, this would be known as the blockchain.
In order to deal with trust, blockchain technology was developed. to design a system that is totally unaffected by censorship and impervious to corruption.
This is another key feature of Blockchain that is, it is transparent and open to all participants. All transactions are visible to everyone on the network, and the entire history of the blockchain is publicly available for anyone to view. This transparency helps to build trust among participants, as it allows them to see that transactions are being conducted fairly and honestly.
Peer-To-Peer Data Distribution
Did you notice the words- "Peer-To-Peer" above?
Peer-to-peer (P2P) data distribution is a decentralized approach to distributing data and resources over a network. In a P2P network, all nodes (also known as peers) are connected and can act as both clients and servers, allowing them to share resources and request resources from other nodes.
P2P data distribution can also be more efficient than traditional client-server systems. In a client-server system, all data requests must pass through the central server, which can become a bottleneck if there are many requests. In a P2P network, data can be requested directly from other nodes, bypassing the central server and potentially reducing the workload on the server.
P2P networks have been used for a wide variety of applications, including file sharing, online gaming, and distributed computing. Some well-known examples of P2P networks include BitTorrent and eDonkey.
Now, let's dive just a little bit (I promise) deep
This section is a bit techy, and so are you😉 that's why you are here! I assure you, it will be very interesting once you will go through the whole section.
A blockchain is just a file.
We can consider blocks in the chain as pages in the book.
For an analogy, a book is a chain of pages. Each page in a book contains:
the text: for example the story, any paragraph
information about itself: For example, the title of the book, chapter number, the title of the chapter at the top, and usually page number which tells you, where you are in the book, at the bottom. This ‘data about data’ is called meta-data.
Similarly in a blockchain block, each block has:
the contents of the block, for example in bitcoin it is the bitcoin transactions, and the miner incentive reward.
a ‘header’ that contains the data about the block. In bitcoin, the header includes some technical information about the block, a reference to the previous block, and a fingerprint (hash) of the data contained in this block, among other things. This hash is important for ordering.
Let us see what exactly is inside a block
index: the position of the block in the chain.
timestamp: a record of when the block was created. This is typically a UNIX timestamp, the number of seconds since January 1st, 1970. This data is important since it establishes a blockchain as a chronological time-based structure.
hash: this is commonly referred to as the block hash or block header. As opposed to what the demo says, this piece of data is NOT stored in the block but is actually a digital fingerprint representing the block's contents.
But, the question is, how do we calculate hash?
So, the hashing function takes in the data as input and gives us hash
f ( data ) = hash
Hash is actually a "digital fingerprint" of the block. Hence, the data is the combination of the index, timestamp, previous hash, block data, and nonce.
f ( index + previous hash + timestamp + data + nonce ) = hash
Let me show you, taking an example:
f ( 0 + "0" + 1508270000000 + "Agrim Sharma Blog" + 1204 ) = 0001376183e1b2bd4c792b36fc04d4f324f5b236eff0fd8d8f1127a1a8763e49
Hold on, I will tell you what the other contents are-
previous hash: the hash of the previous block.
data: each block can store data against it.
In cryptocurrencies such as Bitcoin, the data would include money transactions.
- nonce: the nonce is the number used to find a valid hash.
To find a valid hash, we need to find a nonce value that will produce a valid hash when used with the rest of the information from that block.
Umm... looks confusing🧐?
I recommend you take this detailed demo here!
Okay, I believe you have gone through this awesome demo, interesting it is, right!?😎
Now, that's enough for you to grasp!
On a closing note, blockchains have many potential uses, including enabling secure and transparent financial transactions, creating tamper-proof records for supply chain management, and even powering decentralized applications (dApps).
If you have any recommendations, feel free to comment😀
sources: My learnings from Alchemy University, LW3 | https://bitsonblocks.net/2015/09/09/gentle-introduction-blockchain-technology/
Keep Learning!
Keep Hustling!🫡