IV Cs BC&CT Lecturenotes
IV Cs BC&CT Lecturenotes
COURSE OBJECTIVES:
1. To Introduce block chain technology and Crypto currency.
2. Understand the philosophy of Block chain and the cutting edge technology behind its functions.
3. Illustrate how to setup Ethereum tools
4. Explain the key vocabulary and concepts used in Blockchain for Business.
5. To gain the awareness about the concepts of various implementations of Blockchain technology such as bitcoin,
Ethereum, and Hyper ledger.
LECTURE NOTES
UNIT–I
Introduction: Block chain or distributed trust, Protocol, Currency, Cryptocurrency, how a Cryptocurrency
works, Crowd funding. Architecture – Properties of Blockchain, Digital Identity verification, Block chain
Neutrality, Digital art, Blockchain Environment, Applications and Challenges.
Block chain or distributed trust:
Blockchain technology and distributed trust are closely related concepts but are not the same.
Blockchain
1. Definition: Blockchain is a decentralized, distributed ledger technology that records transactions across many
computers. These records are immutable and transparent, ensuring security and trust without needing a central
authority.
2. Components:
o Blocks: Data records, such as transactions, grouped into blocks.
o Chain: Each block is linked to the previous one, forming a chain.
o Consensus Mechanisms: Methods to achieve agreement among distributed nodes (e.g., Proof of Work,
Proof of Stake).
3. Benefits:
o Security: Cryptographic algorithms ensure data integrity.
o Transparency: All participants can view the entire transaction history.
o Immutability: Once recorded, data cannot be altered.
4. Applications:
o Cryptocurrencies: Bitcoin, Ethereum.
o Supply Chain Management: Tracking products from origin to consumer.
o Smart Contracts: Self-executing contracts with predefined rules.
Blockchain technology can be integrated into multiple areas. The primary use of blockchains is as a distributed
ledger for cryptocurrencies. It shows great promise across a wide range of business applications like Banking,
Finance, Government, Healthcare, Insurance, Media and Entertainment, Retail, etc.
Need of Blockchain
Blockchain technology has become popular because of the following.
o Time reduction: In the financial industry, blockchain can allow the quicker settlement of trades. It does not take
a lengthy process for verification, settlement, and clearance. It is because of a single version of agreed-upon data
available between all stakeholders.
o Unchangeable transactions: Blockchain register transactions in a chronological order which certifies the
unalterability of all operations, means when a new block is added to the chain of ledgers, it cannot be removed
or modified.
o Reliability: Blockchain certifies and verifies the identities of each interested parties. This removes double
records, reducing rates and accelerates transactions.
o Security: Blockchain uses very advanced cryptography to make sure that the information is locked inside the
blockchain. It uses Distributed Ledger Technology where each party holds a copy of the original chain, so the
system remains operative, even the large number of other nodes fall.
o Collaboration: It allows each party to transact directly with each other without requiring a third-party
intermediary.
o Decentralized: It is decentralized because there is no central authority supervising anything. There are standards
rules on how every node exchanges the blockchain information. This method ensures that all transactions are
validated, and all valid transactions are added one by one.
o Encryption: Blockchain uses technologies such as public and private keys to record the data in
the blocks securely.
o Immutability: Completed transactions are cryptographically signed, time-stamped and
sequentially added to the ledger.
o Tokenization: Transactions and other interactions in a blockchain involve the secure exchange of
value.
o Decentralization:Both network information and the rules for how the network operates are
maintained by nodes due to consensus mechanism.
Benefits of Blockchains
Benefits of blockchain
Unstoppable: Once the conditions programmed into a blockchain protocol are met, an
initiated transaction cannot be undone, changed, or stopped. It’s going to execute and
nothing – no bank, government, or third party – can stop it.
A new block of transactions is only added after a complex mathematical problem is solved and
verified by a consensus mechanism. Each new block has a unique cryptographic key resulting
from the previous block’s information and key being added into a formula.
Decentralized: No single entity maintains the network. Unlike centralized banks, decisions on
the blockchain are made via consensus. Decentralization is essential because it ensures people
can easily access and build on the platform.
Lower Cost: In the traditional finance system, you pay third parties like banks to process
transactions. The blockchain eliminates these intermediaries and reduces fees, with some
systems returning fees to miners and stakers.
Peer-to-Peer: Cryptocurrencies like Bitcoin, let you send money directly to anyone, anywhere in
the world, without an intermediary like a bank charging transaction or handling fees.
Transparent: Public blockchains are open-source software, so anyone can access them to view
transactions and their source code. They can even use the code to build new applications and
suggest improvements to the code. Suggestions are accepted or rejected via consensus.
Universal Banking: anyone can access the blockchain to store money, it’s a great way to protect
against theft that can happen due to holding cash in physical locations.
Use cases
o Dubai has been able to integrate blockchain into eight industry sectors
o Real estate
o Tourism
o Security
o Transportation
o Finance
o Health
o Education.
Distributed Trust
Definition: Distributed trust is a concept where trust is not placed in a single entity but spread across multiple
entities or nodes in a network. It’s the foundation for decentralized systems like blockchain.
Distributed system attempt to solve the problem
• Most of the Internet applications we use every day are centralized, they are owned by a
particular company or person that provision and maintain the source code to execute on a
computer, server or maybe even a cluster.
Decentralized Applications
• The code runs on a peer-to-peer network of nodes and no single node has control over the
dApp.
• Depending on the functionality of the dApp, different data structures can be used to
store the application data.
Mechanisms:
o Consensus Algorithms: Methods to agree on a single data value (e.g., Byzantine Fault Tolerance).
o Decentralization: Removing the need for a central authority, distributing power across participants.
2. Benefits:
o Resilience: Reduced risk of single point of failure.
o Transparency: Equal access to information for all participants.
o Security: Harder for malicious actors to compromise the system.
3. Applications:
o Blockchain Networks: Using consensus to validate transactions.
o Decentralized Finance (DeFi): Financial services without central banks.
o Distributed Ledgers: For various data sharing and validation purposes.
• Blockchain relies on distributed trust: The decentralized nature of blockchain ensures that no single
entity has control, spreading trust across all participants.
• Distributed trust can exist outside blockchain: While blockchain is a popular implementation,
distributed trust can also be applied in other decentralized systems and protocols.
Cryptocurrency:
Cryptocurrencies are digital or virtual currencies that use cryptographic principles for security. They operate on a
technology called blockchain. Here’s a detailed overview of cryptocurrencies and their relationship with blockchain
technology:
What is a Cryptocurrency?
1. Definition:
o A Cryptocurrency is a digital or virtual form of money that uses cryptography for security and operates
independently of a central bank.
2. Key Features:
o Decentralization: No central authority controls the currency.
o Digital Nature: Exists only in digital form.
o Cryptographic Security: Uses cryptography to secure transactions and control the creation of new units.
1. Blockchain Technology:
o Ledger: A public ledger (blockchain) records all transactions. Each transaction is grouped into a block, which is
then added to a chain of previous blocks.
o Nodes: Computers in the network (nodes) maintain the blockchain by validating and recording transactions.
o Consensus Mechanisms: Algorithms (e.g., Proof of Work, Proof of Stake) ensure agreement among nodes on the
validity of transactions.
2. Transactions:
o Digital Wallets: Users store their cryptocurrencies in digital wallets, which have public and private keys for
sending and receiving funds.
o Mining: In some cryptocurrencies, new coins are created through a process called mining, where powerful
computers solve complex mathematical problems.
Popular Cryptocurrencies
1. Bitcoin (BTC):
o Launched: 2009 by an anonymous person or group known as Satoshi Nakamoto.
o Purpose: Digital gold, store of value, and medium of exchange.
o Consensus Mechanism: Proof of Work.
2. Ethereum (ETH):
o Launched: 2015 by Vitalik Buterin.
o Purpose: Platform for decentralized applications (DApps) and smart contracts.
o Consensus Mechanism: Currently transitioning from Proof of Work to Proof of Stake.
3. Other Notable Cryptocurrencies:
o Ripple (XRP): Designed for fast, low-cost international payments.
o Litecoin (LTC): Aims to be the silver to Bitcoin’s gold, with faster transaction times.
o Cardano (ADA): Focuses on security, scalability, and sustainability.
Advantages of Cryptocurrencies
1. Decentralization: Reduces the risk of centralized control and single points of failure.
2. Transparency: Public ledgers ensure transparent and traceable transactions.
3. Security: Cryptographic techniques protect against fraud and counterfeiting.
4. Accessibility: Can be accessed and used by anyone with an internet connection.
Future of Cryptocurrencies
1. Blockchain Technology
Definition: A blockchain is a decentralized, distributed ledger that records transactions in a secure and transparent
manner.
2. Transactions
Initiation: A user initiates a transaction using a digital wallet, which contains private and public keys.
• Private Key: A secret key used to sign transactions, providing proof that the transaction came from the owner of the
wallet.
• Public Key: A public address that others use to send cryptocurrency to the wallet.
Nodes: Nodes are computers that maintain the blockchain. They validate transactions and add them to the
blockchain.
Consensus Mechanisms: Methods to achieve agreement among nodes on the validity of transactions.
• Proof of Work (PoW): Miners solve complex mathematical puzzles to validate transactions and add blocks to the
blockchain. The first miner to solve the puzzle gets to add the block and is rewarded with cryptocurrency.
• Proof of Stake (PoS): Validators are chosen to add blocks based on the number of coins they hold and are willing to
"stake" as collateral. Validators receive rewards in the form of transaction fees or newly created coins.
Mining: The process of validating transactions and adding them to the blockchain.
5. Confirmation
Block Confirmation: Once a block is added to the blockchain, the transactions within it are considered confirmed.
• Multiple Confirmations: For added security, multiple subsequent blocks must be added before a transaction is
considered fully confirmed and irreversible.
6. Security
Cryptographic Hashing: Each block contains a unique hash (a digital fingerprint) of the previous block, linking
them together and ensuring the integrity of the blockchain.
Immutability: Once a block is added, it cannot be altered without changing all subsequent blocks, making the
blockchain tamper-proof.
7. Digital Wallets
Storage: Users store their cryptocurrencies in digital wallets, which can be software-based (online or mobile apps)
or hardware-based (physical devices).
Transaction Signing: To send cryptocurrency, the user signs the transaction with their private key, which the
network then validates using the corresponding public key.
8. Use Cases
Payments: Cryptocurrencies can be used for peer-to-peer payments without intermediaries.
Smart Contracts: Some cryptocurrencies, like Ethereum, support smart contracts, which are self-executing
contracts with the terms directly written into code.
Decentralized Applications (DApps): Applications that run on blockchain networks without central control.
Conclusion
Cryptocurrencies leverage blockchain technology and cryptographic principles to enable secure, decentralized
digital transactions. This innovation has the potential to transform various industries by reducing reliance on
intermediaries, enhancing transparency, and providing new ways to store and transfer value.
Crowd funding:
Crowd funding in blockchain, often referred to as blockchain-based crowdfunding, leverages the decentralized
and transparent nature of blockchain technology to raise funds for various projects or initiatives. This approach
offers several advantages over traditional crowd funding methods, including increased transparency, security, and
efficiency. Here’s a detailed look at how crowdfunding works in the blockchain space:
Definition: An ICO is a fundraising method where a company or project issues its own cryptocurrency tokens to
investors in exchange for established cryptocurrencies like Bitcoin or Ethereum.
Process:
1. Whitepaper: The project team publishes a detailed whitepaper explaining the project, the technology, the team, and how
the funds will be used.
2. Token Creation: The project creates a new cryptocurrency token.
3. Crowdsale: Investors buy the new tokens using established cryptocurrencies.
4. Launch: Funds are used to develop the project, and tokens can be traded on cryptocurrency exchanges.
Advantages:
Risks:
• Regulatory Uncertainty: Varying regulations across countries can impact the legality and operation of ICOs.
• Scams and Frauds: The unregulated nature of ICOs has led to numerous fraudulent projects.
Definition: STOs are similar to ICOs but offer tokens that represent ownership in real assets, such as equity in a
company, real estate, or bonds. These tokens are considered securities and are subject to regulatory oversight.
Process:
1. Compliance: The project must comply with securities regulations in the jurisdictions where it operates.
2. Token Creation: Security tokens are created to represent ownership in the underlying asset.
3. Offering: Investors purchase security tokens through a regulated platform.
4. Launch: Funds are used for the project, and tokens may provide dividends or other financial benefits.
Advantages:
• Regulatory Clarity: Being compliant with securities laws provides legal protection for investors.
• Asset-Backed: Tokens are backed by real assets, reducing the risk of complete loss.
Risks:
• Regulatory Complexity: Navigating the regulatory landscape can be challenging and expensive.
• Liquidity: Security tokens may have restricted trading options compared to utility tokens.
Process:
1. Creation: The DAO is established with a set of smart contracts defining its rules and governance structure.
2. Funding: Participants buy DAO tokens to contribute funds.
3. Governance: Token holders vote on proposals and decisions related to the project.
4. Implementation: Funds are allocated based on the outcomes of votes.
Advantages:
• Decentralization: No single entity controls the organization, promoting transparency and democratization.
• Community Engagement: Token holders have a direct say in project decisions.
Risks:
• Smart Contract Vulnerabilities: Bugs or vulnerabilities in the smart contracts can be exploited.
• Decision-Making Efficiency: Consensus-driven governance can be slow and inefficient.
Definition: NFT crowdfunding involves issuing unique digital assets (NFTs) to backers in exchange for their
financial support. These NFTs can represent art, collectibles, or access to exclusive content.
Process:
Advantages:
• Unique Rewards: Backers receive unique digital assets that can appreciate in value.
• Community Building: NFTs can foster a sense of ownership and community among backers.
Risks:
1. Transparency: All transactions and fund allocations are recorded on the blockchain, providing clear visibility to all
participants.
2. Security: Blockchain’s cryptographic principles protect against fraud and unauthorized access.
3. Efficiency: Automated processes through smart contracts reduce the need for intermediaries and administrative
overhead.
4. Global Reach: Blockchain technology enables cross-border fundraising without the need for traditional financial
intermediaries.
1. Regulatory Environment: Navigating the regulatory landscape is crucial to ensure compliance and protect investors.
2. Technical Complexity: Implementing and maintaining blockchain solutions require technical expertise.
3. Market Volatility: The value of blockchain tokens can be highly volatile, impacting both fundraising and investment
returns.
4. Scams and Fraud: Due diligence is essential to avoid fraudulent projects and ensure the legitimacy of the fundraising
efforts.
Blockchain-based crowdfunding offers innovative ways to raise capital while providing greater transparency,
security, and efficiency. However, it also comes with its own set of challenges and risks that need to be carefully
managed.
Blockchain technology has a unique architecture and set of properties that distinguish it from traditional databases
and systems. Here’s a detailed overview of the architecture and key properties of blockchain:
Blockchain Architecture
1. Nodes
2. Ledger
3. Blocks
4. Transactions
5. Consensus Mechanisms
6. Cryptographic Hashing
7. Smart Contracts
1. Nodes
Definition: Nodes are individual computers that participate in the blockchain network. Each node maintains a
copy of the blockchain and can independently verify and record transactions.
• Full Nodes: Store the entire blockchain and participate in transaction validation.
• Light Nodes: Store only a portion of the blockchain and rely on full nodes for transaction verification.
2. Ledger
Definition: The ledger is a decentralized database that records all transactions in a transparent and immutable
manner.
• Distributed: Each node maintains a copy of the ledger, ensuring data redundancy and consistency.
• Immutable: Once recorded, data on the ledger cannot be altered or deleted.
3. Blocks
Definition: Blocks are containers that hold a list of transactions. Each block is linked to the previous one, forming
a chain.
• Block Header: Contains metadata such as the previous block's hash, a timestamp, and a nonce.
• Block Body: Contains the list of transactions.
4. Transactions
5. Consensus Mechanisms
Definition: Consensus mechanisms are protocols that nodes use to agree on the validity of transactions and the
state of the blockchain.
• Proof of Work (PoW): Nodes (miners) compete to solve a cryptographic puzzle. The first to solve it gets to add the block
and receive a reward.
• Proof of Stake (PoS): Validators are chosen to add blocks based on the number of coins they hold and are willing to
"stake."
• Delegated Proof of Stake (DPoS): Stakeholders elect a small number of delegates to validate transactions and add blocks.
6. Cryptographic Hashing
Definition: Cryptographic hashing is used to ensure the integrity and security of data on the blockchain.
• Hash Function: Takes an input and produces a fixed-size string of characters. Any change in the input results in a
completely different hash.
• Block Hash: Each block contains the hash of the previous block, linking them together.
7. Smart Contracts
Definition: Smart contracts are self-executing contracts with the terms directly written into code.
1. Decentralization
2. Transparency
3. Immutability
4. Security
5. Consensus
6. Programmability
1. Decentralization
Definition: Blockchain operates without a central authority, distributing control across all participating nodes.
Definition: All transactions are recorded on a public ledger that is visible to all participants.
3. Immutability
• Data Integrity: Ensures that historical data remains accurate and trustworthy.
• Security: Protects against tampering and fraud.
4. Security
5. Consensus
Definition: Consensus mechanisms ensure that all nodes agree on the state of the blockchain.
6. Programmability
Conclusion
The architecture and properties of blockchain provide a robust foundation for a wide range of applications, from
cryptocurrencies to supply chain management. Its decentralized, transparent, and secure nature offers significant
advantages over traditional systems, fostering trust and efficiency in digital transactions.
Digital identity verification is the process of using digital methods to confirm the identity of individuals online.
This process is crucial for ensuring security, preventing fraud, and complying with regulatory requirements.
Blockchain technology can significantly enhance digital identity verification by providing a secure,
decentralized, and immutable framework. Here’s a detailed look at digital identity verification and how
blockchain can be utilized:
1. Methods:
o Document Verification: Scanning and verifying government-issued IDs (e.g., passports, driver’s licenses).
o Biometric Verification: Using fingerprints, facial recognition, or iris scans to verify identity.
o Knowledge-Based Verification: Asking security questions that only the individual should know.
2. Challenges:
o Security: Centralized databases are vulnerable to breaches and hacking.
o Privacy: Personal information can be exposed or misused.
o Accessibility: Not all individuals have access to the required documents or technology.
o Fraud: Identity theft and fraud can still occur despite these measures.
Blockchain technology offers several advantages that can address the challenges faced by traditional identity
verification methods:
1. Decentralization:
o Definition: Blockchain eliminates the need for a central authority by distributing data across a network of nodes.
o Benefit: Reduces the risk of a single point of failure and makes it harder for hackers to compromise the system.
2. Immutability:
o Definition: Data once recorded on the blockchain cannot be altered or deleted.
o Benefit: Ensures the integrity and authenticity of identity information.
3. Security:
o Definition: Blockchain uses cryptographic techniques to secure data.
o Benefit: Protects against unauthorized access and tampering.
4. Transparency:
o Definition: Transactions and data on the blockchain are visible to all participants.
o Benefit: Increases trust and accountability.
5. Self-Sovereign Identity (SSI):
o Definition: Individuals have control over their own identity data.
o Benefit: Users can choose what information to share and with whom, enhancing privacy and security.
1. Identity Creation:
o User Registration: Users create a digital identity by registering on a blockchain-based platform.
o Document Upload: Users upload identity documents, which are verified by trusted entities (e.g., government agencies,
financial institutions).
o Data Encryption: Identity data is encrypted and stored on the blockchain.
2. Verification:
o Request: A service provider requests identity verification from the user.
o Consent: The user consents to share their identity information.
o Authentication: The service provider verifies the information against the blockchain.
3. Ongoing Management:
o Updates: Users can update their identity information as needed, with changes recorded immutably on the blockchain.
o Revocation: Users can revoke access to their identity information if needed.
1. Enhanced Security:
o Data Protection: Strong encryption and decentralized storage protect identity data from breaches.
o Reduced Fraud: Immutable records make it difficult for malicious actors to alter or forge identity information.
2. Increased Privacy:
o User Control: Individuals have greater control over their identity data, deciding what information to share and with
whom.
o Minimal Disclosure: Users can share only the necessary information for a specific transaction, preserving privacy.
3. Efficiency:
o Streamlined Processes: Automated verification processes reduce the time and cost associated with manual checks.
o Global Access: Blockchain enables cross-border identity verification, facilitating global transactions and services.
4. Compliance:
o Regulatory Adherence: Blockchain can help organizations comply with regulations such as GDPR by providing transparent
and auditable records of data access and sharing.
Use Cases
1. Financial Services:
o KYC (Know Your Customer): Streamlined and secure KYC processes for banks and financial institutions.
o AML (Anti-Money Laundering): Enhanced tracking and verification to prevent money laundering.
2. Healthcare:
o Patient Identity: Secure and portable digital identities for patients, enabling seamless access to medical records across
different providers.
3. Government Services:
o E-Government: Digital identities for accessing government services such as voting, tax filing, and social benefits.
4. Travel and Hospitality:
o Travel Verification: Simplified identity verification for travel bookings, check-ins, and border control.
1. Adoption:
o Interoperability: Ensuring compatibility between different blockchain platforms and existing systems.
o User Education: Educating users about the benefits and usage of blockchain-based identity systems.
2. Regulation:
o Legal Framework: Developing regulatory frameworks that recognize and support blockchain-based identities.
o Privacy Laws: Ensuring compliance with data protection and privacy regulations.
3. Scalability:
o Network Performance: Ensuring the blockchain network can handle a large number of identity transactions efficiently.
Block chain Neutrality:
Blockchain neutrality refers to the concept that blockchain technology operates independently of external
influences, biases, and central control. This neutrality is a fundamental principle of blockchain and contributes to
its appeal as a decentralized and transparent system. Here's a detailed overview of blockchain neutrality:
1. Decentralization
2. Transparency
3. Immutability
4. Permissionless Access
5. Open Source
1. Decentralization
Definition: Blockchain operates without a central authority, distributing control across a network of nodes.
• No Central Control: No single entity has the power to manipulate or control the blockchain.
• Resilience: The distributed nature reduces the risk of a single point of failure.
2. Transparency
Definition: All transactions and operations on a blockchain are visible to all participants.
3. Immutability
• Tamper-Proof: Ensures the integrity of the data, as changes would be evident to all participants.
• Trust: Builds trust among users, as the data cannot be retroactively modified.
4. Permissionless Access
Definition: Anyone can participate in a public blockchain network without needing approval from a central
authority.
5. Open Source
Definition: Many blockchain projects are developed as open-source software, meaning their source code is
publicly accessible.
• Transparency: Anyone can review and verify the code, ensuring it operates as intended.
• Collaboration: Encourages community collaboration and continuous improvement.
1. Censorship Resistance:
o Unalterable Transactions: Transactions cannot be censored or reversed by any central authority.
o Freedom of Participation: Anyone can transact without fear of censorship.
2. Trust and Security:
o Decentralized Trust: Trust is distributed across the network, reducing the reliance on a central authority.
o Secure Transactions: Cryptographic principles ensure the security of transactions and data.
3. Innovation and Accessibility:
o Open Innovation: The open-source nature and permissionless access promote innovation.
o Global Accessibility: Anyone, anywhere can participate and contribute.
4. Fairness and Equality:
o Equal Access: All participants have equal access to the network and its benefits.
o Bias Reduction: Eliminates biases that may arise from centralized control.
1. Regulation:
o Government Intervention: Governments may impose regulations that affect the neutrality of blockchain networks.
o Compliance: Balancing neutrality with regulatory compliance can be challenging.
2. Centralization Tendencies:
o Mining Pools: In Proof of Work blockchains, mining pools can accumulate significant power, potentially threatening
decentralization.
o Validator Centralization: In Proof of Stake blockchains, large stakeholders may have disproportionate influence.
3. Scalability and Performance:
o Network Congestion: High transaction volumes can lead to congestion, impacting performance.
o Scalability Solutions: Implementing scalable solutions while maintaining neutrality is a complex challenge.
4. Economic Factors:
o Transaction Fees: High transaction fees can limit accessibility, challenging the principle of permissionless access.
o Resource Requirements: Mining and validation can require significant resources, potentially centralizing power among
those with greater resources.
1. Decentralized Governance:
o Community Decision-Making: Decisions are made through consensus mechanisms that involve the community.
o DAO (Decentralized Autonomous Organizations): Governed by smart contracts and community votes.
2. Incentive Structures:
o Balanced Rewards: Ensuring fair and balanced incentives for miners and validators to prevent centralization.
o Economic Models: Designing economic models that promote widespread participation and prevent concentration of
power.
3. Technological Innovations:
o Layer 2 Solutions: Implementing solutions like Lightning Network or sidechains to improve scalability without
compromising neutrality.
o Privacy Enhancements: Integrating privacy-focused technologies to protect user data while maintaining transparency.
Digital art:
Digital art on the blockchain leverages blockchain technology to authenticate, distribute, and manage digital
artworks in a decentralized and transparent manner. This integration has revolutionized the art world, giving rise
to new forms of ownership, provenance tracking, and monetization. Here’s a detailed overview of digital art in
the context of blockchain:
Key Concepts
Definition: NFTs are unique digital assets representing ownership of a specific item or piece of content, such as
digital art. Unlike cryptocurrencies like Bitcoin, which are fungible (each unit is identical), NFTs are unique and
cannot be exchanged on a one-to-one basis.
• ERC-721 and ERC-1155: Common standards on the Ethereum blockchain for creating NFTs. ERC-721 defines a single
unique asset, while ERC-1155 allows for both unique and fungible assets.
• Metadata: Each NFT contains metadata, such as the artist’s name, description of the artwork, and a link to the digital file.
Provenance: Blockchain provides a transparent and immutable ledger for tracking the ownership history of
digital artworks.
3. Decentralized Marketplaces
Definition: Online platforms built on blockchain technology where artists can mint, display, and sell their digital
art directly to collectors.
Smart Contracts: Enable automatic execution of terms, such as payment of royalties to artists whenever their
artwork is resold.
• Continuous Revenue: Artists can receive a percentage of the sale price every time their work is resold in secondary
markets.
• Programmable Conditions: Smart contracts can include various terms and conditions tailored to the artist’s preferences.
Interoperability: Ensures that NFTs created on one platform can be transferred and used on other platforms and
ecosystems.
• Standards Compliance: Using widely accepted standards like ERC-721 and ERC-1155 ensures compatibility across
different platforms.
• Cross-Chain Solutions: Efforts to enable NFTs to operate across different blockchain (e.g., Ethereum, Finance, Smart
Chain, Flow) are in development.
1. Environmental Impact:
o Energy Consumption: Many blockchains, especially Ethereum, consume significant energy, raising concerns about
environmental impact.
o Solutions: Transition to more energy-efficient consensus mechanisms (e.g., Ethereum’s move to Proof of Stake) and use
of layer 2 solutions.
2. Market Volatility:
o Price Fluctuations: The value of NFTs can be highly volatile, leading to speculative bubbles.
o Market Saturation: An influx of digital art can saturate the market, affecting prices and sales.
3. Intellectual Property:
o Copyright Issues: Ensuring that the artist has the right to mint and sell the digital artwork.
o Unauthorized Copies: Addressing the issue of unauthorized copies and plagiarism.
4. User Experience:
o Accessibility: Simplifying the process of buying, selling, and storing NFTs for non-technical users.
o Security: Ensuring the security of digital wallets and protecting against hacks and theft.
Blockchain Environment:
The blockchain environment encompasses the infrastructure, technologies, and ecosystems that enable
blockchain networks to operate effectively. This includes the underlying architecture, consensus mechanisms,
development platforms, and the regulatory and social landscape in which blockchain systems function. Here’s an
in-depth look at the key components of the blockchain environment:
1. Blockchain Architecture
2. Consensus Mechanisms
3. Development Platforms
4. Nodes and Network Infrastructure
5. Security Measures
6. Regulatory Landscape
7. Ecosystem and Community
8. Use Cases and Applications
9. Environmental Impact
1. Blockchain Architecture
Definition: The structural design of a blockchain network, including its data model, cryptographic foundations,
and transaction processing mechanisms.
• Data Structure: Blockchains store data in blocks that are linked together in a chain. Each block contains a list of
transactions and a reference to the previous block.
• Cryptography: Ensures data integrity and security through techniques such as hashing and digital signatures.
• Smart Contracts: Self-executing contracts with the terms directly written into code, enabling automation and
decentralized applications (DApps).
2. Consensus Mechanisms
Definition: Protocols used by blockchain networks to achieve agreement on the state of the ledger among
distributed nodes.
• Proof of Work (PoW): Miners solve cryptographic puzzles to add new blocks. Energy-intensive and secure.
• Proof of Stake (PoS): Validators are chosen to create new blocks based on the number of coins they hold and are willing
to "stake." More energy-efficient than PoW.
• Delegated Proof of Stake (DPoS): Stakeholders elect delegates to validate transactions and add blocks, enhancing
scalability and efficiency.
• Other Mechanisms: Includes Proof of Authority (PoA), Proof of Burn (PoB), and Byzantine Fault Tolerance (BFT).
3. Development Platforms
Definition: Frameworks and tools that developers use to build and deploy blockchain applications.
Definition: The computers and devices that participate in and maintain the blockchain network.
5. Security Measures
Definition: Mechanisms to protect the blockchain network from attacks and ensure data integrity.
• Cryptographic Techniques: Use of public and private keys, digital signatures, and hashing.
• Consensus Security: Protocols designed to prevent malicious actors from gaining control (e.g., 51% attack).
• Smart Contract Audits: Reviewing and testing smart contract code to identify vulnerabilities.
6. Regulatory Landscape
Definition: The legal and regulatory framework governing blockchain technology and its applications.
• Compliance: Ensuring blockchain operations adhere to laws such as GDPR (General Data Protection Regulation) and AML
(Anti-Money Laundering).
• Government Policies: Varies by country; some are more supportive (e.g., Malta, Switzerland), while others have
restrictive regulations (e.g., China).
• Legal Status of Cryptocurrencies: Varies widely, impacting how blockchain projects are developed and deployed.
Definition: The broader network of stakeholders involved in the blockchain space, including developers,
investors, users, and organizations.
• Open Source Communities: Collaboration and innovation driven by open-source projects and contributions.
• Industry Consortia: Groups of companies and organizations working together to develop and promote blockchain
standards (e.g., Enterprise Ethereum Alliance).
• Events and Conferences: Forums for knowledge sharing, networking, and collaboration (e.g., Consensus, Devcon).
Definition: The ecological footprint of blockchain operations, particularly concerning energy consumption.
• Energy Consumption: PoW blockchains like Bitcoin consume significant energy, raising environmental concerns.
• Sustainability Initiatives: Efforts to reduce energy usage, such as transitioning to PoS or using renewable energy sources.
• Carbon Footprint: The overall impact of blockchain operations on carbon emissions and climate change.
Blockchain technology has a wide range of applications across industries, offering innovative solutions to
various challenges. However, it also faces several challenges that need to be addressed for broader adoption and
scalability. Here’s an overview of blockchain applications and the associated challenges:
Blockchain Applications
1. Financial Services
o Cryptocurrencies: Digital currencies like Bitcoin and Ethereum enable secure and decentralized transactions.
o Cross-Border Payments: Facilitate faster and cheaper international money transfers.
o Smart Contracts: Automate contract execution with predefined conditions and terms.
2. Supply Chain Management
o Traceability: Track the provenance of goods from origin to final delivery, enhancing transparency and reducing fraud.
o Authentication: Verify the authenticity of products and prevent counterfeit goods.
3. Healthcare
o Medical Records: Securely store and share patient data across healthcare providers while maintaining privacy and
compliance.
o Clinical Trials: Improve transparency and traceability in drug development and clinical trial processes.
4. Identity Management
o Digital Identity: Provide individuals with self-sovereign identities, enabling secure and verifiable digital credentials.
o KYC/AML: Streamline Know Your Customer (KYC) and Anti-Money Laundering (AML) processes while protecting sensitive
information.
5. Voting Systems
o Elections: Enhance the security, transparency, and auditability of voting processes, reducing the risk of fraud.
6. Real Estate
o Property Transactions: Simplify and expedite property transfers and transactions, reducing paperwork and costs.
o Land Title Registration: Securely record and manage land ownership records, reducing disputes and fraud.
7. Intellectual Property
o Copyright Protection: Enable creators to timestamp and prove ownership of digital content, reducing piracy and
unauthorized use.
o
8. Insurance
o Claims Processing: Automate and streamline claims verification and processing, reducing administrative costs and fraud.
Challenges
1. Scalability
o Transaction Speed: Some blockchains face limitations in transaction throughput, hindering widespread adoption for high-
volume applications.
o Network Congestion: High demand can lead to delays and increased transaction fees.
2. Interoperability
o Blockchain Compatibility: Lack of standardized protocols makes it challenging for different blockchains to communicate
and share data.
o Cross-Chain Transactions: Difficulty in exchanging assets or information between different blockchain networks.
3. Security
o 51% Attacks: PoW blockchains can be vulnerable if a single entity gains majority control of the network’s hashing power.
o Smart Contract Vulnerabilities: Bugs or vulnerabilities in smart contract code can lead to exploits and financial losses.
4. Regulatory Uncertainty
o Compliance: Navigating varying regulatory frameworks globally, particularly concerning cryptocurrencies and tokenized
assets.
o Legal Clarity: Uncertainty about legal status, taxation, and enforcement of blockchain transactions and contracts.
5. Privacy
o Public Ledger: Challenges in protecting sensitive information while maintaining transparency and accountability.
o Data Protection: Ensuring compliance with privacy laws such as GDPR, especially in sectors like healthcare and finance.
6. Energy Consumption
o Environmental Impact: Proof of Work (PoW) consensus mechanisms consume significant energy, raising concerns about
sustainability.
o Energy Efficiency: Transitioning to more energy-efficient consensus mechanisms like Proof of Stake (PoS) or exploring
green blockchain solutions.
7. User Experience
o Complexity: Blockchain technology can be complex for non-technical users, impacting adoption and usability.
o Wallet Security: Risks associated with managing private keys and digital wallets, including hacks and theft.
• Scalability Solutions: Implementing layer 2 solutions (e.g., Lightning Network) to improve transaction speed and reduce
fees.
• Interoperability Standards: Developing and adopting interoperable protocols and standards to facilitate communication
between different blockchains.
• Security Audits: Conducting rigorous audits of smart contracts and blockchain protocols to identify and mitigate
vulnerabilities.
• Regulatory Engagement: Working with regulators to establish clear guidelines and frameworks that foster innovation
while ensuring compliance.
• Privacy Enhancements: Integrating privacy-preserving technologies (e.g., zero-knowledge proofs) to protect sensitive
data while maintaining transparency.
• Sustainable Practices: Promoting energy-efficient consensus mechanisms and exploring renewable energy sources for
blockchain operations.
• Education and User-Friendly Interfaces: Simplifying blockchain interfaces and providing educational resources to
enhance understanding and usability.
UNIT–II
Types of Blockchain: Blockchain Components – Permissioned Blockchain – Permission less, Blockchain –
Consortium Blockchain – Consensus – Proof of Work, Proof of Stack, Proof of Burn, Proof of Elapsed Time
– Mining – Consensus Algorithms: PAXOS consensus Algorithm – RAFT consensus Algorithm – Byzantine
general problem – Practical Byzantine fault tolerance Algorithm – Three phase commit Protocol.
Types of Blockchains
1. Public Blockchain
o Definition: A decentralized blockchain network where anyone can participate, read, write, and validate
transactions.
o Key Features:
▪ Open Access: Anyone can join the network and participate in transaction validation (e.g., Bitcoin,
Ethereum).
▪ Transparency: All transactions are publicly visible on the blockchain ledger.
▪ Security: Relies on consensus mechanisms like Proof of Work (PoW) or Proof of Stake (PoS) for validation.
o Use Cases: Cryptocurrencies, decentralized applications (DApps), and global payment systems.
2. Private Blockchain
o Definition: A blockchain network where access to participate in the network and read/write transactions is
restricted to a specific group or organization.
o Key Features:
▪ Permissioned Access: Participants are known entities and require permission to join and interact with the
network.
▪ Privacy: Control over who can view and validate transactions, offering higher privacy than public
blockchains.
▪ Efficiency: Generally faster and more scalable than public blockchains due to fewer nodes.
o Use Cases: Enterprise applications, supply chain management, and consortium networks.
3. Consortium Blockchain
o Definition: A semi-decentralized blockchain where multiple organizations control the consensus process and
maintain the network.
Key Features:
▪ Shared Control: Several pre-selected nodes validate transactions and manage the blockchain network.
▪ Partially Decentralized: Balances the benefits of decentralization with the efficiency of a private network.
▪ Trust: Greater trust among participants compared to fully public or fully private networks.
o Use Cases: Industry consortia, financial services, and collaborative platforms.
Blockchain Components
3. Consensus Mechanism
o Definition: Protocols that ensure all nodes in a blockchain network agree on the current state of the ledger.
o Types:
▪ Proof of Work (PoW): Requires computational work (mining) to validate transactions and create new
blocks (e.g., Bitcoin).
▪ Proof of Stake (PoS): Validators are chosen based on the amount of Cryptocurrency they hold and are
willing to "stake" (e.g., Ethereum 2.0).
▪ Delegated Proof of Stake (DPoS): Uses elected delegates to validate transactions (e.g., EOS).
▪ Other Consensus Algorithms: Byzantine Fault Tolerance (BFT), Practical Byzantine Fault Tolerance (PBFT),
etc.
4. Smart Contracts
o Definition: Self-executing contracts with the terms of the agreement directly written into code.
o Purpose: Automates and enforces the execution of agreements, reducing the need for intermediaries and
enhancing transparency.
5. Nodes
o Definition: Devices (computers or servers) that maintain a copy of the blockchain and participate in transaction
validation.
o Types:
▪ Full Nodes: Store complete copies of the blockchain and validate all transactions.
▪ Light Nodes: Store partial copies of the blockchain and rely on full nodes for verification.
6. Wallets
o Definition: Software or hardware that stores public and private keys used to access and manage Cryptocurrency
holdings.
o Types:
▪ Hot Wallets: Connected to the internet for frequent transactions.
▪ Cold Wallets: Offline storage for long-term holdings, enhancing security.
7. Blockchain Explorer
o Definition: Web-based tool or interface that allows users to view and interact with blockchain data.
o Features: Provides information about transactions, blocks, addresses, and network statistics.
Permissioned Blockchain
1. Access Control: Participants must be granted permission to join the network and participate in the consensus
mechanism.
2. Identity Verification: Participants are typically known entities with verified identities, which contrasts with
the pseudonymous nature of participants in public blockchains.
3. Performance: Permissioned blockchains can often achieve higher transaction throughput compared to public
blockchains due to fewer nodes and a controlled consensus mechanism.
4. Governance: Governance is typically centralized or distributed among the consortium members, allowing for
quicker decision-making compared to decentralized governance in public blockchains.
5. Privacy: Depending on the design, permissioned blockchains may offer improved privacy features, such as
data confidentiality among participants.
6. Use Cases: They are often favored by enterprises and organizations looking to leverage blockchain
technology for specific applications, such as supply chain management, financial transactions, and regulatory
compliance, where controlled access and governance are crucial.
Examples of permissioned blockchain platforms include Hyperledger Fabric, Corda, and Quorum. These
platforms are designed to support enterprise-level applications that require scalability, privacy, and regulatory
compliance while still benefiting from blockchain technology's security and immutability.
Permission less
A permissionless blockchain is a type of blockchain where anyone can participate in the network, contribute to
the consensus process, and validate transactions without needing permission from any central authority. This
contrasts with permissioned blockchains, where access is restricted to approved entities.
1. Decentralization: Permissionless blockchains are decentralized networks where nodes (participants) are spread
globally and contribute to the consensus mechanism collectively.
2. Open Access: Anyone can join the network, run a node, and participate in the validation of transactions. There
are no barriers to entry based on identity or institutional affiliation.
3. Security: Security is achieved through cryptographic techniques and consensus algorithms (like Proof of Work
in Bitcoin or Proof of Stake in Ethereum) that ensure the integrity and immutability of the blockchain.
4. Anonymity: Participants in permissionless blockchains are often pseudonymous, meaning their real-world
identities are not necessarily tied to their blockchain addresses.
5. Transparency: The entire transaction history and ledger are publicly accessible to all participants, ensuring
transparency and auditability.
6. Use Cases: Permissionless blockchains are commonly associated with cryptocurrencies like Bitcoin and
Ethereum, where the focus is on enabling peer-to-peer transactions, decentralized finance (DeFi) applications,
and tokenization of assets without the need for intermediaries.
Examples of permissionless blockchain networks include Bitcoin, Ethereum, Litecoin, and many others. These
networks operate on the principles of decentralization, trustlessness, and openness, enabling a wide range of
applications beyond just financial transactions, including smart contracts, decentralized applications (dApps),
and token issuance.
Consortium Blockchain
A consortium blockchain is a type of blockchain that operates under the control of a group of pre-selected
nodes (often referred to as consortium members or participants) rather than being open to the public or
controlled by a single entity (as in a private blockchain). It represents a middle ground between public and
private blockchains, offering some degree of decentralization and trust among a defined set of participants.
1. Limited Access: Access to participate in the blockchain network is restricted to a predefined group of nodes or
organizations, known as consortium members. These members typically have known identities and are trusted
entities within the consortium.
2. Consensus Mechanism: Consortium blockchains use various consensus mechanisms, which are agreed upon
by the consortium members. Examples include Practical Byzantine Fault Tolerance (PBFT), Proof of
Authority (PoA), or variations of Proof of Stake (PoS).
3. Decentralization: Consortium blockchains are decentralized among the consortium members, providing
benefits such as resilience, fault tolerance, and redundancy, without requiring the extensive computational
resources of public blockchains.
4. Performance: Compared to public blockchains, consortium blockchains can offer higher transaction
throughput and lower latency due to the smaller number of validating nodes and controlled consensus
algorithms.
5. Governance: Governance in consortium blockchains can vary but often involves decision-making among the
consortium members regarding updates, changes to the blockchain protocol, and network operations.
6. Use Cases: Consortium blockchains are commonly used in industries where multiple organizations need to
share and verify data in a secure and decentralized manner. Examples include supply chain management,
healthcare data sharing, financial services, and government applications.
Consensus – Proof of Work, Proof of Stack, Proof of Burn, Proof of Elapsed Time
Consensus mechanisms are fundamental to blockchain networks as they ensure that all participants agree on
the state of the blockchain, particularly concerning the validity and ordering of transactions. Here's an
overview of some consensus mechanisms:
Proof of Work
Proof of Work consensus is the mechanism of choice for the majority of cryptocurrencies currently in
circulation. The algorithm is used to verify the transaction and create a new block in the
blockchain. Cryptocurrencies like Litecoin, and Bitcoin are currently using PoW. Ethereum was using PoW
mechanism, but now shifted to Proof of Stake(PoS).
Purpose of PoW
The purpose of a consensus mechanism is to bring all the nodes in agreement, that is, trust one another,
in an environment where the nodes don’t trust each other.
• All the transactions in the new block are then validated and the new block is then added to the blockchain.
• The block will get added to the chain which has the longest block height(see blockchain forks to understand
how multiple chains can exist at a point in time).
• Miners(special computers on the network) perform computation work in solving a complex mathematical
problem to add the block to the network, hence named, Proof-of-Work.
• With time, the mathematical problem becomes more complex.
How Does PoW Work?
The PoW consensus algorithm involves verifying a transaction through the mining process. This section
focuses on discussing the mining process and resource consumption during the mining process.
Mining:
The Proof of Work consensus algorithm involves solving a computationally challenging puzzle in order to
create new blocks in the Bitcoin blockchain. The process is known as ‘mining’, and the nodes in the network
that engages in mining are known as ‘miners’.
• The incentive for mining transactions lies in economic payoffs, where competing miners are rewarded with
6.25 bitcoins and a small transaction fee.
• This reward will get reduced by half its current value with time.
Energy and Time consumption in Mining:
The process of verifying the transactions in the block to be added, organizing these transactions in
chronological order in the block, and announcing the newly mined block to the entire network does not take
much energy and time.
• The energy-consuming part is solving the ‘hard mathematical problem’ to link the new block to the last block
in the valid blockchain.
• When a miner finally finds the right solution, the node broadcasts it to the whole network at the same time,
receiving a cryptocurrency prize (the reward) provided by the PoW protocol.
Proof of Stack
Proof-of-stake is a blockchain consensus mechanism for processing transactions and creating new blocks. A
consensus mechanism is a method for validating entries into a distributed database and keeping the database
secure. In the case of cryptocurrency, the database is called a blockchain—so the consensus mechanism
secures the blockchain.
• Under proof-of-stake (POS), validators are chosen based on the number of staked coins they have.
• Proof-of-stake (POS) was created as an alternative to proof-of-work (POW), the original consensus mechanism
used to validate transactions and open new blocks.
• While PoW mechanisms require miners to solve cryptographic puzzles, PoS mechanisms require validators to
hold and stake tokens for the privilege of earning transaction fees.
• Proof-of-stake (POS) is seen as less risky regarding the potential for an attack on the network, as it structures
compensation in a way that makes an attack less advantageous.
• The next block writer on the blockchain is selected at random, with higher odds being assigned to nodes with
larger stake positions.
What is Proof-of-Stake:
As understandable from the name, nodes on a network stake an amount of cryptocurrency to become
candidates to validate the new block and earn the fee from it. Then, an algorithm chooses from the pool of
candidates the node which will validate the new block. This selection algorithm combines the quantity of stake
(amount of cryptocurrency) with other factors (like coin-age based selection, randomization process) to make
the selection fair to everyone on the network.
• Coin-age based selection:
The algorithm tracks the time every validator candidate node stays a validator. The older the node becomes,
the higher the chances of it becoming the new validator.
• Random Block selection:
The validator is chosen with a combination of ‘lowest hash value’ and ‘highest stake’. The node having the
best weighted-combination of these becomes the new validator.
A typical PoS based mechanism workflow:
1. Nodes make transactions. The PoS algorithm puts all these transactions in a pool.
2. All the nodes contending to become validator for the next block raise a stake. This stake is combined with
other factors like ‘coin-age’ or ‘randomized block selection’ to select the validator.
3. The validator verifies all the transactions and publishes the block. His stake still remains locked and the
forging reward is also not granted yet. This is so that the nodes on the network can ‘OK’ the new block.
4. If the block is ‘OK’-ed, the validator gets the stake back and the reward too. If the algorithm is using a coin-
age based mechanism to select validators, the validator for the current block’s has its coin -age reset to 0. This
puts him in a low-priority for the next validator election.
5. If the block is not verified by other nodes on the network, the validator loses its stake and is marked as ‘bad’
by the algorithm. The process again starts from step 1 to forge the new block.
Blockchain technology is a distributed ledger used to record any transactions that happen over the network
and since Bitcoin’s inception and the introduction of the Proof of Work (PoW) consensus model as the
mechanism for a blockchain network’s legitimacy. After numerous other consensus mechanisms have been
experimented with and introduced, the Proof of Elapsed Time (PoET) concept is one such mechanism
which was invented in early 2016 by Intel Corporation and is one of the fairest blockchain consensus
algorithms that enables permissioned blockchain networks to determine who creates the next block.
Intel in collaboration with other organizations such as the Linux Project and IBM sponsored
the Hyperledger Sawtooth project, this open-source project uses the PoET consensus mechanism.
Hyperledger Sawtooth is a distributed ledger that is both scalable and adaptable for many uses at the
enterprise like supply chain and logistics. This mechanism is based on Byzantine Fault Tolerance and aims
to reduce the energy consumption associated with proof of work’s mining process.
• This algorithm assigns an amount of time to each node in the network randomly.
• The node must sleep or do another task for that random wait time.
• The node that gets the shortest waiting time wakes up and adds its block to the network.
• The newly updated information floods among the network participants.
3 Factors Need to Be in Favor for PoEt to Work:
1. Ensure that the node gets the random waiting time instead.
2. Check if the nodes are not choosing the shortest wait time on purpose.
3. Verify if a node has completed the given waiting time or not.
How Does PoET Work?
The PoET mechanism replaces the need for mining intensive rights required in Proof of Work with a
randomized timer system. The PoET consensus mechanism distributes the chances of winning across the
largest possible number of network participants and every node is likely to be selected by a fair lottery
system.
• Every node in the blockchain network will generate a random wait time and then sleeps for that specified
duration.
• Now the first one to wake up, that is, the first node in the network to have its timer expire after completing
its specified waiting time wins the block round and it now becomes the block leader which produces the
new block and signs the new block with its private key address before adding it to the blockchain network.
• After this necessary information is broadcasted to the whole peer network and the same process then repeats
for the discovery of the next block.
In this consensus mechanism the problem is ” how to determine the leader of a round of consensus” and
whoever solves the computationally intensive cryptographic puzzle of each block round is selected as the
leader for the round. For the node to participate in consensus, it downloads the trusted code which requires
code attestation by Intel Software Guard Extension (SGX). SGX functions as a Trusted Execution
Environment (TEE), which allows selecting, trusted code to run independently of the application that it runs
in.
The PoET consensus mechanism is divided into 2 phases:
1. Selection Process: This process involves the following activities:
• Every node in the network will share its certificate by Intel Software Guard Extension (SGX) which ensures
the validity of the node to generate a new block in the network. After this, the node is eligible to get a timer
object.
• The numbers are assigned to each node as a timer object by Intel’s RAND i.e. random number generator.
RAND generates difficult-to-detect random numbers.
• The time object given to each participating node activates.
2. Generation Process: This process involves the following activities:
• After the timer object expires, and the node wakes up then the node is eligible to forge a new block to the
network.
• The active node generates the hash of its block of transactions and submits it for acceptance.
• The update gets flooded to the network.
Consensus Algorithms:
Blockchain is a distributed ledger. Suppose there are 5 mining nodes and all these nodes will be having a copy
of a blockchain all the copies will be of the same state, which means they are exact copies. If there is a new
block and this block is supposed to be added to a blockchain, then which mining node will do it? How you will
make sure that all the nodes come to a consensus and they will have the same copy of it that’s where we have to
follow some consensus algorithm.
In a blockchain world, there are so many consensus algorithms, using which one can agree on one particular
state of a blockchain. So, if a new block is added to a blockchain, who will add it that can be defined using
consensus?
What is a Consensus Mechanism?
The consensus mechanism word is made up of two words: The consensus part means to have a bunch of people
agree and the mechanism means the routine procedure to get there. So, consensus mechanism means a
procedure that will be used to make sure everyone agrees on something.
• A consensus mechanism is a system that is used to verify transactions and maintain the security of a blockchain
network on decentralized networks.
• It provides a way to come to an agreement on a single state of the network or single data value. In the case of
cryptocurrencies, technically they are agreeing on the blockchain. More specifically the state of the blockchain
includes individual transactions and even more advanced parts like data and small contracts.
There are several types of consensus mechanisms, and each works in a different way to ensure that all
participants in the network agree on the validity of transactions and blocks that are added to the blockchain.
How Does the PAXOS Consensus Algorithm Work?
PAXOS is a complex algorithm with several variations. This explanation focuses on a basic version,
highlighting the three key phases that involve message exchanges between proposers and acceptors:
1. Prepare Phase
1. The proposer initiates the process by sending a “prepare” message with a unique proposal number to all
acceptors.
2. This message inquires if the acceptors have previously accepted a value for the same round (identified by the
proposal number).
3. The round number helps prevent conflicts arising from concurrent proposals. Imagine two proposers suggesting
different values at roughly the same time. The round number ensures that only proposals from the latest round
are considered.
2. Promise Phase
If an acceptor has already accepted a value for the same round (perhaps from a previous proposal), it includes
that value in its response. This information is crucial for the proposer, as it helps identify any potential conflicts
or ongoing consensus processes.
3. Accept Phase
1. Based on the promises received, the proposer broadcasts an “accept” message to all acceptors. This message
contains the proposed value and any previously accepted values learned from the promise phase. This allows all
nodes to learn about the proposed value and potential conflicts.
2. If a majority of acceptors respond with a promise indicating they haven’t accepted a different value for the
round, the proposer considers the value accepted. This signifies that the proposed value has gained enough
support to be considered the agreed-upon value.
PAXOS is a complex algorithm with several variations. This simplified explanation focuses on a basic version
to provide a foundational understanding. More intricate variations incorporate additional message exchanges
and mechanisms to handle edge cases and improve fault tolerance.
A diagram illustrating the three phases of the PAXOS Consensus Algorithm: Prepare, Promise, and Accept.
The diagram shows arrows representing messages exchanged between proposers and acceptors.
This image depicts the three key phases of the PAXOS Consensus Algorithm: Prepare, Promise, and Accept.
The arrows represent messages exchanged between proposers and acceptors during each phase.
Problems with PAXOS
Complexity
1. Steep Learning Curve: PAXOS is notoriously complex. Understanding the intricacies of the message
exchanges, failure scenarios, and the overall logic behind the algorithm can be quite challenging, especially for
those new to distributed systems.
2. Multiple Variations: PAXOS exists in several variations, each with its nuances. This can further add to the
confusion, as someone needs to understand the specific variant being used in a particular system.
3. Debugging Challenges: Debugging troubles in a PAXOS implementation can be a frightening task. The
dispensed nature of the set of rules and the asynchronous message float makes it tough to pinpoint the precise
purpose of issues.
Performance
1. Message Overhead: PAXOS relies on multiple phases of message exchanges between proposers, acceptors,
and learners. This constant communication can lead to significant message overhead, especially in large-scale
distributed systems with many nodes.
2. Latency Issues: The asynchronous nature of the community can introduce delays in message delivery. This can
cause situations where the consensus process takes longer to complete, impacting basic machine performance.
3. Scalability Concerns: While PAXOS can theoretically characteristic in systems with various numbers of
nodes, the message overhead can turn out to be a widespread bottleneck because the device scales. This can
restrict its suitability for extraordinarily large-scale deployments.
Other Considerations
1. Limited Practical Use: Due to its complexity, PAXOS hasn’t visible sizable adoption in actual-international
dispensed structures. Other algorithms stimulated using PAXOS, like Raft, offer an extra practical opportunity
with a simpler design and better overall performance traits.
2. Error-Prone Implementation: Implementing PAXOS correctly may be errors-inclined. Even minor mistakes
in the code can cause unpredictable conduct and capacity inconsistencies inside the distributed machine.
While PAXOS gives a powerful theoretical basis for accomplishing consensus, its complexity and performance
limitations make it much less than best for plenty of sensible programs. Alternative algorithms like Raft offer
an extra on hand and green approach to disbursed consensus
Addressing PAXOS Issues
Focus on Simplicity
1. Algorithms like Raft prioritize a simpler design philosophy compared to PAXOS. They achieve consensus with
fewer message exchanges and a well-defined role structure (leader and followers). This makes them easier to
understand, implement, and debug.
2. Reduced message complexity translates to less network overhead, potentially leading to improved performance
in large-scale deployments.
Leader-Based Approach
1. Raft employs a leader-based approach. This eliminates the need for complex multi-phase negotiations like those
in PAXOS. The leader coordinates the consensus process, sending proposals to followers and ensuring
agreement.
2. This leader election mechanism simplifies the overall flow and reduces the number of messages required
compared to PAXOS’ decentralized approach.
Addressing Performance Bottlenecks
1. By streamlining message exchanges, Raft can potentially achieve faster consensus compared to PAXOS,
especially in scenarios with high network latency or large numbers of nodes.
2. The leader-based approach can also improve responsiveness, as the leader takes a more active role in driving
the consensus process forward.
Improved Maintainability
1. The simpler design of algorithms like Raft makes them easier to maintain and reason about. Debugging issues
becomes less challenging due to the well-defined roles and communication patterns.
Trade-offs and Considerations
1. While Raft gives a compelling alternative, it’s crucial to renowned that there are alternate-offs. Raft introduces
a single factor of failure (the chief). If the chief crashes, the consensus method can stall till a brand new chief is
elected.
2. PAXOS, alternatively, is generally considered more fault-tolerant as it would not depend upon an unmarried
leader. However, its complexity could make coping with failures more complicated.
Choosing the Right Algorithm
1. The desire between PAXOS and alternative algorithms like Raft relies upon unique device requirements. If
simplicity, overall performance, and ease of use are priorities, Raft is probably a better fit.
2. However, if fault tolerance is paramount and the system can handle the complexity of PAXOS, it could still be
a viable option.
While PAXOS remains a significant theoretical contribution, its complexity has led to the development of more
practical alternatives. By focusing on simplicity, leader-based approaches, and reduced message overhead,
algorithms like Raft offer a more efficient and manageable solution for achieving consensus in distributed
systems.
Here are the key aspects and principles of the Raft consensus algorithm:
1. Roles:
o Leader: Responsible for managing the replication of the log and handling client requests. There is only
one leader at any given time.
o Follower: Passive role that simply follows the leader’s instructions and replicates the leader’s log.
o Candidate: Transitions to this state when a follower or leader election fails, and it tries to become the
new leader.
2. Terms:
o Time in Raft is divided into terms, where each term begins with an election.
o Terms prevent outdated leaders from improperly modifying the log.
3. Leader Election:
o Raft uses randomized timeouts to elect leaders, reducing the likelihood of split votes.
o A follower will start an election if it does not receive a heartbeat from the leader within a specified time
frame.
4. Log Replication:
o Clients send requests to the leader, which appends the requests to its log and replicates them across the
cluster.
o Once a majority of nodes have appended the log entry, it is considered committed.
5. Safety and Liveness:
o Safety: Raft ensures only one leader can be elected per term and guarantees that committed log entries
are consistent across all nodes.
o Liveness: The algorithm ensures progress even in the presence of leader failures or network partitions by
holding new leader elections.
6. Advantages:
o Raft is designed to be more understandable than Paxos, with a clearer separation of leader election and
log replication phases.
o It also handles scenarios like leader failure and re-elections in a straightforward manner.
7. Usage:
o Raft is used in various distributed systems and databases to achieve fault tolerance and consistency, such
as in distributed key-value stores, replicated state machines, and distributed databases like etcd.
So, to understand Raft, we shall first have a look at the problem which the Raft protocol tries to solve and that
is achieving Consensus. Consensus means multiple servers agreeing on same information, something
imperative to design fault-tolerant distributed systems. Lets describe it with the help of couple visuals.
So, lets first define the process used when a client interacts with a server to clarify the process.
Process : The client sends a message to the server and the server responds back with a reply.
A consensus protocol tolerating failures must have the following features :
• Validity : If a process decides(read/write) a value, then it must have been proposed by some other correct
process
• Agreement : Every correct process must agree on the same value
• Termination : Every correct process must terminate after a finite number of steps.
• Integrity : If all correct processes decide on the same value, then any process has the said value.
Now, there can be two types of systems assuming only one client(for the sake of understandability):
• Single Server system : The client interacts with a system having only one server with no backup. There is no
problem in achieving consensus in such a system.
• Multiple Server system : The client interacts with a system having multiple servers. Such systems can be of
two types :
o Symmetric :- Any of the multiple servers can respond to the client and all the other servers are supposed to
sync up with the server that responded to the client’s request, and
o Asymmetric :- Only the elected leader server can respond to the client. All other servers then sync up with the
leader server.
Such a system in which all the servers replicate(or maintain) similar data(shared state) across time can for
now be referred to as, replicated state machine.
We shall now define some terms used to refer individual servers in a distributed system.
• Leader – Only the server elected as leader can interact with the client. All other servers sync up themselves
with the leader. At any point of time, there can be at most one leader(possibly 0, which we shall explain
later)
• Follower – Follower servers sync up their copy of data with that of the leader’s after every regular time
intervals. When the leader server goes down(due to any reason), one of the followers can contest an election
and become the leader.
• Candidate – At the time of contesting an election to choose the leader server, the servers can ask other
servers for votes. Hence, they are called candidates when they have requested votes. Initially, all servers are
in the Candidate state.
So, the above system can now be labelled as in the following snap.
CAP theorem CAP Theorem is a concept that a distributed database system can only have 2 of the 3:
• Consistency – The data is same in all the server nodes(leader or follower), implying the system has nearly
instantaneous sync capabilities
• Availability – Every request gets a response(success/failure). It requires the system to be operational 100%
of the time to serve requests, and
• Partition Tolerance – The system continues to respond, even after some of the server nodes fail. This
implies that the system maintains all the requests/responses function somehow.
Under normal conditions, a node can stay in any one of the above three states. Only a leader can interact with
the client; any request to the follower node is redirected to the leader node. A candidate can ask for votes to
become the leader. A follower only responds to candidate(s) or the leader.
To maintain these server status(es), the Raft algorithm divides time into small terms of arbitrary length. Each
term is identified by a monotonically increasing number, called term number.
Term number
This term number is maintained by every node and is passed while communications between nodes. Every
term starts with an election to determine the new leader. The candidates ask for votes from other server
nodes(followers) to gather majority. If the majority is gathered, the candidate becomes the leader for the
current term. If no majority is established, the situation is called a split vote and the term ends with no leader.
Hence, a term can have at most one leader.
Purpose of maintaining term number
Following tasks are executed by observing the term number of each node:
• Servers update their term number if their term number is less than the term numbers of other servers in the
cluster. This means that when a new term starts, the term numbers are tallied with the leader or the candidate
and are updated to match with the latest one(Leader’s)
• Candidate or Leader demotes to the Follower state if their term number is out of date(less than others). If at
any point of time, any other server has a higher term number, it can become the Leader immediately.
• As we said earlier that the term number of the servers are also communicated, if a request is achieved with a
stale term number, the said request is rejected. This basically means that a server node will not accept
requests from server with lower term number
Raft algorithm uses two types of Remote Procedure Calls(RPCs) to carry out the functions :
• RequestVotes RPC is sent by the Candidate nodes to gather votes during an election
• AppendEntries is used by the Leader node for replicating the log entries and also as a heartbeat mechanism
to check if a server is still up. If heartbeat is responded back to, the server is up else, the server is down. Be
noted that the heartbeats do not contain any log entries.
Now, lets have a look at the process of leader election.
Leader election
In order to maintain authority as a Leader of the cluster, the Leader node sends heartbeat to express dominion
to other Follower nodes. A leader election takes place when a Follower node times out while waiting for a
heartbeat from the Leader node. At this point of time, the timed out node changes it state to Candidate state,
votes for itself and issues RequestVotes RPC to establish majority and attempt to become the Leader. The
election can go the following three ways:
• The Candidate node becomes the Leader by receiving the majority of votes from the cluster nodes. At this
point of time, it updates its status to Leader and starts sending heartbeats to notify other servers of the new
Leader.
• The Candidate node fails to receive the majority of votes in the election and hence the term ends with no
Leader. The Candidate node returns to the Follower state.
• If the term number of the Candidate node requesting the votes is less than other Candidate nodes in the
cluster, the AppendEntries RPC is rejected and other nodes retain their Candidate status. If the term number is
greater, the Candidate node is elected as the new Leader.
The Byzantine Fault Tolerance was developed as inspiration in order to address the Byzantine General’s
Problem. The Byzantine General’s Problem, a logical thought experiment where multiple generals must attack
a city, is where the idea for BFT originated.
• Byzantine Fault Tolerance is one of the core characteristics of developing trustworthy blockchain rules or
features is tolerance.
• When two-thirds of the network can agree or reach a consensus and the system still continues to operate
properly, it is said to have BFT.
• Blockchain networks’ most popular consensus protocols, such as proof-of-work, proof-of-stake, and proof-of-
authority, all have some BFT characteristics.
• In order to create a decentralized network, the BFT is essential.
The consensus method determines the precise network structure. For instance, BFT has a leader as well as
peers who can and cannot validate.
In order to maintain the sequence of the Blockchain SC transactions and the consistency of the global state
through local transaction replay, consensus messages must pass between the relevant peers.
More inventive approaches to designing BFT systems will be found and put into practice as more individuals
and companies investigate distributed and decentralized systems. Systems that use BFT are also employed in
sectors outside of blockchains, such as nuclear power, space exploration, and aviation.
In order to address this issue, honest nodes (such as computers or other physical devices) must be able to
establish an agreement in the presence of dishonest nodes.
• In the Byzantine agreement issue, an arbitrary processor initializes a single value that must be agreed upon,
and all nonfaulty processes must agree on that value. Every processor has its own beginning value in the
consensus issue, and all nonfaulty processors must agree on a single common value.
• The Byzantine army’s position can be seen in computer networks.
• The divisions can be viewed as computer nodes in the network, and the commanders as programs running a
ledger that records transactions and events in the order that they occur. The ledgers are the same for all
systems, and if any of them is changed, the other ledgers are updated as well if the changes are shown to be
true, so all distributed ledgers should be in agreement.
The primary(leader) node is changed during every view(pBFT consensus rounds) and can be substituted
by a view change protocol if a predefined quantity of time has passed without the leading node
broadcasting a request to the backups(secondary). If needed, a majority of the honest nodes can vote on the
legitimacy of the current leading node and replace it with the next leading node in line.
Limitations of pBFT:
The pBFT consensus model works efficiently only when the number of nodes in the distributed network is
small due to the high communication overhead that increases exponentially with every extra node in the
network.
o Sybil attacks : The pBFT mechanisms are susceptible to Sybil attacks, where one entity(party) controls
many identities. As the number of nodes in the network increase, sybil attacks become increasingly
difficult to carry out. But as pBFT mechanisms have scalability issues too, the pBFT mechanism is used in
combination with other mechanism(s).
o Scaling : pBFT does not scale well because of its communication(with all the other nodes at every step)
overhead. As the number of nodes in the network increase(increases as O(n^k), where n is the messages
and k is the number of nodes), so does the time taken to respond to the request.
In a distributed system, multiple nodes need to work together to complete various tasks. Take an e-commerce
website as an example, the services of the website are distributed across multiple data centers. Users place orders on
the website, the order service is in one data center, and the inventory service is in another data center. Without a
coordination mechanism (such as two-phase commit), the following problems may occur: the order service has
already created the order, but when reducing the inventory, due to network problems, the inventory service did not
receive the request, resulting in incorrect inventory quantity, and users may purchase goods that are actually sold
out. Or, the inventory service has already reduced the inventory, but there was a problem when the order service
created the order, causing the inventory to be reduced erroneously and there is no corresponding order.
This is just one example of many possibilities. Without a suitable distributed transaction processing mechanism,
it may lead to data inconsistency, system unreliability, and damage to the user’s shopping experience. To solve
these problems, we need to introduce protocols like two-phase commit to ensure that transactions in distributed
Two-phase commit (2PC) is a protocol that implements transaction atomicity in a distributed system. Atomicity
means that a transaction (transaction) is either fully executed or not executed at all, and there will be no partial
execution. In a distributed system, a transaction may involve multiple nodes, so a mechanism is needed to ensure
that all nodes either commit (commit) the transaction or roll back (rollback) the transaction. This is the role of the
1. Voting request: The coordinator sends a transaction request to all participants, asking them whether they can
executed, it records the transaction log and responds with “YES”; otherwise, it responds with “NO”.
1. All votes are YES: If all participants respond with “YES”, the coordinator sends a “commit” command to all
participants.
2. Some votes are NO: If any participant responds with “NO”, or does not respond within a specified time, the
Each participant, after receiving the “commit” or “rollback” command, performs the corresponding operation and
1. Can-Commit: The coordinator sends a Can-Commit message, asking each participant if they're ready to
commit the transaction. Participants reply with either Yes or No.
2. Pre-Commit: If all participants send a Yes, the coordinator broadcasts a Pre-Commit message. Participants
acknowledge the message and prepare to commit the transaction.
3. Do-Commit: Once the coordinator receives all acknowledgements, it sends a Do-Commit message, instructing
participants to finalize the transaction.
Three-Phase Commit helps avoid blocking in case of a coordinator failure by allowing participants to reach a
decision independently, reducing the chances of a global deadlock.
• Improved fault tolerance: 3PC reduces the chance of failures affecting the entire system.
• Data consistency: Ensuring transactions are atomic and durable across distributed systems.
• Reduced global deadlock risk: The protocol allows participants to make decisions independently, minimizing
deadlock risk.
Typical use cases for Three-Phase Commit include distributed databases, distributed applications, and systems
requiring strict data consistency and fault tolerance.
Blockchain is a distributed ledger where data can be stored securely such that any alteration in the data is not
possible. In other words, we can also define it as a decentralized computation and information sharing
platform that enables multiple authoritative domains, who coordinate in a rational decision-making process.
Here, decentralized/ distributed term means that all nodes have equal priority, and they share their resources
among themselves.
As per the name ‘Blockchain‘, it itself suggests that information (i.e transactions) will be stored in the form of
blocks. Every node can see the block, but they can’t tamper with them. If a block value is tampered the hash
value associated with that block changes and that block will be disconnected from the network. On an average
of 12.6 seconds, every node in the blockchain network gets the most updated blockchain. The technology
behind Bitcoins is the Blockchain Network. Following are the components of a Blockchain network –
1. Node
2. Ledger
3. Wallet
4. Nonce
5. Hash
1. Node –
It is of two types – Full Node and Partial Node.
• Full Node –
It maintains a full copy of all the transactions. It has the capacity to validate, accept and reject the
transactions.
• Partial Node –
It is also called a Lightweight Node because it doesn’t maintain the whole copy of the blockchain ledger. It
maintains only the hash value of the transaction. The whole transaction is accessed using this hash value
only. These nodes have low storage and low computational power.
2. Ledger –
It is a digital database of information. Here, we have used the term ‘digital’ because the
currency exchanged between different nodes is digital i.e cryptocurrency. There are three types of ledger.
They are –
1. Public Ledger –
It is open and transparent to all. Anyone in the blockchain network can read or write something.
2. Distributed Ledger –
In this ledger, all nodes have a local copy of the database. Here, a group of nodes collectively execute the
job i.e verify transactions, add blocks in the blockchain.
3. Decentralized Ledger –
In this ledger, no one node or group of nodes has a central control. Every node participates in the execution
of the job.
3. Wallet –
It is a digital wallet that allows user to store their cryptocurrency. Every node in the blockchain
network has a Wallet. Privacy of a wallet in a blockchain network is maintained using public and private key
pairs. In a wallet, there is no need for currency conversion as the currency in the wallet is universally
acceptable. Cryptocurrency wallets are mainly of two types –
1. Hot Wallet –
These wallets are used for online day-to-day transactions connected to the internet. Hackers can attack this
wallet as it is connected to the internet. Hot wallets are further classified into two types –
a. Online/ Web wallets –
These wallets run on the cloud platform. Examples – MyEther Wallet, MetaMask Wallet.
b. Software wallets –
It consists of desktop wallets and mobile wallets. Desktop wallets can be downloaded on a desktop and the
user has full control of the wallet. An example of a desktop wallet is Electrum.
c. Mobile wallets –
They are designed to operate on smartphone devices. Example – mycelium.
2. Cold Wallet –
These wallets are not connected to the internet. It is very safe and hackers cannot attack it. These wallets
are purchased by the user. Example – Paper wallet, hardware wallet.
a. Paper wallet –
They are offline wallets in which a piece of paper is used that contains the crypto address. The private key
is printed in QR code format. QR code is scanned for cryptocurrency transactions.
b. Hardware wallet –
It is a physical electronic device that uses a random number generator that is associated with the wallet.
The focus of wallets is on these three things –
1. Privacy
2. Transactions should be secure
3. Easy to use
Privacy of a wallet is maintained using public and private key pairs. Transactions are made secure as a
private key is used both to send fund and to open the encrypted message.
4. Nonce –
A nonce is an abbreviation for “number only used once,” which is a number added to a hashed or encrypted
block in a blockchain. It is the 32-bit number generated randomly only one time that assists to create a new
block or validate a transaction. It is used to make the transaction more secure.
It is hard to select the number which can be used as the nonce. It requires a vital amount of trial -and-error.
First, a miner guesses a nonce. Then, it appends the guessed nonce to the hash of the current header. After
that, it rehashes the value and compares this to the target hash. Now it checks that whether the resulting
hash value meets the requirements or not. If all the conditions are met, it means that the miner has created
an answer and is granted the block.
5. Hash –
The data is mapped to a fixed size using hashing. It plays a very important role in cryptography. In a
blockchain network hash value of one transaction is the input of another transaction. Properties of the hash
function are as follows –
• Collision resistant
• Hiding
• Puzzle friendliness
Hyperledger Fabric is an open-source platform for building distributed ledger solutions, with a
modular architecture that delivers high degrees of confidentiality, flexibility, resiliency, and
scalability. This enables solutions developed with fabric to be adapted for any industry. This is a
private and confidential blockchain framework managed by the Linux Foundation. The article
focuses on discussing Hyperledger Fabric in Blockchain. The following topics will be discussed here:
1. What is Hyperledger Fabric ?
2. How does Hyperledger Fabric Work ?
3. Hyperledger Fabric Consensus Algorithm.
4. Industry Use Cases For Hyperledger Fabric.
5. Benefits Of Hyperledger Fabric.
6. Limitation of Hyperledger Fabric.
Components:
• Hyperledger fabric is an enterprise-level permission blockchain network. It is made up of various unique
organizations or members that interact with each other to serve a specific purpose. For example, these
organizations can be a bank, financial institution, or a supply chain network. Each organization is identified
and they have a fabric certificate authority. These organizations are called members.
• Each member of the fabric can set up one or more authorized peers to participate in the network using the
fabric certificate authority. All of these peers must be authorized properly.
• There is a client-side application connected to the network written with the software development kit (SDK) of
any particular programming language.
Workflow:
For each and every transaction in the fabric, the following steps are followed-
1. Creation of the proposal: Imagine a deal between a smartphone manufacturer company and a smartphone
dealership. The transaction begins when a member organization proposes or invokes a transaction request with
the help of the client application or portal. Then the client application sends the proposal to peers in each
organization for endorsement.
2. Endorsement of the transaction: After the proposal reaches the endorser peers (peers in each organization
for endorsement of a proposal) the peer checks the fabric certificate authority of the requesting member and
other details that are needed to authenticate the transaction. Then it executes the chain code (a piece of code
that is written in one of the supported languages such as Go or Java) and returns a response. This response
indicates the approval or rejection of the following transaction. The response is carried out to the client.
3. Submission to ordering service: After receiving the endorsement output, the approved transactions are sent to
the ordering service by the client-side application. The peer responsible for the ordering service includes the
transaction into a specific block and sends it to the peer nodes of different members of the network.
4. Updating the ledger: After receiving this block the peer nodes of such organizations update their local ledger
with this block. Hence the new transactions are now committed.
Hyperledger Fabric uses a consensus algorithm to achieve agreement among the participants in a network on the
contents of the shared ledger. The consensus algorithm in Hyperledger Fabric is pluggable, which means that it
can be replaced with a different algorithm as needed.
The most commonly used consensus algorithms in Hyperledger Fabric are:
•Practical Byzantine Fault Tolerance (PBFT): PBFT is a consensus algorithm that provides fault tolerance
and reliability in a network. It is well-suited for networks with a limited number of participants who are trusted
and well-known.
• RAFT: RAFT is a consensus algorithm that is used to maintain a consistent state across multiple nodes. It is
well-suited for networks where the participants are unknown and potentially untrusted.
• Solo: Solo is a consensus algorithm that is used for testing purposes in a single-node network. It is not suitable
for production use.
1. Supply Chain: Supply chains are global or regional webs of suppliers, manufacturers, and retailers of a
particular product. Hyperledger Fabric networks can improve the transaction processes of the supply chain by
increasing the clarity and traceability of transactions within the fabric. On a Fabric network, enterprises having
authentication to access the ledger can view the data of the previous transactions. This fact increases accountability
and reduces the risk of counterfeiting of the transactions. Real-time production and shipping updates can be
updated to the ledger. Which can help us to track the product condition in a much faster, simpler, and efficient
way.
2. Trading and Asset Transfer: Trading and asset transfer requires many organizations or members like
importers, exporters, banks, brokers. They work with one another. And even in the era of digitalization a lot of
paperwork is going on in this sector. But using Hyperledger they can transact and interact with each other in a
paperless way. The Hyperledger fabric can add the same layer of trust as the document signed by a trusted
authority. This also increases the performance of the system.
Another benefit of Hyperledger fabric is that assets can be dematerialized on the blockchain network with the help
of Hyperledger fabric. Due to this traders or stakeholders will be able to have direct access to their financial
securities and they can trade it anytime.
3. Insurance: The insurance industry spends billions to avoid insurance frauds or falsified claims. With the help
of Hyperledger fabric, the Insurance company can refer to the transaction data that is stored inside the ledger.
Hyperledger Fabric can also make the processing of claims faster using the chain code and automate the
payment. This process will be also helpful for multi-party subrogation claims processing. Where it can automate
repayment from the fault party back to the insurance company. Verification of identity or KYC process will be
easy using this private blockchain.
1. Open Source: Hyperledger fabric is an open-source blockchain framework hosted by the Linux foundation.
It has an active community of developers The code is designed to be publicly accessible. Anyone in the
community can see, modify, and distribute the code as they see fit. People across the world can come and help
to develop the source code.
2. Private and Confidential: In a public blockchain network each and every node in the network is receiving a
copy of the whole ledger. Thus keeping privacy becomes a much bigger concern as everything is open to
everyone. In addition to this one, the identities of all the participating members are not known and
authenticated. Anyone can participate as it is a public blockchain. But in the case of Hyperledger fabric, the
identities of all participating members are authenticated. And the ledger is only exposed to the authenticated
members. This benefit is the most useful in industry-level cases, like banking, insurance, etc where customer
data should be kept private.
3. Access Control: In the Hyperledger fabric, there is a virtual blockchain network on top of the physical
blockchain network. It has its own access rules. It employs its own mechanism for transaction ordering and
provides an additional layer of access control. It is especially useful when members want to limit the exposure
of data and make it private. Such that it can be viewed by the related parties only. As an example when two
competitors are on the same network. The fabric also offers private data collection and accessibility, where one
competitor can control the access to its own data such that the data do not get exposed to the other competitor.
4. Chaincode Functionality: It includes a container technology to host smart contracts called chain code that
defines the business rules of the system. And it’s designed to support various pluggable components and to
accommodate the complexity that exists across the entire economy. This is useful for some of the specific types
of transactions like asset ownership change.
5. Performance: As the Hyperledger fabric is a private blockchain network, There is no need to validate the
transactions on this network so the transaction speed is faster, resulting in a better performance.
Hyperledger Fabric is a robust and flexible platform for developing blockchain applications, but like any
technology, it has certain limitations:
1. Scalability: Hyperledger Fabric is designed for permissioned networks, where the participants are
known and trusted, which can limit its scalability for large-scale public networks.
2. Performance: The performance of Hyperledger Fabric can be impacted by factors such as network size,
network configuration, and the complexity of chaincode, which can limit its ability to handle high volumes of
transactions.
3. Complexity: Setting up and configuring a Hyperledger Fabric network can be complex, requiring a deep
understanding of the technology and its components.
4. Compatibility: Hyperledger Fabric is designed to be used with specific programming languages, such
as Go and JavaScript, which can limit its compatibility with other technologies and programming languages.
5. Cost: Running a Hyperledger Fabric network requires infrastructure and resources, which can add costs
to the deployment and operation of blockchain applications.
6. Interoperability: Hyperledger Fabric is designed to be used within a single network, and its interoperability
with other blockchain platforms is limited.
Transaction Flow
Transaction in hyperledger fabric reflects the business activity in the fabric network. Due ensure data
immutability the transactions are kept inside the block and the chain structure is used for protection. In
hyperledger fabric, each node maintains a ledger and the consensus mechanism is used to keep the ledger
updated and identical at every node. The ledger at each node is composed of two parts, a blockchain, and a
world-state database. The article focuses on discussing the transaction flow in Hyperledger Fabric.
Assumptions
There are a few assumptions to understand before beginning with the transaction flow in Hyperledger Fabric.
• This transaction flow assumes that the channel is set up and running.
• The application user has been registered and enrolled with the organization’s Certificate Authority (CA)
Certification and received back necessary Protected cryptographic material, which will be used to authenticate
to the network.
• The chaincode containing a set of key representation value pairs is installed on the peers and deployed to its
current channel.
• The chaincode contains logic defining a set of active transaction instructions and the agreed -upon price for a
radish.
• An endorsement policy has also been set up for this chaincode, stating that both peer A and peer B must
endorse any transaction.
• The target peer broadcasts transaction messages containing transaction proposals and responses to the ordering
service. This includes Channel ID, read/ write sets, and a signature for each endorsing peer.
• The ordering service receives the transactions, orders them, and creates blocks of transactions per channel. It will
not inspect the entire content of the transaction.
This topic serves as a conceptual introduction to the concept of ordering, how orderers interact with peers,
the role they play in a transaction flow, and an overview of the currently available implementations of the
ordering service, with a particular focus on the recommended Raft ordering service implementation.
What is ordering?¶
Many distributed blockchains, such as Ethereum and Bitcoin, are not permissioned, which means that any node
can participate in the consensus process, wherein transactions are ordered and bundled into blocks. Because of this
fact, these systems rely on probabilistic consensus algorithms which eventually guarantee ledger consistency to a
high degree of probability, but which are still vulnerable to divergent ledgers (also known as a ledger “fork”),
where different participants in the network have a different view of the accepted order of transactions.
Hyperledger Fabric works differently. It features a node called an orderer (it’s also known as an “ordering node”)
that does this transaction ordering, which along with other orderer nodes forms an ordering service. Because
Fabric’s design relies on deterministic consensus algorithms, any block validated by the peer is guaranteed to be
final and correct. Ledgers cannot fork the way they do in many other distributed and permissionless blockchain
networks.
In addition to promoting finality, separating the endorsement of chaincode execution (which happens at the peers)
from ordering gives Fabric advantages in performance and scalability, eliminating bottlenecks which can occur
when execution and ordering are performed by the same nodes.
Orderer nodes and channel configuration¶
In addition to their ordering role, orderers also maintain the list of organizations that are allowed to create
channels. This list of organizations is known as the “consortium”, and the list itself is kept in the configuration of
the “orderer system channel” (also known as the “ordering system channel”). By default, this list, and the channel
it lives on, can only be edited by the orderer admin. Note that it is possible for an ordering service to hold several
of these lists, which makes the consortium a vehicle for Fabric multi-tenancy.
Orderers also enforce basic access control for channels, restricting who can read and write data to them, and who
can configure them. Remember that who is authorized to modify a configuration element in a channel is subject to
the policies that the relevant administrators set when they created the consortium or the channel. Configuration
transactions are processed by the orderer, as it needs to know the current set of policies to execute its basic form of
access control. In this case, the orderer processes the configuration update to make sure that the requestor has the
proper administrative rights. If so, the orderer validates the update request against the existing configuration,
generates a new configuration transaction, and packages it into a block that is relayed to all peers on the channel.
The peers then process the configuration transactions in order to verify that the modifications approved by the
orderer do indeed satisfy the policies defined in the channel.
Everything that interacts with a blockchain network, including peers, applications, admins, and orderers, acquires
their organizational identity from their digital certificate and their Membership Service Provider (MSP) definition.
For more information about identities and MSPs, check out our documentation on Identity and Membership.
Just like peers, ordering nodes belong to an organization. And similar to peers, a separate Certificate Authority
(CA) should be used for each organization. Whether this CA will function as the root CA, or whether you choose
to deploy a root CA and then intermediate CAs associated with that root CA, is up to you.
We’ve seen from our topic on Peers that they form the basis for a blockchain network, hosting ledgers, which can
be queried and updated by applications through smart contracts.
Specifically, applications that want to update the ledger are involved in a process with three phases that ensures all
of the peers in a blockchain network keep their ledgers consistent with each other.
In the first phase, a client application sends a transaction proposal to a subset of peers that will invoke a smart
contract to produce a proposed ledger update and then endorse the results. The endorsing peers do not apply the
proposed update to their copy of the ledger at this time. Instead, the endorsing peers return a proposal response to
the client application. The endorsed transaction proposals will ultimately be ordered into blocks in phase two, and
then distributed to all peers for final validation and commit in phase three.
For an in-depth look at the first phase, refer back to the Peers topic.
After the completion of the first phase of a transaction, a client application has received an endorsed transaction
proposal response from a set of peers. It’s now time for the second phase of a transaction.
In this phase, application clients submit transactions containing endorsed transaction proposal responses to an
ordering service node. The ordering service creates blocks of transactions which will ultimately be distributed to
all peers on the channel for final validation and commit in phase three.
Ordering service nodes receive transactions from many different application clients concurrently. These ordering
service nodes work together to collectively form the ordering service. Its job is to arrange batches of submitted
transactions into a well-defined sequence and package them into blocks. These blocks will become the blocks of
the blockchain!
The number of transactions in a block depends on channel configuration parameters related to the desired size and
maximum elapsed duration for a block ( BatchSize and BatchTimeout parameters, to be exact). The blocks are
then saved to the orderer’s ledger and distributed to all peers that have joined the channel. If a peer happens to be
down at this time, or joins the channel later, it will receive the blocks after reconnecting to an ordering service
node, or by gossiping with another peer. We’ll see how this block is processed by peers in the third phase.
The first role of an ordering node is to package proposed ledger updates. In this example, application A1 sends a
transaction T1 endorsed by E1 and E2 to the orderer O1. In parallel, Application A2 sends transaction T2 endorsed
by E1 to the orderer O1. O1 packages transaction T1 from application A1 and transaction T2 from application A2
together with other transactions from other applications in the network into block B2. We can see that in B2, the
transaction order is T1,T2,T3,T4,T6,T5 – which may not be the order in which these transactions arrived at the
orderer! (This example shows a very simplified ordering service configuration with only one ordering node.)
It’s worth noting that the sequencing of transactions in a block is not necessarily the same as the order received by
the ordering service, since there can be multiple ordering service nodes that receive transactions at approximately
the same time. What’s important is that the ordering service puts the transactions into a strict order, and peers will
use this order when validating and committing transactions.
This strict ordering of transactions within blocks makes Hyperledger Fabric a little different from other
blockchains where the same transaction can be packaged into multiple different blocks that compete to form a
chain. In Hyperledger Fabric, the blocks generated by the ordering service are final. Once a transaction has been
written to a block, its position in the ledger is immutably assured. As we said earlier, Hyperledger Fabric’s finality
means that there are no ledger forks — validated transactions will never be reverted or dropped.
We can also see that, whereas peers execute smart contracts and process transactions, orderers most definitely do
not. Every authorized transaction that arrives at an orderer is mechanically packaged in a block — the orderer
makes no judgement as to the content of a transaction (except for channel configuration transactions, as mentioned
earlier).
At the end of phase two, we see that orderers have been responsible for the simple but vital processes of collecting
proposed transaction updates, ordering them, and packaging them into blocks, ready for distribution.
Phase three: Validation and commit¶
The third phase of the transaction workflow involves the distribution and subsequent validation of blocks from the
orderer to the peers, where they can be committed to the ledger.
Phase 3 begins with the orderer distributing blocks to all peers connected to it. It’s also worth noting that not every
peer needs to be connected to an orderer — peers can cascade blocks to other peers using the gossip protocol.
Each peer will validate distributed blocks independently, but in a deterministic fashion, ensuring that ledgers
remain consistent. Specifically, each peer in the channel will validate each transaction in the block to ensure it has
been endorsed by the required organization’s peers, that its endorsements match, and that it hasn’t become
invalidated by other recently committed transactions which may have been in-flight when the transaction was
originally endorsed. Invalidated transactions are still retained in the immutable block created by the orderer, but
they are marked as invalid by the peer and do not update the ledger’s state.
The second role of an ordering node is to distribute blocks to peers. In this example, orderer O1 distributes block
B2 to peer P1 and peer P2. Peer P1 processes block B2, resulting in a new block being added to ledger L1 on P1.
In parallel, peer P2 processes block B2, resulting in a new block being added to ledger L1 on P2. Once this process
is complete, the ledger L1 has been consistently updated on peers P1 and P2, and each may inform connected
applications that the transaction has been processed.
In summary, phase three sees the blocks generated by the ordering service applied consistently to the ledger. The
strict ordering of transactions into blocks allows each peer to validate that transaction updates are consistently
applied across the blockchain network.
For information about how to stand up an ordering node (regardless of the implementation the node will be used
in), check out our documentation on standing up an ordering node.
• Raft (recommended)
New as of v1.4.1, Raft is a crash fault tolerant (CFT) ordering service based on an implementation of Raft
protocol in etcd . Raft follows a “leader and follower” model, where a leader node is elected (per channel) and its
decisions are replicated by the followers. Raft ordering services should be easier to set up and manage than Kafka-
based ordering services, and their design allows different organizations to contribute nodes to a distributed
ordering service.
Similar to Raft-based ordering, Apache Kafka is a CFT implementation that uses a “leader and follower” node
configuration. Kafka utilizes a ZooKeeper ensemble for management purposes. The Kafka based ordering service
has been available since Fabric v1.0, but many users may find the additional administrative overhead of managing
a Kafka cluster intimidating or undesirable.
The Solo implementation of the ordering service is intended for test only and consists only of a single ordering
node. It has been deprecated and may be removed entirely in a future release. Existing users of Solo should move
to a single node Raft network for equivalent function.
Hyperledger Composer: Application Development, Network Administration:
Hyperledger Composer is an extensive, open development toolset and framework to make developing
blockchain applications easier. Our primary goal is to accelerate time to value, and make it easier to integrate
your blockchain applications with the existing business systems. You can use Composer to rapidly develop use
cases and deploy a blockchain solution in weeks rather than months. Composer allows you to model your
business network and integrate existing systems and data with your blockchain applications.
Hyperledger Composer supports the existing Hyperledger Fabric blockchain infrastructure and runtime, which
supports pluggable blockchain consensus protocols to ensure that transactions are validated according to policy
by the designated business network participants.
Everyday applications can consume the data from business networks, providing end users with simple and
controlled access points.
You can use Hyperledger Composer to quickly model your current business network, containing your existing
assets and the transactions related to them; assets are tangible or intangible goods, services, or property. As part
of your business network model, you define the transactions which can interact with assets. Business networks
also include the participants who interact with them, each of which can be associated with a unique identity,
across multiple business networks.
Developers of the Hyperledger Composer platform utilize Apache Cassandra as a tool for providing access to a
set of services that form the underlying architecture of this platform.
• These services include the ledger, storage interface, and event service.
• In order to interact with these services and make use of the Hyperledger Composer platform, developers can
make use of the application called “Composer Playground” which allows them to get used to the workflow and
perform certain tasks like creating contracts or running different transactions through an IDE (Integrated
Development Environment).
Hyperledger composer is a business toolkit that is used for developing blockchain business networks. One can
create a network using composer and transact with digital assets such as smart properties, contracts, value tokens,
and currencies by using their unique digital identities.
• It provides the freedom to create your own applications with it because of its modular architecture.
• One can start from scratch, import an existing Ethereum Solidity smart contract or use one of its sample plug -
ins like Hyperledger Geth to troubleshoot the system runtime environment on Mac, Linux, or Windows systems.
• Hyperledger Composer is a platform that’s geared towards promoting consistency in business transactions
through the use of a modular architecture that facilitates the creation of components that can be incorporated
and reused in order to reduce complexity.
• It’s an open-source tool that supports smart contract development and focuses on allowing users to create
business networks by means of making use of pre-built components. It’s also focused on supporting blockchain
applications that are compatible with other Hyperledger tools.
The development of Hyperledger Composer started in August 2015 as a result of the blockchain -based voting
platform having been released by the Ethereum Foundation. According to the project’s website, a Hyperledger
Composer is a tool that was designed to reduce complexity while supporting secure transactions in a digital
environment. It can be used for maintaining complex business networks and is designed to manage shared code
across organizations. The platform’s development team aims to make the platform readily available to
developers, organizations, businesses, and associations which are looking to utilize blockchain technologies like
Hyperledger Composer in order to conduct business operations.
• Hyperledger composer helps in building various business applications and allows you to experiment with the
technology at a low cost.
• It lets you quickly modify the model from one application to another.
• It is an open-source tool which means that you can get it for free. The code is hosted on GitHub and anyone can
contribute by adding or modifying features to this framework.
• The best part is that it can be used by developers as well as non-technical users in organizations, regardless of
their level of proficiency with blockchain technology.
UNIT–4
Blockchain Science: Gridcoin, Folding coin, Blockchain Genomics, Bitcoin MOOCs.
Currency: Currency, Token, Tokenizing, Campus coin, Coin drop as a strategy for Public adoption,
Currency Multiplicity, Demurrage currency.
1. Gridcoin: Gridcoin is a cryptocurrency designed to incentivize scientific research by utilizing the processing
power of distributed computing networks. It specifically rewards users who contribute their computing power
to BOINC (Berkeley Open Infrastructure for Network Computing) projects. BOINC is a platform that
supports scientific research projects that require significant computational resources, such as climate
modelling, protein folding, and more. Gridcoin combines blockchain technology with scientific computing,
offering rewards in the form of its cryptocurrency for supporting research efforts.
Gridcoin, if not solving the problem of using otherwise wasted mining cycles, at least tries to align incentives by
encouraging miners to also contribute computing cycles: miners are compensated at a much higher rate (5 GRC
versus a maximum of 150 GRC) for mining a currency block when also contributing computing cycles. A typical
complaint about blockchain technology is the wastefulness of mining, both in terms of unused computing cycles
and electricity consumption.
2. Folding Coin: Similar to Gridcoin, Folding Coin is a cryptocurrency that incentivizes participation in
scientific research. Specifically, it rewards users who contribute their computing power to the Folding home
project. Folding home is a distributed computing project focused on understanding protein folding and its
implications for diseases like Alzheimer's, cancer, and more. By participating in Folding home, users help
advance scientific research and receive Folding Coin as a reward.
3. Blockchain Genomics: Blockchain genomics refers to the application of blockchain technology to the field of
genomics. This can involve several aspects:
o Data Management: Using blockchain to securely and transparently manage and share genomic data.
o Incentives for Sharing Data: Creating systems to reward individuals or institutions for contributing
their genomic data to research using blockchain-based tokens.
o Decentralized Genomic Databases: Developing decentralized databases for storing and accessing
genomic data, ensuring privacy and security while facilitating research.
Blockchain can enhance genomics by providing immutable records of data access and changes, improving data
security, and enabling more efficient data sharing and collaboration across research institutions.
The democratization and freedom-enhancing characteristics of the blockchain seen in many projects also apply in
the case of consumer genomics, which is the concept of uplifting organizations to the blockchain (to the cloud in
a decentralized, secure way) to escape the limitations of local jurisdictional laws and regulation. That there is a
need for this does not necessarily signal illegal “bad players” with malicious intent; rather, it indicates a lack of
trust, support, relevance, and espousal of shared values in local jurisdictional governments. Traditional
government 1.0 is becoming outdated as a governance model in the blockchain era, especially as we begin to see
the possibility to move from paternalistic, one-size-fits-all structures to a more granular personalized form of
government. Genomics can be added to the list of examples of uplifting transnational organizations to the
decentralized blockchain cloud like ICANN, WikiLeaks, Twitter, Wikipedia, GitHub, and new business
registrations as DACs. Transnational blockchain genomics makes sense in the context of the right to personal
information (the right to one’s own genetic information) being seen as a basic human right, especially given the
increasing cost feasibility per plummeting genomic sequencing costs.
4. Bitcoin MOOCs: MOOCs (Massive Open Online Courses) related to Bitcoin and blockchain technology
offer educational opportunities for learning about these technologies. These courses cover various aspects,
such as:
o Bitcoin Fundamentals: Understanding how Bitcoin works, including its underlying technology,
mining, and its impact on the financial system.
o Blockchain Technology: Exploring the broader applications of blockchain beyond Bitcoin, including
smart contracts, decentralized applications, and various use cases.
o Cryptocurrency Economics: Studying the economic principles behind cryptocurrencies and their role
in modern economies.
MOOCs can be an accessible way for individuals to gain knowledge about Bitcoin and blockchain technology,
providing foundational education for those interested in entering the field or exploring its implications.
Integrating Blockchain with Scientific Research
To leverage blockchain technology effectively in scientific research, consider the following approaches:
• Incentivize Participation: Use cryptocurrencies like Gridcoin or FoldingCoin to reward contributions to
scientific projects, encouraging more participants to engage in distributed computing efforts.
• Enhance Data Security and Sharing: Implement blockchain solutions to manage and share scientific data,
ensuring that data is secure, immutable, and accessible only to authorized parties.
• Promote Educational Initiatives: Support and participate in MOOCs to spread knowledge about Bitcoin,
blockchain, and their applications in various fields, including scientific research.
• Foster Collaboration: Utilize blockchain’s decentralized nature to create collaborative platforms for
researchers, facilitating global cooperation and data sharing.
By combining these elements, you can drive innovation and collaboration in both blockchain technology and
scientific research.
1. Currency: Traditional currency (like the US Dollar or Euro) is a medium of exchange, a store of value, and a
unit of account. It can be physical (coins and banknotes) or digital (bank account balances, digital payment
systems).
2. Token: In the context of blockchain and cryptocurrency, a token is a digital asset that represents a variety of
assets or utilities on a blockchain. Tokens can be used to represent ownership in a company, a right to access a
service, or other forms of value.
3. Tokenizing: This refers to the process of converting ownership of a real-world asset or utility into a digital
token on a blockchain. For example, tokenizing real estate involves creating a blockchain-based token that
represents ownership of a property, which can then be bought, sold, or traded.
4. Campuscoin: This is a more niche concept, but Campuscoin could refer to a digital currency or token
specifically designed for use within a campus environment. Such a token could be used for transactions within
a university or college, like paying for tuition, books, or campus services. It could also be used as a reward
system or to incentivize certain behaviors.
5. Coindrop as a Strategy for Public Adoption: A "coindrop" generally refers to the practice of distributing
free tokens or coins to potential users to encourage adoption and raise awareness. This is similar to airdrops in
the cryptocurrency world, where tokens are distributed to holders of an existing cryptocurrency, often for
promotional purposes or to engage the community.
6. Currency Multiplicity: This concept involves the use of multiple types of currency or tokens within an
economy. It can refer to a system where various digital currencies coexist, each serving different purposes or
functions. This multiplicity can promote competition, innovation, and specialization.
Market principles have been employed to develop metrics for measuring non-monetary currencies such as
influence, reach, awareness, authenticity, engagement, action-taking, impact, spread, connectedness, velocity,
participation, shared values, and presence . Now blockchain technology could make these non-monetary
social currencies more trackable, transmissible, transactable, and monetizable. Social networks could become
social economic networks. For example, reputation as one of the most recognizable non-monetary currencies
has always been an important intangible asset, however was not readily monetizable other than indirectly as
an attribute of labor capital.
However social network currencies can now become transactable with web-based cryptocurrency tip jars (like
Reddcoin) and other micropayment mechanisms that were not previously feasible or transnationally-scalable
with traditional fiat currency. Just as collaborative work projects like open-source software development can
become more acknowledgeable and remunerable with github commits and line-item contribution-tracking,
cryptocurrency tip jars can provide a measurable record and financial incentive for contribution-oriented
online activities. One potential effect of this could be that if market principles were to become the norm for
intangible resource allocation and exchange, all market agents might start to have a more intuitive and
pervasive concept and demonstration of exchange and reciprocity. Thus social benefits like a more
collaborative society could be a result of what might initially seem to be only a deployment of economic
principles .
7. Demurrage Currency: Demurrage is a concept where a currency or token depreciates over time if not used.
This means that holding onto the currency incurs a cost or reduces its value. The purpose is to encourage
spending and circulation rather than hoarding. This idea is used to stimulate economic activity and prevent
stagnation.
Currency issued under a demurrage has an expiration date, which sets it apart from conventional
currencies. To accommodate the demands of the currency's users, this expiration date can be changed.
A currency may, for instance, lose value at a rate of 1% per week or 1% per day. To promote spending
and discourage hoarding, the expiration date was created.
1. Encouraging Spending: Demurrage currencies discourage hoarding and promote spending. This is
because the currency loses value over time, so users are incentivized to spend it before it expires.
2. Stability: Demurrage currencies can provide stability in times of economic uncertainty. They can help
prevent inflation and stabilize the value of a currency.
3. Sustainability: Demurrage currencies can promote sustainable practices by encouraging users to
spend their currency on environmentally-friendly products and services.
4. Decentralization: Demurrage currencies are decentralized, meaning they are not controlled by a
central authority. This makes them more resistant to manipulation and corruption.
5. Community Building: Demurrage currencies can be used to build communities around a shared set of
values. For example, a demurrage currency could be used to fund local public works projects or
support local businesses.
UNIT-5
ETHEREUM: Ethereum is a platform powered by blockchain technology that is best known for its native
cryptocurrency, called ether, or ETH, or simply ethereum. The distributed nature of blockchain technology
is what makes theEthereum platform secure, and that security enables ETH to accrue value.
Ethereum, just like any other blockchain, can be visualized as a transaction-based state machine. The idea is that
a genesis state is transformed into a final state by executing transactions incrementally. The final transformation
is then accepted as the absolute undisputed version of the state. In the following diagram, the Ethereum state
transition function is shown, where a transaction execution has resulted in a state transition.
EVM also supports exception handling in case exceptions occur, such as not having enough gas or invalid
instructions, in which case the machine would immediately halt and return the error to the executing agent.EVM
is a fully isolated and sandboxed runtime environment. EVM is a stack-based architecture.EVM is big-endian
by design and it uses 256-bit wide words. This word size allows for Keccak 256-bit hash and elliptic curve
cryptography computations.
EVM also supports exception handling in case exceptions occur, such as not having enough gas or invalid
instructions, in which case the machine would immediately halt and return the error to the executing agent.EVM is a
fully isolated and sandboxed runtime environment.
As discussed earlier, EVM is a stack-based architecture. EVM is big-endian by design and it uses 256-bit wide
words. This word size allows for Keccak 256-bit hash and elliptic curve cryptography computations.
The following diagram shows the design of the EVM where the virtual ROM stores the program code that is
copied into main memory using CODECOPY. The main memory is then read by the EVM by referring to the
program counter and executes instructions
EVM operation
EVM optimization is an active area of research and recent research has suggested that EVM can be optimized
and tuned to a very fine degree in order toachieve high performance. Research into the possibility of using Web
assembly (WASM) is underwayalready. WASM is developed by Google, Mozilla, and Microsoft and is now
being designed as an open standard by the W3C community group. The aim of WASM is to be able to run
machine code in the browser that will result in execution at native speed. Similarly, theaim of EVM 2.0 is to
be able to run the EVM instructionset (Opcodes) natively in CPUs, thus making it faster and efficient.
PRE-COMPILED CONTRACTS:
There are four precompiled contracts in Ethereum. Hereis the list of these contracts and details.
The elliptic curve public key recovery function
ECDSARECOVER (Elliptic curve DSA recover function) is available at address 1. It is denoted as ECREC
and requires 3000 gas for execution. If the signature is invalid, then no output is returned by this function.
Public key recovery is a standard mechanism by which the public key can be derived from the privatekey in
elliptic curve cryptography.
The ECDSA recovery function is shown as follows:
It takes four inputs: H, which is a 32 byte hash of the message to be signed and V, R, and S, which represent
the ECDSA signature with the recovery ID and produce a64 byte public key. V, R, and S have been discussed
in detail previously in this chapter.
The identity function is available at address 4 and is denoted by the ID. It simply defines output as input; in
other words, whatever input is given to the ID function, it will output the same value. Gas requirement is
calculated by a simple formula: 15 + 3 [Id/32] where Id is the input data. This means that at a high level, the
gas requirement is dependent on the size of the input data albeit with some calculation performed, as shown in
the preceding equation.All the previously mentioned precompiled contracts canbecome native extensions and
can be included in the EVM opcodes in the future.
Accounts are one of the main building blocks of the Ethereum blockchain. The state is created or updated asa
result of the interaction between accounts. Operations performed between and on the accounts represent state
transitions. State transition is achieved using what's called the Ethereum state transition function, which
works as follows:
1. Confirm the transaction validity by checking the syntax, signaturevalidity, and nonce.
2. Transaction fee is calculated and the sending address is resolved using the signature. Furthermore,
sender's account balance is checked and subtracted accordingly and nonce is incremented. Anerror is
returned if the account balance is not enough.
3. Provide enough ether (gas price) to cover the cost of the transaction. This is charged per byte
incrementally according to the size of the transaction.
4. In this step, the actual transfer of value occurs. The flow is from the sender's account to receiver's
account. The account is created automatically if the destination account specified in the transaction does
not exist yet. if the destination account is a contract, then the contract code is executed. If enough gas is
available, then the contract code willbe executed fully; otherwise, it will run up to the point where it runs
out of gas.
5. In cases of transaction failure due to insufficient account balance orgas, all state changes are rolled back
with the exception of fee payment, which is paid to the miners.
6. Finally, the remainder (if any) of the fee is sent back to the sender as change and fee is paid to the miners
accordingly. At this point, thefunction returns the resulting state.
TYPES OF ACCOUNTS : There are two types of accounts in Ethereum:
The first is externally owned accounts (EOAs) and the other is contract accounts. EOAs are similar to
accountsthat are controlled by a private key in bitcoin. Contract accounts are the accounts that have code
associated with them along with the private key. An EOA has ether balance, is able to send transactions, and
has no associated code, whereas a Contract Account (CA) has ether balance, associated code, and the
ability to get triggered and execute code in response to a transaction or a message that due to the Turing-
completeness property of the Ethereum blockchain, the code within contract accounts can be of any level of
complexity. The code is executed by EVM by each mining node on the Ethereum network. In addition,
contract accounts are able to maintain their own permanent state and can call other contracts. It is envisaged
that in the serenity release, the distinction between externally owned accounts and contract accounts may be
eliminated.
Block:
As discussed earlier, blocks are the main building blocksof a blockchain. Ethereum blocks consist of various
components, which are described as follows:
• The block header
• The transactions list
• The list of headers of ommers or uncles
The transaction list is simply a list of all transactions included in the block. In addition, the list of headers of
Uncles is also included in the block. The most important and complex part is the block header.
BLOCK HEADER
Block headers are the most critical and detailed components of an Ethereum block. The header contains
valuable information, which is described in detail here.
PARENT HASH
This is the Keccak 256-bit hash of the parent (previous)block's header.
OMMERS HASH
This is the Keccak 256-bit hash of the list of Ommers (Uncles) blocks included in the block.
BENEFICIARY
Beneficiary field contains the 160-bit address of the recipient that will receive the mining reward once theblock
is successfully mined.
STATE ROOT
The state root field contains the Keccak 256-bit hash ofthe root node of the state trie. It is calculated after all
transactions have been processed and finalized.
TRANSACTIONS ROOT
The transaction root is the Keccak 256-bit hash of the root node of the transaction trie. Transaction trie
represents the list of transactions included in the block.
RECEIPTS ROOT
The receipts root is the keccak 256 bit hash of the root node of the transaction receipt trie. This trie is
composedof receipts of all transactions included in the block.
Transaction receipts are generated after each transaction is processed and contain useful post- transaction
information. More details on transactionreceipts.
LOGS BLOOM
The logs bloom is a bloom filter that is composed of the logger address and log topics from the log entry of
eachtransaction receipt of the included transaction list in the block. Logging is explained in detail in the next
section.
DIFFICULTY
The difficulty level of the current block.
NUMBER
The total number of all previous blocks; the genesisblock is block zero.
GAS LIMIT: The field contains the value that represents the limit seton the gas consumption per block.
GAS USED: The field contains the total gas consumed by thetransactions included in the block.
EXTRA DATA: Extra data field can be used to store arbitrary datarelated to the block.
MIXHASH:
Mixhash field contains a 256-bit hash that once combined with the nonce is used to prove that adequate
computational effort has been spent in order to create this block.
NONCE
Nonce is a 64-bit hash (a number) that is used to prove, in combination with the mixhash field, that adequate
computational effort has been spent in order to create this block.
The following figure shows the detailed structure of theblock and block header:
Detailed diagram of block structure with block header
ETHER:
Ether is minted by miners as a currency reward for the computational effort they spend in order to secure the
network by verifying and with validation transactions andblocks. Ether is used within the Ethereum blockchain
to pay for the execution of contracts on the EVM. Ether is used to purchase gas as crypto fuel, which is
required inorder to perform computation on the Ethereum blockchain.
Fees are charged for each computation performed bythe EVM on the blockchain.
Gas
Gas is required to be paid for every operation performedon the ethereum blockchain. This is a mechanism that
ensures that infinite loops cannot cause the whole blockchain to stall due to the Turing-complete nature of the
EVM.A fee is paid for transactions to be included by miners for mining. If this fee is too low, the transaction
may never be picked up; the more the fee,the higher are the chances that the transactions will bepicked up
by the miners for inclusion in the block.
Conversely, if the transaction that has an appropriate feepaid is included in the block by miners but has too
many complex operations to perform, it can result in an out-of- gas exception if the gas cost is not enough. In
this case, the transaction will fail but will still be made part of the block and the transaction originator will not
get any refund.
Transaction cost can be estimated using the followingformula:
Each operation costs some gas; a high level fee schedule of a few operations is shown as an examplehere:
Based on the preceding fee schedule and the formuladiscussed earlier, an example calculation of the SHA3
operation can be calculated as follows:
• SHA3 costs 30 gas
• Current gas price is 25 GWei, which is 0.000000025
• EtherMultiplying both: 0.000000025 * 30 = 0.00000075
Ether In total, 0.00000075 Ether is the total gas that will becharged.
Fee schedule
Gas is charged in three scenarios as a prerequisite tothe execution of an operation:
• The computation of an operation
• For contract creation or message call
• Increase in the usage of memory
A list of instructions and various operations with the gasvalues has been provided.
MESSAGES:
• Messages, as defined in the yellow paper, are the dataand value that are passed between two accounts.
A message is a data packet passed between two accounts. This data packet contains data and value
(amount of ether).
• Contracts can send messages to other contracts. Messages only exist in the execution environment and
are never stored. Messages are similar to transactions; however, the main difference is that they are
produced by the contracts, whereas transactions are produced by entities external to the Ethereum
environment.
Messages are generated when CALLor DELEGATECALLOpcodes are executed by the contracts.
MINING:
Mining is the process by which new currency is added tothe blockchain. This is an incentive for the miners to
validate and verify blocks made up of transactions. The mining process helps secure the network by verifying
computations.
At a theoretical level, a miner performs the followingfunctions:
• Listens for the transactions broadcasted on the Ethereum networkand determines the transactions to be
processed.
• Determines stale blocks called Uncles or Ommers and includes themin the block.
• Updates the account balance with the reward earned fromsuccessfully mining the block.
• Finally, a valid state is computed and block is finalized, which definesthe result of all state transition.
The current method of mining is based on Proof of Work, which is similar to that of bitcoin,but it must also
contain the Proof of Work for a given difficulty.
Considerable research work has been carried out in order to build the Proof of Stake algorithm suitable for
the Ethereum Network.
various methods of mining are mentioned.
CPU mining
Even though not profitable on the main net, CPU miningis still valuable on the test network or even a private
network to experiment with mining and contract deployment. Private and test networks will be discussedwith
practical examples in the next chapter. A geth example is shown on how to start CPU mining here.
Geth can be started with mine switch in order to startmining:
After this, the miner can be started by issuing the following command, which will return true if successful, or false
otherwise. Take a look at the following command:
Miner.start(4)
The preceding command will start the miner with fourthreads. Take a look at the following command:
Miner.stop
The preceding command will stop the miner. The command will return true if successful.
GPU mining
At a basic level, GPU mining can be performed easily byrunning two commands:
Once geth is up and running and the blockchain is fully downloaded, Ethminer can be run in order to start mining.
Ethminer is a standalone miner that can also beused in the farm mode to contribute to mining pools. It can be
downloaded from https://github.com/Genoil/cpp-ethereum/tree/master/releases:
Mining rigs
Mining rigs can be built with some effort and are also available commercially from various vendors. A typical
mining rig configuration includes the components discussed in the upcoming sections.
MOTHERBOARD
A specialized motherboard with multiple PCI-E x1 or x16 slots, for example, BIOSTAR Hi-Fi or ASRock
H81, is required
SSD HARD DRIVE
An SSD hard drive is required. The SSD drive is recommended because of its much faster performanceover
the analog equivalent. This will be mainly used to store the blockchain.
GPU
The GPU is the most important component of the rig as itis the main workhorse that will be used for mining.
For example, it can be a Sapphire AMD Radeon R9 380 with4 GB RAM
Mining pools
There are many online mining pools that offer Ethereummining. Ethminer can be used to connect to a mining
pool using the following command. Each pool publishes its own instructions, but generally, the process of
connecting to a pool is similar.
TRADING AND INVESTMENT:
Ether is available at various exchanges for buying andselling. The current market cap of Ethereum is
£680,277,967 at the time of writing this, and an Ether isworth £7.89. Recently, the price has been very volatile and
has dropped down significantly due to recent Ethereum attacks and subsequent forks on the Ethereum network.
The following chart shows the historical marketcapitalization details:
Ether historical market capitalization (source Etherscan.io).There are online services available, such as
shapeshift.io, that allow conversion from one currency to another.Various online exchanges, such as kraken,
coinbase, and many more, offer ether to be purchased for fiat currency using credit cards or another virtual
currency,such as bitcoin.
The Ethereum network is a peer-to-peer network where nodes participate in order to maintain the blockchain
andcontribute to the consensus mechanism. Networks can be divided into three types, based on requirements and
usage.
MainNet : MainNet is the current live network of ethereum. Thecurrent version of MainNet is homestead.
TestNet : TestNet is also called Ropsten and is the test network forthe Ethereum blockchain. This blockchainis
used to test smart contracts and DApps before being deployed to theproduction live blockchain. Moreover,
being a test network, it allows experimentation and research.
Private net(s):
As the name suggests, this is the private network that can be created by generating a new genesis block. Thisis
usually the case in distributed ledger networks, wherea private group of entities start their own blockchain
Supporting protocols:
There are various supporting protocols that are in development in order to support the complete
decentralized ecosystem. This includes whisper and Swarm protocol.
Whisper
Whisper provides decentralized peer-to-peer messaging capabilities to the ethereum network. In essence,whisper
is a communication protocol that nodes use inorder to communicate with each other.
SWARM
Swarm is being developed as a distributed file storage platform. It is a decentralized, distributed, and peer-to-peer
storage network. Files in this network are addressed by the hash of their content
APPLICATIONS DEVELOPED ON ETHEREUM:
There are various implementations of DAOs and smart contracts in Ethereum, most notably, the DAO,
which was recently hacked and required a hard fork in order for funds to be recovered. The DAO was
created to serve asa decentralized platform to collect and distribute investments.
Augur is another DAPP that has been implemented on Ethereum, which is a decentralized prediction market.
Various other decentralized applications are listed on http://dapps.ethercasts.com/.
Scalability in any blockchain is a fundamental issue. Security is also of paramount importance. Issues such as
privacy and confidentiality have caused some adaptability issues, especially in the financial sector. However,
a great deal of research is being conducted in these areas. Even though various use cases and proof of concept
systems have been developed and the technology works well for many of the scenarios, there still is a need to
address some fundamental limitations that are present in blockchains in order to make this technology more
adaptable.
At the top of the list of these issues comes scalability and then privacy. Both of these are important limitations
to address, especially as blockchains are envisioned to be used in privacy-demanding industries too. There are
specific requirements around confidentiality of transactions in finance, law and health, whereas scalability is
generally a concern where blockchains do not meet the adequate performance levels expected by the users.
Thesetwo issues are becoming inhibiting factors toward blockchain technology's wider acceptance.
Scalability:
This is the single most important problem that could mean the difference between wider adaptability of
blockchains or limited private use only by consortiums. As a result of substantial research in this area, many
solutions have been proposed from a theoretical perspective, the general approach toward tackling the
scalability issue generally revolves around protocol-level enhancements. For example, a commonly
mentioned solution to bitcoin scalability is to increase its block size.
Other proposals include off-chain solutions that offload certain processing to off-chain networks, for
example, off-chain state networks. Based on the solutions mentionedabove, generally, the proposals can
be divided into two categories: on-chain solutions that are based on the idea of changing fundamental
protocols on which the blockchain operates.
Privacy:
Privacy of transactions is a much desired property of blockchains. However, due to its very nature, especially
in public blockchains, everything is transparent, thus inhibiting its usage in various industries where privacy
is of paramount importance, such as finance, health, and many others. There are different proposals made to
address the privacy issue and some progress has already been made. Several techniques, such as
indistinguishability obfuscation, usage of homomorphic encryption, zero knowledge proofs, and ring
signatures.
Security:
Even though blockchains are generally secure and make use of asymmetric and symmetric cryptography as
required throughout the blockchain network, there still are few caveats that can result in compromising the
security of the blockchain.
There are a few examples of transaction malleability, eclipse attacks, and possibility of double spending in
bitcoin that, in certain scenarios, have been shown to work by various researchers.