Blockchain Introduction — Part 1

Abhishek vt
9 min readJul 7, 2023

--

by Abhishek VT

Lets understand blockchain technology in simple words,

Imagine you have a special notebook that you share with your friends. In this notebook, you write down all the games you play together and the scores each of you gets. But instead of having just one person in charge of the notebook, everyone has a copy.

Now, whenever someone wants to add a new game or update a score, they have to tell everyone else in the group. Everyone checks if the new information is correct, and if they agree, they write it down in their own notebook.

This way, every copy of the notebook is always up-to-date and has the same information. It’s like having lots of copies of the same notebook that everyone can trust.

This special notebook is like a blockchain. Instead of games and scores, a blockchain keeps track of transactions. Each time a new transaction happens, everyone who has a copy of the blockchain adds it to their own copy.

Because everyone has a copy and they all agree on the information in it, it’s really hard for someone to cheat or change things without others noticing. This makes the blockchain a secure and trustworthy way of keeping track of information and transactions.

So, think of a blockchain as a special notebook that everyone can have a copy of, and everyone can trust what’s written in it.

What is the difference between Blockchain and Database ?

Let’s break down the key differences between a blockchain and a database:

1. Structure: A database is a structured system that organizes data in tables with rows and columns, similar to a spreadsheet. It’s designed for efficient storage, retrieval, and management of data. On the other hand, a blockchain is an append-only data structure, where information is stored in blocks linked together in a chain. It’s more like a digital ledger.

2. Centralization vs. Decentralization: Databases are typically centralized, meaning they are owned and controlled by a central authority or organization. They manage and control access to the data. In contrast, blockchains are decentralized. They are distributed among multiple participants, and each participant has a copy of the entire blockchain. No single entity has complete control over the blockchain.

3. Trust and Security: Databases rely on trust in the central authority managing them. They have security measures to ensure authorized access and prevent unauthorized modifications. In a blockchain, trust is established through a combination of cryptographic techniques and consensus among multiple participants. Blockchains provide a high level of security and immutability, meaning it’s hard to change or tamper with the information once it’s added to the blockchain.

4. Data Modification: In a database, authorised users can easily modify or delete data. For example, you can update your toy collection in the box or remove a toy if you don’t want it anymore. In contrast, a blockchain emphasises immutability. Once data is added to a block and included in the chain, it becomes very difficult to change or remove it. This feature ensures the transparency and integrity of the blockchain’s history.

5. Use Cases: Databases are commonly used in many applications like banks, online stores, and libraries to store and manage data efficiently. They excel at handling large amounts of structured data and providing quick access to it. Blockchains, on the other hand, are often used for applications that require transparency, trust, and decentralised control. They are widely associated with cryptocurrencies like Bitcoin, but they can also be used for supply chain management, voting systems, or smart contracts.

Types of Blockchain

1.Public Blockchain : A public blockchain is a type of blockchain network that is open and accessible to anyone who wants to participate. It operates in a decentralised manner, meaning that no single entity or authority has control over the network. Instead, participants in the network, often referred to as nodes, collectively maintain and validate the blockchain.

In a public blockchain, anyone can join the network, contribute computing power, and participate in activities such as transaction validation and block creation. The transparency of public blockchains allows anyone to view and verify the entire transaction history, providing a high level of trust and immutability.

Well-known examples of public blockchains include Bitcoin, Ethereum, and Litecoin. These public blockchains have wide adoption and are open for anyone to participate, providing a transparent and secure infrastructure for various decentralized applications and digital assets.

2.Private Blockchain : A private blockchain is a type of blockchain network that operates within the confines of a specific organization or a group of known and trusted entities. Unlike public blockchains, private blockchains have restricted access, meaning that participation and validation rights are typically granted to a limited number of pre-approved participants.

In a private blockchain, the control and management of the network are centralized or distributed among a defined set of participants. The level of decentralization can vary depending on the specific design and requirements of the private blockchain.

Private blockchains are commonly utilized in various industries, including finance, supply chain management, and healthcare, where participants need to collaborate and share information securely within a closed ecosystem. Examples of private blockchain frameworks include Hyperledger Fabric ,R3 Corda, etc.

3.Hybrid Blockchain : A hybrid blockchain is a combination of public and private blockchain elements, aiming to leverage the benefits of both models. It seeks to provide a solution that combines the transparency and decentralisation of public blockchains with the privacy and control of private blockchains.

In a hybrid blockchain, certain aspects of the network are kept public, allowing for open participation, transparent verification, and consensus among a larger set of participants. At the same time, specific elements or transactions within the blockchain can be restricted and kept private, limiting access to a selected group of known participants.

What is Block?

“The Genesis block is the very first block added to the blockchain.”

Image owned by Author

A blockchain is a collectively maintained digital ledger that organises, monitors, and controls information for the purpose of informed decision making. It achieves this by recording transactions in blocks, which are added to the chain.

