BC Unit1notes
BC Unit1notes
         b) Verification and inclusion in blocks: Miners (in PoW) or validators (in PoS)
            compete to validate transactions and create new blocks. They verify the
            transaction's legitimacy by checking factors such as the available funds, digital
            signatures, and transaction history. Once verified, the transaction is included in
            a block.
         c) Block confirmation: The newly created block containing the transaction is added
            to the blockchain. In PoW, this involves solving a computationally intensive
            mathematical puzzle, while in PoS, validators are chosen based on their stake and
            consensus rules.
                                                  1
      CSE Department                                                              19ECS459
         d) Consensus and chain selection: As the blockchain grows, subsequent blocks are
            added, forming a chain of blocks. Consensus mechanisms ensure that the
            majority of participants agree on the validity and order of the blocks. This
            agreement prevents double spending by establishing a single, agreed-upon
            transaction history.
       By utilizing a decentralized network, consensus mechanisms, and cryptographic
       techniques, blockchain technology effectively prevents the double spend problem.
       However, it's important to note that in some rare cases, a temporary "fork" in the
       blockchain can occur, resulting in two competing chains with conflicting transactions.
       This situation can create a small window for potential double spending until the
       consensus mechanism resolves the fork by selecting one chain as the valid one.
       Nevertheless, these occurrences are rare and typically self-correcting within the
       blockchain network.
      Solving the Byzantine Generals' Problem requires a consensus algorithm that can
      tolerate Byzantine faults, which include nodes that may send contradictory or
      misleading information. Several consensus algorithms have been developed to address
      this problem, with the most well-known being the Byzantine Fault Tolerance (BFT)
      algorithms.
      BFT algorithms, such as Practical Byzantine Fault Tolerance (PBFT) and Byzantine
      Fault Tolerant Replication (BFT-R), aim to achieve consensus by having nodes
      exchange messages, validate them, and reach agreement on the order and validity of
      transactions or decisions. These algorithms employ cryptographic techniques,
      redundancy, and voting mechanisms to ensure that the majority of honest nodes agree
      on a consistent decision, even in the presence of Byzantine faults.
      The Byzantine Generals' Problem and its solutions have significant implications for
      distributed systems, including blockchain technology. Byzantine Fault Tolerance
                                                 2
      CSE Department                                                               19ECS459
      algorithms are used in blockchain consensus mechanisms like Practical Byzantine Fault
      Tolerance (PBFT) and Byzantine Fault Tolerant Replication (BFT-R). These algorithms
      provide a means for achieving consensus in decentralized networks, where nodes may be
      untrusted or exhibit faulty behavior.
2. Blockchain concepts
Terminologies
Blockchain: Blockchain is a decentralized and distributed digital ledger technology that allows
multiple parties to maintain a shared database without the need for a central authority. It
provides transparency, security, and immutability to various types of transactions and data.
Distributed Network: A blockchain consists of a network of computers, known as nodes, that
work together to maintain and validate the blockchain. Each node has a copy of the entire
blockchain database.
Blocks: Transactions and data are grouped into blocks. A block contains a list of transactions,
a timestamp, and a unique identifier called a hash. The hash is generated using a cryptographic
hash function, which ensures the integrity and security of the block.
Hashing: The hash of each block is based on the data it contains, as well as the hash of the
previous block in the chain. This linking of blocks using their hashes creates the "chain" in
blockchain. Any change in a block's data will alter its hash, making it evident that the block
has been tampered with.
Consensus Mechanism: Blockchain networks use a consensus mechanism to agree on the
state of the blockchain and validate new transactions. The most well-known consensus
mechanism is Proof of Work (PoW), used by Bitcoin, where miners compete to solve complex
mathematical puzzles to add new blocks to the chain. Other consensus mechanisms, like Proof
of Stake (PoS), exist as well.
Validation and Confirmation: When a new transaction is initiated, it is broadcasted to the
network. The nodes validate the transaction's authenticity, ensuring that the sender has the
necessary authority and the transaction meets the defined rules. Once validated, the
transaction is included in a new block.
Block Addition: Miners (or validators) compete to solve the mathematical puzzle associated
with a block. The first miner to solve it broadcasts the solution to the network. Other nodes
then verify the solution and, if correct, add the block to their copy of the blockchain.
Immutability: Once a block is added to the blockchain, it becomes very difficult to alter or
remove. As subsequent blocks are added, the tamper-resistant nature of the cryptographic
hashes and the decentralized distribution of copies across the network make it highly secure
and resistant to manipulation.
Decentralization: The decentralized nature of blockchain means that no single entity or
authority controls the entire network. Consensus mechanisms ensure agreement among nodes,
making it difficult for malicious actors to manipulate the system.
Transparency and Privacy: Blockchain provides transparency by allowing anyone to view the
entire transaction history. However, the identities of the participants can be pseudonymous, as
only cryptographic addresses are typically displayed. Private blockchains can restrict access
and visibility to authorized participants.
                                                  3
       CSE Department                                                                  19ECS459
                                                     4
       CSE Department                                                                   19ECS459
                                                     5
      CSE Department                                                                19ECS459
