Block Chain Notes
Block Chain Notes
CA: CA database provides availability and consistency among all the nodes. However, it cannot
accomplish this if there is a partition between any two system nodes, hence it is unable to provide fault
tolerance. For eg: Postgres, MySQL.
AP: AP database means that the system continues to operate even in the presence of node failures. AP-
based systems compromise consistency and availability. Examples: MongoDB, Cassandra.
CP: CP database means that the system continues to operate even though network failures are occurring in
the database. CP systems are strongly consistent but they are not properly available. Exaples: MongoDB,
HBase.
Q2. What is Distributed Ledger Technologies (DLTs)? Differentiate DLT and Blockchain Technology.
(10) Dec 2023
1. Distributed Ledger Technology (DLT) is centered around an encoded and distributed database where
records regarding transactions are stored.
2. A distributed ledger is a database that is spread across various computers, nodes, institutions, or countries
accessible by multiple people around the globe.
3. Types of Distributed Ledger Technology
Permissioned DLT: Nodes have to take permission from a central authority to access or make any changes
in the network. Mostly these types of permissions include identity verification.
Permissionless DLT: There is no central authority to validate transactions, rather existing nodes are
collectively responsible for validating the transactions. Various consensus mechanisms are used to validate
transactions based on predefined algorithms. In the case of bitcoin proof of work consensus mechanism is
used.
Hybrid DLT: It is combined with both permissionless and permissioned DLTs and can benefit from both of
them.
Q3. Key features of blockchain (5) May2023
1. Immutable: Immutability means that the blockchain is a permanent and unalterable network. Blockchain
technology functions through a collection of nodes. Once a transaction is recorded on the blockchain, it
cannot be modified or deleted.
2. Distributed: All network participants have a copy of the ledger for complete transparency. A public ledger
will provide complete information about all the participants on the network and transactions.
3. Decentralized: Blockchain technology is a decentralized system, which means that there is no central
authority controlling the network. Instead, the network is made up of a large number of nodes that work
together to verify and validate transactions.
4. Secure: All the records in the blockchain are individually encrypted. Using encryption adds another layer
of security to the entire process on the blockchain network.
5. Consensus: Consensus is a decision-making algorithm for the group of nodes active on the network to
reach an agreement quickly and faster and for the smooth functioning of the system.
6. Unanimous: All the network participants agree to the validity of the records before they can be added to
the network.
Q5. What is a block header? How are blocks linked in blockchain? (5) May2023
1. A block header is used to identify specific blocks within a blockchain network.
2. Each block has unique heather to aid with the monitoring of protocol changes.
3. The blocks are put in a vertical sequence, starting with the “genesis block.”
4. Each header has three layers of block data as well as Merkle root, Bitcoin version number, previous
block hash, nonce used by miners, and the timestamp of the block.
How are blocks linked in blockchain:
Blocks in a blockchain are linked through a process called hashing.
Each block contains a unique identifier known as a hash, which is generated by applying a
cryptographic algorithm to the data within the block.
This hash serves as the digital fingerprint of the block and is used to ensure its integrity.
To link blocks together, each block also includes the hash of the previous block in its data.
Chapter 2 : Bitcoin
Q1. Explain and differentiate Blockchain Forks. (5) (10) Dec 2023
1. In simple terms, Forks in blockchain means copying the code and modifying it to create a new software
or product.
2. In open-source projects Forks are very common and used widely.
3. Open source with the help of fork can make user interface more interactive and look good, helping in
gaining more users worldwide.
Types of Blockchain Forks:
1. CODEBASE FORK: In codebase blockchain fork you can copy the entire code of a particular
software. Many of these ALT COINS which are now running on the blockchain are been made in these
way only by using the codebase fork i.e. they have made little up and down changes in the code of
BITCOIN and created their whole new ALT COIN.
2. LIVE BLOCKCHAIN FORK: Live Blockchain fork means a running blockchain is been divided
further into two parts or two ways. It has two types Accidental Fork and Intentional Fork.
3. ACCIDENTAL FORK: When multiple miners mine a new block at nearly the same time, the entire
network may not agree on the choice of the new block.
4. INTENTIONAL FORK: In intentional fork the rules of the blockchain are been changed, knowing the
code of the software and by modifying it intentionally. It has two types: Hard Fork and Soft Fork.
5. SOFT FORK: When the blockchain protocol is altered in a backwards-compatible way.
6. HARD FORK: When the blockchain protocol is altered in a non backwards-compatible way.
Q3. Discuss block validates in the Bitcoin with POW consensus algorithm. (10) Dec 2023
1. Proof of Work consensus is the mechanism of choice for the majority of cryptocurrencies currently in
circulation.
2. The algorithm is used to verify the transaction and create a new block in the blockchain.
3. Bitcoin uses the Hashcash Proof of Work system as the mining basis.
How is block validated:
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.
The Proof of Work (POW) 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 reward 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.
Q4. Discuss Bitcoin Mining steps to validate the block. What is difficulty level and how does it calculate
in terms of bitcoin. (10) Dec 2023
1. Bitcoin mining is a computation-intensive process that uses complicated computer code to generate a secure
cryptographic system.
2. The bitcoin miner is the person who solves mathematical puzzles(also called proof of work) to validate the
transaction.
Steps:
1. Transaction Verification: Miners collect and verify new transactions broadcasted to the network. They
ensure that each transaction is valid, adheres to Bitcoin's rules, and has sufficient fees attached.
2. Creating the Block: Miners group verified transactions into a block and add a header containing metadata
such as a timestamp and a reference to the previous block's hash.
3. Finding the Nonce: Miners attempt to find a nonce (a random number) that, when combined with the block's
data, produces a hash value that meets the target criteria set by the network. This process is known as proof
of work.
4. Proof of Work: Miners repeatedly hash the block's data with different nonces until they find a hash value
that meets the target difficulty level. This requires significant computational power and energy expenditure.
5. Block Addition: Once a miner discovers a valid nonce, they broadcast the new block to the network. Other
miners then verify the block's validity and add it to their copy of the blockchain.
Difficulty Level and how it’s calculated:
Mining difficulty is how much work it takes to generate a number less than the target hash.
Mining difficulty changes every 2,016 blocks or approximately every two weeks. The next difficulty level
depends on how efficient miners were in the preceding cycle and how many miners are participating.
Q7. Explain Simplified Payment Verification Nodes. What is the Privacy solution for SPV nodes? (5)
May2023
1. Simple Payment Verification (SPV) is a method that allows a lightweight client to check if a
transaction is on the Bitcoin blockchain without having to download the entire blockchain.
2. These nodes simply keep track of a subset of the blockchain and use the SPV system to validate
transaction.
3. The SPV just downloads the block headers for each block as opposed to downloading all the blocks
like the full nodes do.
4. An SPV node will establish a connection between the transaction it needs to verify and the block in
which they are contained.
Privacy Solution for SPV:
1. Bloom Filters: To determine if an element is a part of set, the Bloom Filter is a probabilistic data
structure that uses little storage space.
2. Bloom filters are used to preserve the privacy of lightweight nodes.
3. It is a memory efficient randomized data structure to represent a set in order to support associate
queries.
4. Bloom filters offer a trade-off between (elements size in the network and bandwidth) and privacy
metrics in untrusted environments.
Q8. Explain bitcoin mining with the help of a neat diagram. (10) May2023
1. Bitcoin mining is a computation-intensive process that uses complicated computer code to generate a
secure cryptographic system.
2. The bitcoin miner is the person who solves mathematical puzzles(also called proof of work) to validate
the transaction.
3. Miner verifies the transactions(after solving the puzzle) and then adds the block to the blockchain when
confirmed.
Working:
1. The nodes of the blockchain network are based on the concept that no one in the network can be trusted.
Proof of work is accepted by nodes to validate any transaction.
2. Proof of work involves doing hefty calculations to find a 32-bit hash value called nonce to solve the
mathematical puzzle.
3. The miners create new blocks by abiding by the fact that the transaction volume must be less than 21
million.
4. 21 million is the total number of bitcoins that can be generated.
5. The verified transaction gets a unique
identification code and is linked with
the previous verified transaction.
Q9. What is a Blockchain fork? Differentiate between soft fork and hard fork. (10) May2023
1. In simple terms, Forks in blockchain means copying the code and modifying it to create a new
software or product.
2. In open-source projects Forks are very common and used widely.
3. Open source with the help of fork can make user interface more interactive and look good, helping in
gaining more users worldwide.
Q1. Describe terms: Structure of Transaction, Transaction Nonce, Transaction GAS, Recipient, Values
and data. (10) Dec 2023
Q2. What are the essential tools and frameworks for setting up a development environment for Solidity
programming? (10) Dec 2023
Setting up a development environment is necessary in order to begin using a smart contract We'll explore
the procedures needed to set up the development environment and the various choices.
There are two options for creating ideal conditions for creating Smart Contract.
Remix Online IDE
Local set up
1. Remix IDE : The first option is to create and test the smart contract using the online remix IDE. This
method is quick, simple, and used by beginners.
Pros
No installation is necessary, all online.
Start right away with no obstacles, and quickly for prototype and validating A local Ethereum
virtual network is made available using smart contracts.
Cons
Remix IDE has significant restrictions as one moves from creating smart contracts to utilizing
them in distributed applications (DApps).
2. Local Setup : Setting up a kxal machine for creating Smart Contracts is an alternative to using Remix
IDE. Various tools are provided for local setup.
NodeJS
Visual Studio Code
Truffle suit
Ganche
Tools required for smart contract development is as follows :
1. NodeJS: Using NVM Version Manager)
2. Visual Studio Code: One of Microsoft's greatest IDES for developing Solidity smart contracts is
Visual Studio
3. Truffle Suite: A great framework for Smart Contracts is offered by the truffle suite. Npm( node
package management), whichis installed with node, is used to install truffle.
Q3. Discuss the role of tools like Remix and Truffle in the development process. (10) Dec 2023
1. Remix IDE : The first option is to create and test the smart contract using the online remix IDE. This
method is quick, simple, and used by beginners.
Pros
No installation is necessary, all online.
Start right away with no obstacles, and quickly for prototype and validating A local Ethereum
virtual network is made available using smart contracts.
Cons
Remix IDE has significant restrictions as one moves from creating smart contracts to utilizing
them in distributed applications (DApps).
2. Truffle Suit:
1. Truffle offers a top-notch development platform, testing framework, and asset pipeline for
blockchains that make use of the Ethereum Virtual Machine (EVM).
2. It's a platform for developing decentralized apps on the Ethereum blockchain.
3. It is the most well-known and innovative framework.
4. Due to its configuration being user-friendly for beginners, Truffle is likely to be your first contact if
you are new to DAPP development.
Q5. What is nonce in blockchain and how does it work? (5) May2023
1. The Nonce is a random whole number, which is a 32-bit (4 byte) field, which is adjusted by the miners,
so that it becomes a valid number to be used for hashing the value of block.
2. Nonce is the number which can be used only once.
3. Once the perfect Nonce is found, it is added to the hashed block.
4. Along with this number, the hash value of that block will get rehashed and creates a difficult algorithm.
Working:
Nonce is included in the block header, then that information is hashed.
If the resulting hexadecimal number adds up to a value of less than or equal to the network's difficulty
target, the miner's block is added to the blockchain.
Another is opened, and the process begins again.
Q6. Differentiate between Bitcoin blockchain and Ethereum Blockchain. (10) May2023
Bitcoin Ethereum
2 The purpose of bitcoin was to replace national The purpose of Ethereum was to utilize blockchain
currencies during the financial crisis of 2008. technology
4 Smart contracts on Bitcoin are written in Smart contracts on Ethereum are written in
programming languages like Script, Clarity. programming languages like Solidity, Vyper, etc.
5 Bitcoin runs on the SHA-256 hash algorithm. Ethereum runs on the Keccak-256 hash algorithm.
6 The Proof-of-Work (PoW) is the consensus The Proof-of-Stake is the consensus mechanism
mechanism used by the Bitcoin network. used by Ethereum.
7 The block time of bitcoin is 10 minutes. The block time of Ethereum is 14 to 15 seconds.
8 The bitcoin blockchain has a block limit of 1 The Ethereum blockchain does not have a block
MB. limit.
10 Structure of bitcoin is simple and robust. Structure of Ethereum is complex and feature rich
Q8. With the help of a suitable diagram explain the life-cycle of a smart contract in Ethereum. (10)
May2023
1. Create: Contract reiteration and negotiation constitute a significant part of the first phase. First, the parties
must agree on the contract’s overall content and goals. This can be done online or offline. This is similar to
traditional contract negotiations.
2. Freeze: The smart contract and its participants become open to the public on the public ledger during the
‘freeze’ phase. Digital assets of both involved parties in the smart contracts are locked via freezing the
corresponding digital wallets, and nodes operate as a governance board that verifies whether the
preconditions for smart contract execution have been satisfied.
3. Execute: This phase involves the actual execution of the smart contract's code. Users interact with the
contract by sending transactions, triggering the execution of its predefined instructions.
4. Finalize: The finalize phase marks the end of the contract's execution. It involves completing any
remaining transactions or state updates and may include termination conditions or manual termination by
the contract owner. Once finalized, the contract's execution is complete.
Q9. EOA and contracts address ( could be contracts account, given in book, mistake in print) (5) May2023
EOA:
1. EOA is controlled via private keys from a user and the contract accounts are controlled by their contract code.
2. The term "Extemally Owned Account" is referred to as EOA. This is the type of account that is owned by
people on the Ethereum network.
3. A public-private key pair is produced for an account once the user creates one on Ethereum. The name or any
other personal information of the user does not identify the account.
Contracts Account:
1. A smart contract's code is contained in a contract account.
2. This account doesn't have a public or private key; the public address of the contract account is used to identify
it. Private keys are not owned by this account.
3. This account is managed by the smart contract's logic. The owner of the contract's account is the smart
contract that is implemented on the Ethereum blockchain.
Q4. Enumerate the interoperability and scalability issues in Hyperledger fabric. (5) May2023
Interoperability Challenges:
1) Different Protocols: Blockchains use varied protocols and languages, complicating direct
communication.
2) Data Formats: There's no universal data format, hindering seamless interaction across networks.
3) Cross-Chain Communication: Specialized solutions for network interaction add complexity and
security concerns.
4) Smart Contract Compatibility: Contracts often aren't directly transferable due to distinct
architectures and languages.
Scalability Challenges:
1) Transaction Limits: Blockchain networks face limits on transactions per second, leading to
congestion.
2) Consensus Latency: Reaching consensus in large networks adds delays, impacting scalability.
3) Resource Demands: Increasing blockchain size requires more storage and bandwidth, limiting
participant inclusivity.
4) Block Propagation: Larger blocks can slow down propagation times, risking centralization as only
well-resourced nodes can efficiently participate.
Q5. Describe the various projects covered under Hyperledger umbrella projects. (10) May 2023
1. Hyperledger Frabic:
Hyperledger Fabric emphasizes modular architecture for flexibility and scalability.
It prioritizes permissioned networks for controlled access.
Fabric focuses on confidentiality through private transactions.
It stresses on plug-and-play consensus mechanisms.
2. Hyperledger Burrow:
It provides a simplified execution environment for smart contracts.
Burrow emphasizes compatibility with Ethereum tools and contracts.
It prioritizes efficiency and scalability in blockchain transactions.
Burrow offers enhanced security features for enterprise-grade applications.
3. Hyperledger Indy:
Hyperledger Indy is an open-source, decentralized identity management platform for
individuals and organizations.
It focuses on providing tools and libraries for building self-sovereign identity solutions
(SSI).
Indy uses blockchain technology and cryptographic algorithms to ensure the privacy and
security of identity information.
The Hyperledger Indy blockchain is both public and permissioned.
4. Hyperledger Sawtooth:
Hyperledger Sawtooth is a toolbox for building business-focused blockchains.
Sawtooth uses blockchain technology as a service (BaaS).
Sawtooth features modularity for easy integration of custom features.
Businesses can use it for tasks like supply chain tracking or secure payments.
5. Hyperledger Iroha:
A Hyperledger Iroha is a simple, distributed ledger system.
It emphasizes easy integration into infrastructural projects.
It provides a set of predefined commands for asset management.
Hyperledger Iroha prioritizes speed and simplicity for blockchain operations.
Q1. List the key differences between an ICO and STO. (10) Dec 2023
Initial Coin Offering
1) ICO is a method for obtaining money from prospective investors or venture capitalists before an initiative
is launched on the cryptocurrency market.
2) An initial coin offering (ICO) is a type of capital-raising activity in the cryptocurrency and blockchain
environment.
3) The main advantage of ICOs is that they remove middleman from the capital-raising process and create
direct connections between the company and investors.
4) Types of ICO are Private ICO and Public ICOs.
Security Token Offering
1) STO stands for Security Token Offering.
2) It's a method of raising funds in which tokens are issued representing ownership rights in the company.
3) Unlike ICOs, STOs are regulated by financial authorities and offer investors legal protections, as they are
considered securities.
4) This means they must comply with securities laws, providing investors with more transparency and
potentially reducing the risk of fraud.
Q2. Explain Fungible tokens. Describe the steps to create ERC20 tokens. (10) May Dec 2023
1. ERC-20 is the technical standard for fungible tokens created using the Ethereum blockchain.
2. A fungible token is one that is exchangeable with another token, whereas the well-known ERC-721 non-
fungible tokens (NFTs) are not.
3. ERC-20 allows developers to create smart-contract-enabled tokens that can be used with other products
and services.
4. These tokens are a representation of an asset, right, ownership, access, cryptocurrency, or anything else
that is not unique in and of itself but can be transferred.
Steps to create ERC20 Tokens:
Understand ERC-20 Standards: Make sure you understand the requirements and functionalities of
ERC-20 tokens. These include functions like transfer(), transferFrom(), approve(), etc.
Setup Development Environment: Set up a development environment like Solidity the programming
language for Ethereum smart contracts.
Write Smart Contract: Implement functions for transferring tokens, checking balances, and approving
transfers.
Compile Smart Contract: Once your smart contract is written, compile it using a Solidity compiler.
Deploy Smart Contract: Deploy your compiled smart contract to the Ethereum blockchain.
Market and Support: Market your token to attract users and investors.
Q2. Discuss the different challenges addressed by blockchain in the Energy sector. (10) May2023
1. Decentralization of Energy Grids: Blockchain enables the creation of decentralized energy grids
where energy can be generated, stored, and traded peer-to-peer without the need for intermediaries.
2. Energy Trading and Peer-to-Peer Transactions: Blockchain-based energy trading platforms enable
peer-to-peer energy transactions between producers and consumers, bypassing traditional energy
suppliers and distributors. Smart contracts facilitate automated, secure, and transparent energy
transactions, allowing consumers to buy and sell excess energy in real-time.
3. Grid Management and Optimization: Blockchain enables real-time monitoring, control, and
optimization of energy grids through decentralized energy management systems.
4. Renewable Energy Certificate (REC) Tracking: Blockchain-based REC tracking platforms provide a
transparent and tamper-resistant ledger for recording the generation, transfer, and retirement of RECs.
5. Energy Data Management and Security: Blockchain provides cryptographic techniques and
decentralized storage solutions that enhance the security and privacy of energy data.
6. Grid Resilience and Disaster Recovery: Blockchain enables the creation of decentralized microgrids
and energy communities that can operate independently during emergencies or grid outages.