BCT(CSE) IA2 Lecture Notes Part 2
BCT(CSE) IA2 Lecture Notes Part 2
1. Peer-to-peer messaging.
Limitations:
1. Slow Processing
2. Small Storage
In this model, blockchain nodes are the members of the network. They can be personal
computers, enterprise servers or also cloud- based nodes. Clients are the IoT devices.
Blockchain Clients and nodes interact with each other through APIs. Clients create
transactions and these transactions are relayed to nodes for processing and storing the
data into the distributed ledger.
2. Authentication of users: The sender digitally signs the message before sending
them to other devices. The receiving device then gets the public key from the
ledger and uses it to verify the digital signature of the received message. The digital
signature work is described below:
• Sender calculates hash of a message that is then encrypted with its private key.
• The receiver then decrypts the digital signature using the public key of sender
stored in the ledger to obtain the hash value as calculated by the sender.
• The message is valid only if the calculated hash and the protected hash of the
message are same.
3. Discovering legitimate IoT at large scale as soon as a new IoT device starts, it
asks root servers to give a list of trusted nodes in the network. This device then
registers itself in a node, and the exchange of information starts. DNSSec must be
implemented to secure name resolution of root servers by avoiding any spoofing
attacks. Every communication made must be authenticated and encrypted
efficiently. This can be done based upon:
• Properties of IoT like Configuration details and the last version firmware validated
can be hosted on the ledger. During bootstrap, the blockchain node is asked to get
its configuration from the ledger. The configuration is required to be encrypted in
the ledger to prevent the discovery of IoT network topology or its properties by
analysis of the information stored in the public ledger.
• The hash value of latest configuration file for every device can be hosted in the
ledger. Using a cloud service the IoT device will have to download the latest and
trusted configuration file after every fixed interval of time. Then the device can use
the blockchain node API to retrieve and match the hash value, which is stored in
the blockchain. This would allow the administrators to remove any bad
configurations regularly and reboot each IoT device in the network with latest and
trusted configurations
Securing the network of IoT devices with a blockchain network makes the system
decentralized, in which there is no single authority which can approve any transaction.
Each device will have a copy of the ever-growing chain of data. This means that whenever
someone wishes to access the device and do some transaction, then all the members of
the network must validate it. After the validation is done, the performed transaction is
stored in a block and is sent to all the nodes of the network. All this make the system more
secure and impossible for the un-authorized sources to breach into the security.
A Scalable Security Framework for Large-Scale IoT (Internet of Things) must address
the unique challenges of IoT environments, such as heterogeneity, resource constraints,
dynamic topologies, and massive device counts. Below is an outline of a scalable
security framework tailored to such systems:
1. Framework Overview
Objective:
To ensure confidentiality, integrity, availability, and authenticity across a vast,
distributed network of heterogeneous IoT devices with minimal computational overhead
and maximal scalability.
• ECC (Elliptic Curve Cryptography) for secure key exchange due to its efficiency.
• Three-tier architecture:
• Use of Zero-Touch Provisioning (ZTP) and Public Key Infrastructure (PKI) for
automated and secure onboarding.
• End-to-end encryption using lightweight TLS (e.g., TLS 1.3 for IoT).
• Use of version control and digital signatures to prevent rollback and malicious
updates.
3. Scalability Strategies
4. Evaluation Metrics
5. Future Enhancements
• Use of AI-driven adaptive security policies that evolve with threat landscapes.
1. Re-entrancy Attacks
Smart contracts that make external calls to other contracts before updating their own
states face exposure to this vulnerability. External contracts can exploit this vulnerability
to repeat actions such as withdrawals or introduce malicious code. For example, an
external contract can use a reentrancy attack to perform repeated withdrawals and drain
an account of funds.
Mitigation
Overflows exceed maximum values, while underflows fall below them. If the integer is
signed, overflow yields the maximum positive value, while for unsigned integers,
underflow yields the maximum value. Integer overflows and underflows allow attackers
to increase account and token amounts and make excessive withdrawals or to alter
contact logic for purposes such as multiplying tokens or stealing funds.
Mitigation
• Use Solidity compiler version 0.8.0 or higher which automatically checks for
overflows and underflows.
3. Timestamp Dependence
This variable often supports time-sensitive functions such as auctions, lotteries, and
token vesting. By manipulating timestamps, hackers can delay or accelerate actions,
alter conditions for triggering functions, or executing actions before others. For example,
a hacker could end an auction before others have a chance to bid.
Mitigation
• Use trusted external time sources or multiple time sources to ensure reliable
timing.
This vulnerability occurs when contract code fails to apply user permission levels to
restrict access. Unauthorized users then can access or modify contract data or
functions, or steal funds or assets managed by the contract.
Mitigation
5. Front-running Attacks
This typically occurs when attackers can see the blockchain memory pool (mempool),
which stores unconfirmed data about unconfirmed transactions that have been verified
by available blockchain network nodes but have yet to be approved by miners. When
hackers can see mempool data, they can increase the gas fee paid to miners to ensure
their transaction takes processing priority over target transactions. This can allow
attackers to make victims pay more for tokens, reduce funds paid to victims, or alter
token prices.
Mitigation
For example, an attacker might create transactions requiring excessive gas, use
reentrancy to exploit contract call sequences and access unauthorized funds, or impose
gas limit constraints to consume excessive block gas. Denial of service attacks can
render smart contracts unusable, trigger financial losses, and damage platform
reputation.
Mitigation
• Take precautions when using calls for external calls, loops, and traversals that can
trigger excessive gas consumption.
Logic errors occur when smart contracts contain code that diverges from desired
behaviour. Depending on the nature of the error, this can cause unexpected behaviour or
disrupt functionality. For example, errors can trigger loss of funds or misallocation of
tokens.
Mitigation
• Validate your code by writing comprehensive test cases to cover all possible
business logic scenarios.
• Run comprehensive code reviews and audits to identify and fix logic errors.
• Document intended behaviour for all functions and modules and confirm
consistency with actual execution.
8. Insecure Randomness
This vulnerability exploits the fact that blockchain networks rely on pseudorandom
numbers. Blockchain networks follow deterministic patterns, making it challenging to
generate true random numbers. Additionally, complex calculations can cost excessive
gas.
This allows miners to manipulate functions developers use to generate random numbers,
including:
• blockhash(uint blockNumber), defining the hash of a given block for the last 256
blocks
Attackers can exploit insecure to gain an unfair advantage in games, lotteries, random-
seed generation, or other contracts dependent on random number generation. This
allows attackers to win unfairly while causing other participants to lose money and
sowing distrust of contract fairness.
Mitigation
• Use oracles such as BTCRelay that employ Bitcoin block hash cryptographic
fingerprints when bridging Ethereum and Bitcoin, while taking steps to safeguard
miner incentive issues
This attack exploits limits on the amount of gas available to a single block.
Gas limits constrain smart contract computations per transaction. Functions exceeding
block gas limits can exhaust resources and trigger transaction failure. This frequently
occurs when contracts contain loops that iterate over dynamic data structures such as
lists and arrays over an indefinite number of iterations. Gas limit vulnerabilities can
render contract functions unexecutable, freezing contracts or locking funds.
Mitigation
• Program functions to validate that users can’t control variable lengths within
loops to traverse large data amounts or, when this is not feasible, to limit loop
length
• When using loops in Solidity, the developers, ensure that in-loop transactions stay
within gas limits and don't consume excessive gas
This vulnerability occurs when smart contracts verify outcomes of external function
calls.
This can allow calls to fail without generating an exception error, causing the contract to
proceed as if the call was successful. When this happens, funds can be lost if
transactions fail to complete, and attackers can exploit resulting inconsistencies in the
contract state, potentially setting the stage to launch re-entry attacks that drain funds or
disrupt contract logic.
Mitigation
• Use transfer() instead of send() to ensure the contract reverts the transaction if the
external call fails
1. Two-Way Peg: The two-way peg is a mechanism that locks assets on the main
chain and issues equivalent assets on the sidechain. When assets are moved
back to the main chain, the sidechain assets are burned or destroyed, and the
original assets are unlocked.
Types of Sidechains
3. Public Sidechains: Public sidechains are open for anyone to join and participate
in, like the main blockchain. They benefit from the decentralized nature of the
main chain but operate independently.
5. Rollups: Rollups are a type of sidechain that performs transactions off the main
chain but periodically posts summaries of these transactions to the main
blockchain.
6. Custom Sidechains: Custom sidechains are built to cater to specific use cases
or requirements. They can be tailored to meet unique needs such as specialized
consensus algorithms or regulatory compliance.
Advantages of Sidechains
1. Security Risks: Sidechains may have different security models compared to the
main chain. If not properly secured, sidechains could be more vulnerable to
attacks.
Use Cases
1. Introduction
Side chains are independent blockchains that are interoperable with a parent or main
blockchain (often referred to as the main chain). Assets and data can be transferred
between the side chain and the main chain through a two-way peg mechanism. They offer
a promising solution for addressing scalability and privacy challenges in blockchain
systems.
a. Offloading Transactions
b. Parallel Execution
• Multiple side chains can run in parallel, each optimized for specific workloads
(e.g., gaming, finance, supply chain).
• Side chains can implement faster consensus algorithms (e.g., Proof of Authority,
PBFT) to achieve lower latency and higher throughput compared to the typically
slower main chain consensus (e.g., Proof of Work).
d. Use Cases
• Ethereum's Polygon (Matic) uses side chains to process transactions faster and
at lower costs.
• Bitcoin's Liquid Network offers faster and confidential transactions tailored for
financial institutions.
3. Side Chains for Privacy
a. Data Confidentiality
• Example: Aztec Network and zkSync (on Ethereum) implement zk-SNARKs for
privacy-preserving operations.
b. Selective Transparency
• Enterprises can use permissioned side chains where only authorized nodes can
access transaction data.
• Enables private smart contracts, useful in healthcare, finance, and supply chain
scenarios.
c. Transaction Anonymity
d. Use Cases
• Quorum (a side chain of Ethereum) provides transaction and contract privacy for
enterprise applications.
4. Security Considerations
• Two-Way Peg Security: Critical for ensuring asset integrity during transfers
between main and side chains.
• Consensus Integrity: Side chains may be more vulnerable if they use weaker
consensus mechanisms.
• Fraud Detection: Periodic anchoring to the main chain or fraud proofs may be
required for trust minimization.
5. Benefits Summary
6. Future Directions
If a patient gets care in one of the blockchain network facilities but outside their usual
hospital, the admitting healthcare facility will request access to the patient’s blockchain
medical records. The patient should authorize PHI sharing by entering a private ID into
the patient authentication interface. If the ID is correct, the smart contract initiates
patient health data sharing.
The blockchain solution can be integrated with a patient portal, a patient app, a
telehealth app, a chronic disease management app, EHR, LIS, RIS, etc.
A care team member can view a record or initiate a blockchain record creation via the
solution’s interface.
The blockchain solution stores the information on a creator of a new health record (a
medical staff member’s name, position, etc.) and record creation time to ensure full
data traceability and reliability (e.g., for clearinghouses and reimbursement purposes).
The blockchain solution for health records enables easy access to personal data via a
patient interface, integrated patient portal, patient/telehealth app, etc.
In the case of RPM integration, patient monitoring reports are automatically recorded in
the blockchain system and included in a patient health record.
Blockchain enables automated doctor referrals validation using smart contracts and
patient appointment scheduling (via integration with a patient portal/app).
The blockchain solution for health records uses multi-factor authentication for system
login and private ID-based authorization and action authentication.
Data security
To secure the data within the blockchain system and ensure HIPAA compliance, the
solution employs health data encryption, role-based access management, fraud
detection algorithms, etc.
Blockchain-Based Marketplace
Lower transaction costs for sellers. A major driver behind the popularity of
decentralized marketplaces. Traditional non-bank payment providers often charge high
fees.
Enhanced privacy and security for users. Blockchain instantly encrypts transactional
data and stores it in an immutable, tamper-resistant ledger, protecting sensitive buyer
information from breaches and theft. Escrow smart contracts further secure buyer-seller
transactions and safeguard buyers by holding funds and releasing them to sellers only
after they meet their obligations.
• Digital wallet is an app to send and receive crypto tokens used for payment
transactions on a decentralized marketplace.
• The front-end layer is a web application accessible for users. It is created for two
user roles – sellers and buyers.
• The back-end layer processes data that will be stored outside the blockchain
(e.g., product listings).
• Web3 API provides the connection between the web front end and smart
contracts.
Selling process
Buying process
As payment transactions are conducted directly between sellers and buyers, without
a payment provider in between, escrow smart contracts provide guarantees for the
parties. They hold the tokens transferred by the buyer until the purchased item is
delivered and then release the tokens to the seller.
Proprietary cryptocurrency
You may implement other cryptocurrencies your marketplace will support. Bitcoin is
a go-to choose as the most widely accepted cryptocurrency.
Hashing
b. Blockchain Interoperability
• Rise of platforms like Polkadot, Cosmos, and Quant that enable cross-chain
communication.
• Future networks will likely support multi-chain ecosystems, enabling data and
asset transfer across different chains.
c. Blockchain-as-a-Service (BaaS)
• Major cloud providers (e.g., AWS, Microsoft Azure, IBM) offering blockchain
solutions as a service.
• Reduces entry barriers for startups and SMEs.
• Decentralized Finance (DeFi) will expand beyond trading into lending, insurance,
and derivatives.
• Web3 envisions user-owned internet services built on blockchain—redefining
social media, content sharing, and identity management.
2. Challenges to Overcome
a. Healthcare
c. Finance
e. Education
4. Long-Term Vision
a. Global Digital Identity Infrastructure
b. Tokenized Economies
Assets such as real estate, art, carbon credits, and intellectual property will
increasingly be tokenized for fractional ownership and global trade.
DAOs will evolve into scalable, legally recognized entities for community-driven
governance and business models.
d. Regulatory Convergence
5. Conclusion