identities. Transactions are signed with these cryptographic identities, ensuring their
authenticity and integrity while preserving privacy.
There are several cryptographic techniques and protocols that can enable consensus without
identity in a blockchain:
   a) Zero-Knowledge Proofs (ZKPs): Zero-knowledge proofs allow one party, the prover, to
      prove the validity of a statement to another party, the verifier, without revealing any
      additional information. ZKPs can be used to prove knowledge of a secret without
      disclosing the secret itself. By leveraging ZKPs, participants in a blockchain network can
      prove the validity of their transactions or their eligibility to participate in consensus
      algorithms without revealing their actual identities.
                                                   6
      CSE Department                                                                19ECS459
Proof of Work (PoW): PoW is a consensus mechanism commonly used in blockchain networks,
most notably in Bitcoin. PoW is a computationally intensive process that requires miners to
solve complex mathematical puzzles to validate transactions and create new blocks in the
blockchain. Miners compete against each other to find a solution to the puzzle, and the first
miner to solve it is rewarded with cryptocurrency tokens.
The underlying idea behind PoW is that finding a solution to the puzzle requires a significant
amount of computational work. This work serves as proof that the miner has invested a certain
amount of resources (computational power and electricity) into the network. This proof is then
used to reach a consensus on the order of transactions and the creation of new blocks. Once a
solution is found, it is broadcasted to the network, verified by other nodes, and added to the
blockchain.
The difficulty of the mathematical puzzles in PoW is adjusted dynamically based on the total
computational power of the network. This adjustment ensures that blocks are added at a
consistent rate, typically every 10 minutes in the case of Bitcoin. The difficulty adjustment
mechanism maintains the security of the network by making it increasingly difficult for a
malicious actor to control a majority of the computational power and manipulate the
blockchain.
PoW provides several benefits, including security against attacks, resistance to censorship, and
a fair and transparent way to distribute rewards. However, it also requires substantial
computational resources, leading to concerns about energy consumption and scalability.
It's worth noting that there are alternative consensus mechanisms, such as Proof of Stake (PoS)
and Delegated Proof of Stake (DPoS), that aim to address the energy consumption and scalability
limitations of PoW while still providing network security and incentives for participants. These
mechanisms allocate mining or block validation rights based on the participants' ownership or
stake in the network's cryptocurrency, rather than computational work.
2.5: Cryptocurrency
Cryptocurrency is a digital or virtual form of currency that uses cryptography for security and
operates on decentralized networks known as blockchains. Unlike traditional fiat currencies
issued by governments, cryptocurrencies are typically not controlled or regulated by any central
authority.
Some key characteristics and concepts related to cryptocurrencies:
Decentralization: Cryptocurrencies are decentralized, meaning they operate on a network of
computers (nodes) spread across the world, without a central governing body. This decentralized
nature allows for peer-to-peer transactions and removes the need for intermediaries like banks.
                                                   7
       CSE Department                                                                 19ECS459
