0% found this document useful (0 votes)
28 views16 pages

BLOCKCHAIN

The document provides a comprehensive overview of blockchain technology, including its definition, importance, types, and key components like private and public keys, smart contracts, and consensus mechanisms such as Proof of Work and Proof of Stake. It also discusses vulnerabilities in blockchain systems, the architecture of blockchain applications, and includes a simple Solidity smart contract example. Additionally, it highlights various types of blockchain attacks and their mitigations.

Uploaded by

keza loenah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views16 pages

BLOCKCHAIN

The document provides a comprehensive overview of blockchain technology, including its definition, importance, types, and key components like private and public keys, smart contracts, and consensus mechanisms such as Proof of Work and Proof of Stake. It also discusses vulnerabilities in blockchain systems, the architecture of blockchain applications, and includes a simple Solidity smart contract example. Additionally, it highlights various types of blockchain attacks and their mitigations.

Uploaded by

keza loenah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

BLOCKCHAIN END TERM1

ANSWERS
1. Define blockchain and explain
its importance in modern
technology.
Definition: Blockchain is a distributed ledger technology
where data is stored in blocks that are linked using
cryptographic hashes. It operates on a decentralized
network, ensuring transparency, security, and immutability.
Importance:
• Enhances security by preventing unauthorized alterations.
• Promotes transparency as all participants have access to the
same data.
• Eliminates intermediaries, reducing costs and increasing
efficiency.
• Provides trust in digital transactions, essential for industries like
finance, healthcare, and supply chain.
2. List and describe any two types of
blockchain.

Public Blockchain:
2.Open to everyone and does not require permission to
participate.
3.Examples: Bitcoin, Ethereum.
4.Provides high transparency but may face scalability issues.
Private Blockchain:
5.Access is restricted to specific individuals or organizations.
6.Used for enterprise solutions, such as supply chain
tracking.
7.Offers better control and privacy but is less decentralized.
3. What are private keys and public keys in
blockchain wallets? Why are they important?
Private Key: A secret key used to sign transactions
and prove ownership of blockchain assets.
Public Key: A derived key from the private key used to
generate wallet addresses and verify signatures.
Importance:
• Private keys ensure the security and authenticity of
transactions.
• Public keys enable others to interact with the wallet without
exposing sensitive information.
4. Explain the term "smart
contract" and provide one
example of its use.
Definition: A smart contract is a self-executing program
stored on the blockchain that automatically enforces the
terms of an agreement when predefined conditions are
met.
Example:
• In insurance, a smart contract can automatically process
claims when evidence of an event (e.g., flight delay) is
verified.
5. What is Proof of Work (PoW)?
How does it ensure the security
of a blockchain?
• Definition: PoW is a consensus mechanism where
miners solve complex mathematical problems to
validate transactions and add blocks to the blockchain.
• Security:
• The computational effort makes attacks costly and resource-
intensive.
• Blocks cannot be altered without re-mining, ensuring
immutability.
6. Identify and describe any two
vulnerabilities or attacks in blockchain
systems.
51% Attack:
Occurs when a single entity gains control of more than 50% of
the network’s hashing power.
Can lead to double-spending and block reorganization.
Smart Contract Exploits:
Vulnerabilities in poorly written smart contracts can be
exploited to drain funds or cause unintended behavior.
Example: The DAO hack on Ethereum.
7. Describe the key steps
involved in a blockchain
transaction.
• Transaction Creation: A user creates a transaction using a
private key.
• Broadcasting: The transaction is broadcast to the network.
• Validation: Nodes verify the transaction’s validity (e.g.,
checking digital signatures).
• Block Formation: Valid transactions are grouped into a block.
• Consensus: The block is validated through a consensus
mechanism like PoW or PoS.
• Addition to the Blockchain: The block is added to the
blockchain, making the transaction permanent.
8. List the layers of the blockchain technology
stack and explain the role of the Consensus
Layer.
Layers:
1. Application Layer: Interfaces for users (e.g., wallets, dApps).
2. Execution Layer: Processes transactions and smart contracts.
3. Consensus Layer: Ensures agreement among nodes on the
blockchain state.
4. Network Layer: Manages communication between nodes.
5. Data Layer: Stores blockchain data.
Consensus Layer Role: Maintains trust and consistency
across the network by validating transactions and
ensuring the blockchain remains tamper-proof.
SECTION B
Compare Proof of Stake (PoS) and Proof of Work (PoW).
Highlight one advantage and one disadvantage of each
consensus mechanism.

1.Proof of Work (PoW):


1.Advantage: Highly secure due to computational difficulty.
2.Disadvantage: Energy-intensive and slow.
2.Proof of Stake (PoS):
1.Advantage: Energy-efficient and faster.
2.Disadvantage: Potential centralization as wealthier participants have
more control.
2. Explain the architecture of a blockchain
application.

Components:
2.Blockchain Network: Core infrastructure.
3.Smart Contracts: Business logic.
4.APIs: Facilitate interaction between front-end and blockchain.
5.Front-End Interface: User-facing application.
Connections:
2.Front-end communicates with smart contracts through APIs.
3.Smart contracts interact with the blockchain network.
Process:
2.Define requirements.
3.Choose a blockchain platform.
4.Develop smart contracts.
5.Integrate front-end and back-end.
6.Test and deploy.
3. Discuss any two types of blockchain attacks. Explain
how they work and suggest ways to mitigate them.

Sybil Attack:
• Attackers create multiple fake identities to gain control of the network.
• Mitigation: Use strong consensus mechanisms like PoW or PoS.
Replay Attack:
• Transactions from one blockchain are maliciously repeated on another.
• Mitigation: Implement unique transaction identifiers and expiration
mechanisms.
4. Define Solidity and explain the key steps to
set up a Solidity development environment.

• Definition: Solidity is a high-level programming


language for writing smart contracts on Ethereum and
similar blockchains.
• Setup Steps:
• Install a code editor (e.g., Visual Studio Code).
• Install Node.js and npm.
• Install Truffle or Hardhat for development.
• Use Ganache for a local blockchain environment.
• Compile, deploy, and test smart contracts using the chosen
tools.
5. Write a simple Solidity smart contract to store
and retrieve a number. Explain the purpose of each
part of the code.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract SimpleStorage {
uint public storedNumber;

// Function to store a number


function store(uint _number) public {
storedNumber = _number;
}

// Function to retrieve the stored number


function retrieve() public view returns (uint) {
return storedNumber;
}
}
Code Explanation:
• pragma solidity ^0.8.0;: Specifies the Solidity
compiler version.
• contract SimpleStorage: Defines the smart contract.
• uint public storedNumber;: Declares a public
variable to store the number.
• store: A function to update the storedNumber variable.
• retrieve: A function to return the stored number.

You might also like