When a new transaction takes place on the blockchain, it is documented as a new block in the chain. However, this addition is subject to validation through a consensus algorithm, such as proof of work. Once validated, the new block is appended to the ledger of every participant’s node. It’s important to note that once a block becomes part of the chain, it becomes immutable and cannot be modified; it can only be expanded by adding new blocks to it.

What information is stored in the blockchain?

The Block header consist of a

  • Block header containing metadata and
  • Transactions stored in the block using the Merkle tree.

The block header within a blockchain encompasses the following attributes.

Image owned by Author
  1. Version number : To track the software or protocol that will allow other computers to read the block correctly.
  2. Timestamp : When the transaction was recorded, or the block was created and is expressed as seconds since 1970–01–01T00:00 UTC.
  3. Nonce : Nonce, short for “number used only once,” refers to a randomly generated value that miners generate in order to solve a complex mathematical problem required for block creation in a blockchain.
  4. Target : The target in a blockchain signifies the level of difficulty associated with generating the nonce, which is necessary for validating transactions before they are appended to the blockchain. It serves to control the rate at which new blocks are incorporated into the blockchain and is approximately adjusted every 2016 blocks. A higher difficulty in generating the nonce corresponds to a lower target value.
  5. Hash of Previous Block : In a blockchain, a 256-bit cryptographic hash of the previous block header is used to establish a connection between blocks. This linking mechanism ensures the integrity of each preceding block, extending all the way back to the initial block known as the Genesis block.
  6. Merkle Root Hash : In a blockchain, the Merkle root hash is a cryptographic hash value that serves as a summary or fingerprint of all the transactions included in a block. It is derived by applying a hash function to a collection of transaction hashes, which are themselves the result of hashing individual transactions.
  7. Transactions : Transaction or Transactions are stored in the Block using the Merkle tree hash.

Key terminologies used in Blockchain technology

Ledger : A blockchain ledger is a distributed and decentralized digital ledger that records and stores a chronological sequence of transactions or data across multiple computers or nodes. The ledger is maintained and updated through a consensus mechanism, such as proof of work (PoW) or proof of stake (PoS). Consensus mechanisms enable network participants, also known as nodes or miners, to agree on the validity of transactions and reach a consensus on the state of the ledge.

SHA-256 : SHA-256, which stands for Secure Hash Algorithm 256-bit, is a widely used cryptographic hash function. It is part of the SHA-2 (Secure Hash Algorithm 2) family of hash functions developed by the National Security Agency (NSA) in the United States. SHA-256 is known for its security, efficiency, and resistance to collisions.

A hash function takes an input (data) of any size and produces a fixed-size output, which is typically a string of characters. In the case of SHA-256, the output is always 256 bits (32 bytes) in length. The primary purpose of a hash function is to transform data into a unique representation, known as a hash value or hash digest.

Mining : Blockchain mining is the process by which new transactions are added to a blockchain and validated by participants in the network. It is an essential component of many blockchain systems, including Bitcoin.

Node : Node refers to a computer or device that participates in the network and maintains a copy of the blockchain ledger. Each node independently verifies and validates transactions, ensuring the integrity and consistency of the blockchain network.

Smart Contracts: Self-executing contracts with predefined rules and conditions written in code. Smart contracts automatically execute and enforce the terms of an agreement once the conditions are met.

Consensus Mechanism : The mechanism used in a blockchain network to achieve agreement among participants on the validity of transactions and the order in which they are added to the blockchain. Common consensus mechanisms include Proof of Work (PoW), Proof of Stake (PoS), and Delegated Proof of Stake (DPoS).

Decentralization : The distribution of control and decision-making across multiple nodes or participants in a network, as opposed to being controlled by a central authority. Decentralization is a key characteristic of blockchain technology.

Immutable : In the context of blockchain, it means that once data is added to the blockchain, it cannot be altered or deleted. The immutability of blockchain ensures the integrity and trustworthiness of the recorded transactions.

Peer-to-Peer (P2P) : A decentralized communication model where participants interact directly with each other without the need for intermediaries. Blockchain networks often operate on a peer-to-peer basis, enabling direct transactions and data sharing.

Private Key and Public Key: In asymmetric cryptography, a private key is a secret key known only to the owner and is used to sign transactions or provide access to digital assets. A public key is derived from the private key and can be shared publicly for verification and encryption purposes.

In the upcoming session, we will delve into the exciting world of blockchain technology. I trust that everyone has grasped the fundamental concepts from our introductory discussion. Our focus will now shift to practical implementation, specifically exploring the development of blockchain-based applications using Hyperledger Fabric technology.

--

--

Abhishek vt

👨‍💻Java & Blockchain Developer 🌐 | Trainer 📚 | Interview Coach 🎥 | Sharing tutorials and tips on Java ☕️ & Blockchain tech | www.abhishekvt.com