spending those funds. This cryptographic security ensures the integrity and confidentiality of
transactions.
Token Generation: Most cryptocurrencies are generated through a process called mining or
minting. Mining involves solving complex mathematical puzzles or validating transactions to
add new blocks to the blockchain. Miners are typically rewarded with newly minted
cryptocurrency tokens as an incentive for their computational work and contribution to the
network.
Digital Scarcity: Many cryptocurrencies are designed with a limited supply to create scarcity,
similar to how finite resources like gold have value. Bitcoin, for example, has a maximum supply
of 21 million coins, which cannot be exceeded. This limited supply can contribute to the value
of cryptocurrencies.
Use Cases: Cryptocurrencies have various use cases beyond being a medium of exchange. They
can be used for investment purposes, remittances, decentralized finance (DeFi), smart
contracts, and more. Some cryptocurrencies are designed to serve specific purposes, such as
privacy-focused transactions (e.g., Monero) or facilitating decentralized applications (e.g.,
Ethereum).
Volatility: Cryptocurrencies are known for their volatility, with prices often experiencing
significant fluctuations. Factors such as market demand, regulatory changes, media attention,
and investor sentiment can impact cryptocurrency prices. This volatility can present
opportunities for investors but also poses risks.
Some well-known cryptocurrencies include Bitcoin (BTC), Ethereum (ETH), Ripple (XRP),
Litecoin (LTC), and many others. It's important to note that the cryptocurrency market is highly
dynamic, with new cryptocurrencies emerging and existing ones evolving over time.
While cryptocurrencies offer potential benefits such as financial inclusivity, borderless
transactions, and programmable money, they also come with risks, including price volatility,
regulatory uncertainties, and potential security vulnerabilities. It's crucial to conduct thorough
research, exercise caution, and understand the risks associated with cryptocurrency
investments and transactions.
2.6: NFTS
NFTs, or Non-Fungible Tokens, are a type of digital asset that represent ownership or proof of
authenticity of a unique item or piece of content, such as artwork, collectibles, music, videos,
or virtual real estate. Unlike cryptocurrencies such as Bitcoin or Ethereum, which are fungible
(interchangeable), NFTs are unique and indivisible, giving them their distinct value.
Here are some key points about NFTs:
Unique Ownership: NFTs are created and recorded on a blockchain, typically using standards
like the ERC-721 or ERC-1155 standards on the Ethereum blockchain. Each NFT has a unique
identifier and metadata that establishes its authenticity and ownership.
Digital Scarcity: NFTs leverage the blockchain's digital scarcity by ensuring that each token
represents a specific, one-of-a-kind item. This uniqueness is one of the primary drivers of their
value.
                                                    8
       CSE Department                                                                   19ECS459
Ownership and Authenticity: NFTs provide a way to prove ownership and authenticity of digital
assets. The blockchain's immutability and transparent record-keeping allow anyone to verify
the ownership and transaction history of an NFT.
Interoperability: NFTs can be bought, sold, and traded on various online marketplaces that
support their standards. These marketplaces act as platforms for creators and collectors to
engage in NFT transactions.
Use Cases: NFTs have gained significant attention in the art world, enabling artists to tokenize
and sell their digital artwork directly to collectors. However, NFTs are also used in other
domains, including gaming, sports collectibles, virtual real estate, virtual goods, and more. They
can represent ownership of in-game items, exclusive experiences, or limited-edition digital
content.
Royalties and Secondary Sales: NFTs can be programmed with smart contracts that allow
creators to earn royalties on subsequent sales of their NFTs. This feature ensures that artists
can continue to benefit from the increasing value of their work in the secondary market.
Criticisms and Environmental Impact: NFTs have faced criticisms regarding their environmental
impact due to the energy consumption associated with blockchain transactions. Some
blockchain networks, like Ethereum, are transitioning to more energy-efficient consensus
mechanisms to mitigate these concerns.
It's important to note that while NFTs have gained significant popularity and have been
associated with high-profile sales and media attention, the NFT market can be volatile, and
there are risks associated with investing in or trading NFTs. Additionally, due diligence is crucial
when engaging in the NFT space, as issues such as copyright infringement and ownership
disputes can arise.
Ultimately, NFTs represent a new frontier for the ownership and monetization of digital assets,
providing new opportunities for creators, collectors, and investors in the digital realm
2.7: Mining
Mining, in the context of cryptocurrency, refers to the process of validating and adding new
transactions to the blockchain, as well as creating new units of the cryptocurrency as a reward
for this work. It is a crucial component of many blockchain networks, particularly those that
use proof-of-work (PoW) consensus mechanisms like Bitcoin.
Here's an overview of how mining works in cryptocurrency:
Transaction Validation: Miners play a role in verifying the validity of transactions submitted to
the network. They check the authenticity of each transaction by confirming that the sender has
sufficient funds, the transaction adheres to the network's rules, and there is no attempt at
double spending (using the same funds in multiple transactions).
Block Formation: Validated transactions are grouped together into blocks, which serve as
containers for storing and organizing transactions in the blockchain. Miners compete to create
new blocks by solving complex mathematical puzzles that require significant computational
power. These puzzles are designed to be difficult to solve but easy to verify.
                                                     9
      CSE Department                                                                 19ECS459
Proof-of-Work: In a PoW system, miners must find a solution (known as a "nonce") to the
mathematical puzzle by iterating through various possibilities. The solution must meet specific
criteria, such as producing a hash value that starts with a certain number of zeros. This process
involves repeatedly guessing and checking until a miner finds a valid solution.
Block Reward: Once a miner finds a valid solution, they can broadcast it to the network. Other
nodes in the network verify the solution and, if correct, add the new block to their copy of the
blockchain. As a reward for their computational work and contribution to the network's
security, the miner who successfully mines a block is typically awarded newly minted
cryptocurrency tokens. This reward incentivizes miners to participate and secure the network.
Difficulty Adjustment: The difficulty of the mathematical puzzles is adjusted periodically to
maintain a consistent rate of block creation. As more miners join the network and
computational power increases, the puzzles become more challenging to solve. Conversely, if
miners leave the network, the difficulty may be adjusted downward to ensure a consistent block
creation rate.
Network Consensus: The consensus mechanism of PoW relies on the majority of miners acting
honestly and competing fairly. If a single miner or group of miners controls more than 50% of
the network's computational power, it could potentially compromise the security of the
blockchain through attacks like the 51% attack.
It's important to note that not all cryptocurrencies use mining or PoW as their consensus
mechanism. Some cryptocurrencies employ alternative mechanisms like proof-of-stake (PoS) or
delegated proof-of-stake (DPoS), which allocate the ability to mine or validate blocks based on
the participants' ownership or stake in the cryptocurrency itself.
Mining can be resource-intensive, requiring specialized hardware, substantial electricity
consumption, and cooling systems. It has also raised concerns about its environmental impact
due to the energy consumption associated with solving the mathematical puzzles.
3. Types of blockchains
3.1 Public Blockchain
A public blockchain is a type of blockchain network that is open to anyone and allows for
participation, transparency, and decentralized consensus. It is a distributed ledger system that
is accessible to the public, enabling anyone to join the network, validate transactions, and
maintain a copy of the blockchain's entire history.
Here are some key characteristics of public blockchains:
Open Participation: Public blockchains allow anyone to participate in the network as a node,
miner, or validator. There are no restrictions on who can join or access the blockchain, making
it permissionless and inclusive.
Decentralization: Public blockchains operate in a decentralized manner, with no central
authority controlling the network. Consensus is achieved through mechanisms like proof-of-
work (PoW) or proof-of-stake (PoS), where multiple participants contribute to validating and
confirming transactions.
Transparency: Public blockchains provide transparency by storing all transaction data on the
blockchain, which is publicly accessible and verifiable. Anyone can inspect the blockchain's
history, view transaction details, and verify the integrity of the data.
                                                   10
       CSE Department                                                                 19ECS459
Restricted Access: Private blockchains require permission to join and participate in the network.
The network's participants are typically known and verified entities, such as trusted
organizations, partners, or members of a consortium. Access controls and identity management
mechanisms are implemented to ensure only authorized participants can interact with the
blockchain.
                                                    11
       CSE Department                                                                  19ECS459
Controlled Consensus: Private blockchains may use consensus mechanisms tailored to the
specific needs and requirements of the participants. These mechanisms can vary from
traditional Byzantine Fault Tolerant (BFT) algorithms to more efficient consensus algorithms
like Practical Byzantine Fault Tolerance (PBFT) or Raft. Consensus is achieved among the
authorized participants, and they collectively maintain the blockchain's integrity.
Scalability and Performance: Private blockchains generally offer higher scalability and
performance compared to public blockchains. With a limited number of participants and a
controlled consensus process, private blockchains can handle a higher transaction throughput
and achieve faster confirmation times.
Use Cases: Private blockchains are often used in enterprise settings, where organizations need
to share and transact data securely with known parties. Industries such as supply chain
management, finance, healthcare, and government sectors can benefit from the transparency,
efficiency, and auditability offered by private blockchains. They enable streamlined processes,
reduced reconciliation efforts, and increased trust among participants.
Trade-Offs: While private blockchains offer benefits like enhanced privacy, scalability, and faster
consensus, they lack the decentralized and censorship-resistant nature of public blockchains.
The reliance on trusted entities for governance and access control can introduce concerns about
centralization and potential collusion among participants.
It's worth noting that there is a spectrum of blockchain networks, ranging from fully public to
fully private, with hybrid models in between. These hybrid models, known as consortium or
federated blockchains, combine elements of public and private blockchains by allowing a
controlled set of participants to maintain and validate the blockchain.
The choice between a public or private blockchain depends on the specific requirements, use
cases, and desired level of decentralization, privacy, and control for the participants involved.
                                                    12
       CSE Department                                                                 19ECS459
Access Controls: Similar to private blockchains, semi-private blockchains have access controls
that restrict participation to a specific group of authorized participants. These participants are
typically known entities or organizations that have been granted permission to join the network.
Access controls may include user authentication, identity verification, and permissioned
participation.
Multiple Levels of Access: Semi-private blockchains can have different levels of access and
participation. Some participants may have read-only access to the blockchain, while others have
permission to add new transactions, validate blocks, or participate in the consensus process.
The varying levels of access allow for different roles and responsibilities within the network.
Consortium Governance: Semi-private blockchains often operate under a consortium
governance model. A consortium consists of multiple organizations or entities that collectively
make decisions about the blockchain's rules, consensus mechanisms, and governance
structure. Consortium governance ensures that participating organizations have a say in the
network's operations.
Hybrid Consensus Mechanisms: Semi-private blockchains may utilize a consensus mechanism
that combines elements of both public and private blockchains. For example, they could use a
combination of proof-of-stake (PoS) and proof-of-authority (PoA) consensus algorithms. This
hybrid approach enables faster transaction confirmation times and improved scalability while
maintaining some degree of decentralization and security.
Partial Transparency: While semi-private blockchains are not fully open like public blockchains,
they can provide varying levels of transparency depending on the permissions granted to
participants. Participants with permission to view the blockchain can access and verify
transactions, but some information may be hidden or encrypted to maintain privacy or protect
sensitive data.
Use Cases: Semi-private blockchains are well-suited for scenarios where a group of trusted
entities needs to collaborate and transact securely while maintaining some control over the
network. Use cases include supply chain management, interbank transactions, industry
consortia, and government collaborations. Semi-private blockchains enable participants to
share data, streamline processes, and enhance trust while preserving privacy and
confidentiality.
Customization: Semi-private blockchains offer flexibility and customization options for the
participants. The network's rules, smart contract functionality, and consensus mechanisms
can be tailored to meet the specific requirements of the consortium members. This
customization allows for efficient collaboration and integration among the participating entities.
Semi-private blockchains aim to find a middle ground between the openness and
decentralization of public blockchains and the controlled access and privacy of private
blockchains. They provide a way for trusted entities to collaborate securely and efficiently while
maintaining some level of control and privacy within the network.
3.4 Sidechains
Sidechains are separate blockchain networks that are interoperable with and connected
to a primary blockchain, often referred to as the main chain or parent chain. They
                                                    13
      CSE Department                                                         19ECS459
provide a way to extend the functionality and capabilities of the main chain while
keeping the core blockchain lean and efficient.
Here are some key points about sidechains:
Functionality Expansion: Sidechains enable the development of new features,
applications, or use cases that may not be feasible or appropriate to implement directly
on the main chain. By creating a separate sidechain, developers can experiment,
innovate, and introduce new protocols, consensus mechanisms, or smart contract
functionality without affecting the main chain's operation.
Two-Way Peg: Sidechains are typically connected to the main chain through a two-way
peg mechanism. This allows for the movement of assets or tokens between the main
chain and the sidechain in a secure and verifiable manner. When assets are moved from
the main chain to the sidechain, they are locked on the main chain, and an equivalent
amount is issued on the sidechain. The reverse process can also be performed to move
assets back to the main chain.
Independent Governance and Consensus: Sidechains can have their own governance
structures and consensus mechanisms that differ from the main chain. This flexibility
allows sidechains to tailor their governance models and consensus algorithms based on
their specific requirements, use cases, or desired levels of decentralization.
Scalability and Performance: One of the key motivations behind sidechains is to address
the scalability and performance limitations of the main chain. By offloading certain
transactions or computational tasks to a sidechain, the main chain can operate more
efficiently with reduced congestion and faster confirmation times. Sidechains can
handle a subset of transactions, thus improving overall throughput and scalability.
Specific Use Cases: Sidechains can be designed for specific use cases or industries. For
example, a sidechain could be created for decentralized finance (DeFi) applications,
gaming, supply chain management, or identity verification. Each sidechain can have its
own set of rules, protocols, and functionalities optimized for its intended purpose.
Interoperability: Interoperability is a critical aspect of sidechains. It allows for the
seamless transfer of assets and data between the main chain and sidechains, as well
as between different sidechains. Interoperability protocols and mechanisms enable
communication and interaction across different chains, facilitating the flow of
information and value between them.
Security Considerations: Sidechains introduce additional security considerations. While
they operate independently, they rely on the main chain's security for the initial asset
lock and subsequent pegging. Security measures like audits, multi-signature controls,
and consensus mechanisms must be carefully designed and implemented to ensure the
integrity and safety of the sidechain and its interactions with the main chain.
Sidechains offer a way to expand the capabilities and scalability of blockchain networks
by creating separate, interconnected chains. They provide a sandbox environment for
innovation and customization while maintaining compatibility and interoperability with
                                              14
       CSE Department                                                                 19ECS459
Implementation and Software Vulnerabilities: Blockchain systems are built using software,
and like any software, they can have bugs or vulnerabilities. Exploiting these vulnerabilities
can lead to unauthorized access, data manipulation, or disruption of the blockchain network.
Privacy Concerns: While blockchain provides transparency, some blockchain networks may
leak sensitive information if proper privacy measures are not implemented. Transaction
details, addresses, and other data stored on the blockchain may be visible to anyone,
compromising user privacy.
                                                    15
      CSE Department                                                                 19ECS459
It's important to note that blockchain technology continues to evolve, and researchers,
developers, and security experts actively work to identify and mitigate vulnerabilities. Regular
security audits, code reviews, and best practices can help enhance the security and resilience
of blockchain systems. Additionally, advancements like improved consensus algorithms, zero-
knowledge proofs, and secure smart contract languages are being developed to address these
vulnerabilities and enhance the overall security of blockchain technology.
16