Blockchain and its applications
Bishakh Chandra Ghosh
Department of Computer Science & Engineering
Indian Institute of Technology Kharagpur
Lecture 51: Hyperledger Aries
• Aries Overview
• Aries Architecture
• Installation and usage
• Digital Credentials
• Aries
Hyperledger Aries
Hyperledger Aries provides a shared, reusable,
interoperable tool kit designed for initiatives
and solutions focused on creating, transmitting
and storing verifiable digital credentials.
It is infrastructure for blockchain-rooted, peer-
to-peer interactions.
Aries agent frameworks -.
• Aries Cloud Agent - Python (ACA-Py)
• For any non-mobile application. Has production deployments.
• Aries Framework - .NET
• Aries Static Agent - Python
https://www.hyperledger.org/use/aries
Aries Architecture
ACA-Py
• ACA-Py exposes a REST API to
access Aries capabilities
• Write a ā€˜Controller’ to implement
application business logic.
• Controller sends HTTP requests
(REST) to execute commands.
Response events are fed back to the
controller as webhooks.
Aries Architecture
The agent -
• Configured via command line
parameters
• Interacts with other agents via
pluggable transports
• Manages storage, ledger with
pluggable implementations
• Manages messages and protocol
state
• Invokes protocols (configurable set)
• Driven by a controller
• Sends events to controller
• Exposes an HTTP JSON
administrative API to
controller
Installation
• Install libindy and indy-cli
• apt-key adv --keyserver keyserver.ubuntu.com --recv-keys
CE7709D068DB5E88
• apt-add-repository "deb https://repo.sovrin.org/sdk/deb
bionic master" -y
• apt-get update
• apt-get install -y libindy indy-cli
• Install python3-indy
• python3 -m pip install python3-indy
• Install aries-cloudagent
• python3 -m pip install aries-cloudagent
Installation
If you installed the PyPi package, the executable aca-py should be
available on your PATH.
Use the following commands to check the version, list the available modes
of operation, and see all of the command line parameters:
• aca-py --version
• aca-py --help
• aca-py provision --help
• aca-py start --help
Starting Aries Agent
Provisioning a Wallet
It is possible to provision an Indy wallet before running an agent:
aca-py provision --wallet-type indy --seed $SEED
Use the SEED to configure existing nodes in the indy pool, e.g. Stewards.
Starting Aries Agent
When starting an agent instance, at least one inbound and one outbound transport MUST
be specified.
For example:
aca-py start --inbound-transport http 0.0.0.0 8000 --outbound-transport http
More Parameters:
• Transports: inbound, outbound, endpoint
• Logging/debugging settings
• Label: self-attested agent name
• Wallet implementation and related info
• For controller: Admin API configuration
• URL
• Security selection
• Protocol automation flags
• Ledger parameters (e.g. genesis URL, etc.)
• Add timing information to messaging
• Optional protocols to load
• From controller: Event webhook URL
Using Aries with Indy
aca-py start --inbound-transport http 0.0.0.0 8000 
--outbound-transport http 
--admin-insecure-mode 
--admin 0.0.0.0 8001 
--seed 000000000000000000000000Steward1 
--replace-public-did 
--wallet-type indy 
--genesis-file
/home/bishakh/Documents/TA/Blockchain/indytutorial/pool1.txn 
--wallet-name agent1 
--wallet-key agent1 
--log-level debug 
--log-file /tmp/arieslog.txt
--admin-insecure-mode 
--admin 0.0.0.0 8001 
For experimentation and debugging
only
Aries Admin OpenAPI Interface
Conclusion
• Aries
• Communication between participants
• Digital Credentials
Blockchain and its applications
Prof. Shamik Sural
Department of Computer Science & Engineering
Indian Institute of Technology Kharagpur
Lecture 52: Blockchain Security - I
• Risks in Blockchain
• Common Risks and Specific Risks
• 51% Vulnerability
• Private Key Security
• Criminal Activities
• Double Spending
• Transaction Privacy
Risks in Blockchain
Risks
Common Risks Specific Risks
Blockchain
operation mechanism
(Blockchain 1.0, 2.0)
Development,
deployment and
execution of
smart contract
(Blockchain 2.0)
"A Survey on the Security of Blockchain Systems", Xiaoqi Li, Peng Jiang, Ting Chen, Xiapu Luo and Qiaoyan
Wen, Future Generation Computer Systems
Risks in Blockchain
Risk
Blockchain operation
mechanism
Smart contract
execution
51% vulnerability
Private key security
Criminal activity
Double spending
Transaction privacy leakage
Criminal smart contract
Vulnerabilities in smart contract
Under-optimized smart contract
Under-priced operations
Common Risk: 51% Vulnerability
Block
10
Block
11
Block
12
Block
13
Block
11'
Block
12'
Block
13'
Block
14'
Hashing power
Hashing power
Common Risk: 51% Vulnerability
Block
10
Block
11
Block
12
Block
13
Block
11'
Block
12'
Block
13'
Block
14'
Coins
Coins
Common Risk: Private Key Security
Alice Bob
Alice's private key to sign the
message
Alice's public key to verify the
message
Steal Alice's
private key
Common Risk: Criminal Activities
Ransomware
Underground
market
Money
laundering
Valid
coin
Chaff
coin
Common Risk: Double Spending
1. TXv is added to the wallet of the targeted vendor
Attacker
Mining Pool
Vendor
Bitcoin Network
2. TXa is mined as valid into the blockchain
3. The attacker gets TXv ’s output before the vendor detects misbehavior
Common Risk: Transaction Privacy Leakage
A new transaction (the star) which spends an available coin (the second circle from the right)
Transactions and tracing in Bitcoin Transactions and tracing in Cryptonote
 Each transaction input explicitly
identifies the coin being spent,
thus forming a linkage graph
 Each transaction input identifies a set of coins,
including the real coin along with several chaff
coins called ā€œmixins.ā€
 Many mixins can be ruled out by deduction
 The real input is usually the ā€œnewestā€ one
• Introduced the basic risk types in blockchain
• Discussed in detail some of the common risks
• Web resources as mentioned from time to time
Blockchain and its applications
Prof. Shamik Sural
Department of Computer Science & Engineering
Indian Institute of Technology Kharagpur
Lecture 53: Blockchain Security - II
• Selfish Mining Attack
• Different Scenarios and Attacker’s Actions
• Selfish Mining
• Attacker’s Pool
• Public Chain
• Block Suppression
Selfish Mining Attack
Block 10 Block 11 Block 12 Block 13
Block 11' Block 12' Block 13' Block 14'
Mining Pool
Others
"Majority Is Not Enough: Bitcoin Mining Is Vulnerable", Ittay Eyal and Emin Guen Sirer, Financial Cryptography, 2014
Selfish Mining Attack
Block 10 Block 11 Block 12 Block 13
Block 11' Block 12' Block 13' Block 14'
Mining Pool
Others
Selfish Mining Attack
Pool intentionally forking the chain for keeping
discovered blocks private
Discovering more blocks by pool develops a longer lead on the
public chain, and continues to keep these new blocks private
The honest nodes continue to mine on the public chain
The pool mines on its own private branch
When the public branch approaches the pool’s private branch in length,
the selfish miners reveal blocks from their private chain to the public
Selfish Mining Attack
1. Any state but two branches of length 1, pools finds a block
 The pool appends one block to its private branch, increasing its lead on the public branch by one
 Revenue from this block will be determined later
1
0
11pub
11pool 12pool 13pool 14pool 15pool
10
11pub
11pool 12pool 13pool 14pool
10
11pool
10
Others' public chain
Pool's private chain
OR
Selfish Mining Attack
2. Was two branches of length 1, pool finds a block
10
11pub
11pool 12pool
10
11pub
11pool 12pool
 The pool publishes its secret branch of length two
 Pool obtains a revenue of two
10
11pub
11pool
Selfish Mining Attack
3. Was two branches of length 1, others find a block after pool head
10
11pub
11pool
12pub
 The pool and the others obtain a revenue of one each - the others for the new head, the pool for its
predecessor
10
11pub
11pool
Selfish Mining Attack
4. Was two branches of length 1, others find a block after others’ head
10
11pub
11pool
12pub
 The others obtain a revenue of two
10
11pub
11pool
Selfish Mining Attack
5. No private branch, others find a block
 Both the pool and the others start mining on the new head
 The others obtain a revenue of one
10
10
11pub
Selfish Mining Attack
6. Lead was 1, others find a block
 There are two branches of length one, and the pool publishes its single secret block
 The revenue from this block cannot be determined yet
10
11pub
11pool
10
11pub
11pool
10
11pool
Selfish Mining Attack
7. Lead was 2, others find a block
 The pool publishes its secret blocks, causing everybody to start mining at the head of the
previously private branch
 Pool obtains a revenue of two
10
11pub
11pool 12pool 13pool
10
11pub
11pool 12pool 13pool
12pub
Selfish Mining Attack
7. Lead was 2, others find a block (Contd.)
 The pool publishes its secret blocks, causing everybody to start mining at the head of the
previously private branch
 Pool obtains a revenue of two
10
11pub
11pool 12pool 13pool
12pub
10
11pub
11pool 12pool 13pool
12pub
Selfish Mining Attack
8. Lead was more than 2, others win
 The pool now reveals its i’th block
 Pool obtains a revenue of one
10
11pool 12pool 13pool
10
11pub
11pool 12pool 13pool
10
11pub
11pool 12pool 13pool
• Discussed selfish mining attack in detail
• Decisions of the attacker under different conditions
• Web resources as mentioned from time to time
Blockchain and its applications
Prof. Shamik Sural
Department of Computer Science & Engineering
Indian Institute of Technology Kharagpur
Lecture 54: Blockchain Security - III
• Eclipse Attack
• Front-running Attack
• Eclipse Attack
• Peer-to-Peer Network
• Front-running Attack
• Displacement, Insertion, Suppression
Eclipse Attack
To be victim
node
Normal
nodes
"Eclipse Attacks on Bitcoin’s Peer-to-Peer Network", Ethan Heilman, Alison Kendler, Aviv
Zohar and Sharon Goldberg, 24th USENIX Security Symposium, 2015
Eclipse Attack
Normal
nodes
Attacker
node
Victim node
Eclipse Attack
Victim node
Attacker
nodes Normal
nodes
Eclipse Attack
Victim
node
Attacker
node
Rest of
network
Off-path attack - attacker controls end-hosts, but not key
network infrastructure between the victim and the rest of the
bitcoin network
Eclipse Attack
30%
Hashing
power
30%
Hashing
power
40%
Hashing
power
Benefit: 51% attack with 40% mining power
Attacker partitions miners so they can't build on each other blocks
The attacker then outcompetes each partitioned miner
30% < 40% 40% >30%
Eclipse Attack
Attacker populates the victim node's peer tables with attacker's IP addresses
The victim establishes all new outgoing connections to attacker IP addresses
Victim node restarts and loses current outgoing connections
Eclipse Attack
1. Populating of IP addresses
 Each node picks its peers from IP addresses stored in two tables
 New table: IPs the node has heard about
 Tried table: IPs the node peered with some point
 The tables also store a timestamp for each IP
 Each table stores the IPs in buckets
 To find an IP to make an outgoing connection to:
1. Choose new or tired table to select from
2. Select an IP with newest timestamp
3. Attempt an outgoing connection to that IP
Attacker populates tables with attacker IPs so that the victim
node only connects to the attacker IPs
Selection Bias: Attacker ensures its IPs are the newer one
Eclipse Attack
2. Restarting node event is natural?
 Software/security updates
 Packets of death/DoS attacks
 Power/network failures
 ISP outages
Eclipse Attack
3. Bucket eviction
 The bucket is full, and an IP is inserted into it
1. Randomly selects 4 IPs
2. Delete oldest IP
3. Insert new IP
Eviction Bias: Attacker IPs will always have the most recent
timestamps
Try-Try-Again: If an attacker IP replaces another attacker IP, the
evicted IP is resend and eventually replaced by honest IP
Front-running Attack
Ethereum Network
Attacker
2. Detects
Buy (1000)
Alice
"SoK: Transparent Dishonesty: Front-Running Attacks on Blockchain", Shayan
Eskandari, Seyedehmahsa Moosavi and Jeremy Clark, FC 2019 Workshops, 2020
Front-running Attack
Front-running Attack
Displacement
Insertion
Suppression
After Attacker's run, Alice's function call is not
important to the attacker
After Attacker's run, the state of the contract is changed.
Alice's function call is needed to run on this modified state
After Attacker's run, she tries to delay Alice's function
call. After the delay, Alice's function call is indifferent to
the attacker
Front-running Attack
Front-running Attack
(Displacement / Insertion / Suppression)
Asymmetric
Bulk
Alice is trying to cancel an offer, and Attacker is trying to fulfill
it first
Attacker is trying to run a large set of functions and Alice is trying
to buy a limited set of shares offered by a firm on a blockchain
Front-running Attack
Markets and Exchanges: Spotting a profitable cancellation transaction
[…]
Cancel (order 100)
Breed (cryptokittie 1,
cryptokittie 2)
Buy (order 101)
Bid (Bj)
Register (Bi)
[…] Ethereum Network
(Unordered) mempool
Block Height #N
Register (Bi)
Buy (order 100)
Cancel (order 100)
Buy (order 101)
Bid (Bj)
Breed (cryptokittie 1,
cryptokittie 2)
Reordered Block
Adversarial
miner
mines a
block with
preferred
order
Front-running Attack
Gambling: Bribing miners for prioritizing themselves
 When the timer of Fomo3D game reached
about 3 minutes, the winner bought 1 ticket
and then sent multiple high gasPrice
transactions to her own DApps
 Transactions congested the network
 Bribed miners to prioritize them ahead
of any new ticket purchases in Fomo3D
Attacker DApps
Users
• Described eclipse attack and front-running attack
• Importance of identifying attacks on blockchain and suggesting
remedies
• Combining multiple attacks
• Web resources as mentioned from time to time
Blockchain and its applications
Prof. Sandip Chakraborty
Department of Computer Science & Engineering
Indian Institute of Technology Kharagpur
Lecture 55: Use Cases
• Blockchain use cases
• What makes a good blockchain use case?
• Use cases for enterprises
• Requirements for defining a blockchain
• Network
• People
• Assets
• Transactions
Simple Use Cases by Industry
What makes a good blockchain use case?
• Identifying a good blockchain use-case is not always easy!
• However, there should always be:
1. A business problem to be solved
• That cannot be more efficiently solved with other
technologies
2. An identifiable business network
• With Participants, Assets and Transactions
3. A need for trust
• Consensus, Immutability, Finality or Provenance
Understanding the Business Problem
1. What is the specific business problem / challenge that
the project will address?
• Scope the business challenge up front
2. What is the current way of solving this business
problem?
• Understand current systems and areas for
improvement
3. Assuming the business problem is large, what specific
aspects of this business problem will be addressed?
Understanding the Participants
1. Who are the business network participants
(organizations) involved and what are their roles?
• If there is no business network involved, then this
is not a good use case
2. Who are the specific people within the organization
and what are their job roles?
• Understand the key users in a business network.
Understanding the Participants
• Who are the participants? How many types of participants?
• How will they access and interact with the blockchain?
• Will they be peer nodes?
• Do you need web or mobile apps?
• Are gateways (such as exchanges or data providers) needed?
• Do you need to integrate to external data sources?
• Who will operate the blockchain? Who will govern/regulate
the blockchain?
• What is the value/incentive for each participant to join the
network?
Identities
• Do you need to know your users?
• Pseudo-anonymous blockchain like bitcoin does not
require user identities to be verified
Identities
• In most business use-cases, some form of identity is
required
• In public blockchains, an identity oracle (linked to a
trusted database) could provide such information sources
• Sources can come from governments, financial institutions
or utility providers
• In private blockchains, a gateway or controller ensures
identity is verified before credentials are issued to the
user
• Decentralized identity management is also possible – we
have seen that – may be the preferred way for a
blockchain application
Understanding the Assets and Transactions
1. What assets are involved and what is the
key information associated with the assets?
2. What are the transactions involved,
between whom, and what assets are
associated with transactions?
• Understand under what business or contractual
conditions assets are under, as they transfer
from one owner to another.
Defining Transactions
• What types of processes need to take place in your
blockchain network?
• Invoke actions – add, delete, change, transfer
• Query
• Do you need to control access to these functions based
on participant types or roles?
Additional Points of Understanding
1. What are the main steps in the current workflow
and how are these executed by the business
network participants?
2. What is the expected benefit of applying blockchain
technology to the business problem for each of the
network participants?
3. What legacy systems are involved? What degree of
integration with the legacy systems is needed?
Conclusion
• We need to think carefully before applying blockchain
directly on a problem
• Do we really need to use blockchain?
• What are the pros and cons of using blockchain to solve the
problem?
• Can there be a better technology?
• Can we define the entities?
• The business network
• The participants, assets, and transactions
Blockchain-Nptel-Online-certification-course-Week-11.pdf

Blockchain-Nptel-Online-certification-course-Week-11.pdf

  • 1.
    Blockchain and itsapplications Bishakh Chandra Ghosh Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Lecture 51: Hyperledger Aries
  • 2.
    • Aries Overview •Aries Architecture • Installation and usage
  • 3.
  • 4.
    Hyperledger Aries Hyperledger Ariesprovides a shared, reusable, interoperable tool kit designed for initiatives and solutions focused on creating, transmitting and storing verifiable digital credentials. It is infrastructure for blockchain-rooted, peer- to-peer interactions. Aries agent frameworks -. • Aries Cloud Agent - Python (ACA-Py) • For any non-mobile application. Has production deployments. • Aries Framework - .NET • Aries Static Agent - Python https://www.hyperledger.org/use/aries
  • 5.
    Aries Architecture ACA-Py • ACA-Pyexposes a REST API to access Aries capabilities • Write a ā€˜Controller’ to implement application business logic. • Controller sends HTTP requests (REST) to execute commands. Response events are fed back to the controller as webhooks.
  • 6.
    Aries Architecture The agent- • Configured via command line parameters • Interacts with other agents via pluggable transports • Manages storage, ledger with pluggable implementations • Manages messages and protocol state • Invokes protocols (configurable set) • Driven by a controller • Sends events to controller • Exposes an HTTP JSON administrative API to controller
  • 7.
    Installation • Install libindyand indy-cli • apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 • apt-add-repository "deb https://repo.sovrin.org/sdk/deb bionic master" -y • apt-get update • apt-get install -y libindy indy-cli • Install python3-indy • python3 -m pip install python3-indy • Install aries-cloudagent • python3 -m pip install aries-cloudagent
  • 8.
    Installation If you installedthe PyPi package, the executable aca-py should be available on your PATH. Use the following commands to check the version, list the available modes of operation, and see all of the command line parameters: • aca-py --version • aca-py --help • aca-py provision --help • aca-py start --help
  • 9.
    Starting Aries Agent Provisioninga Wallet It is possible to provision an Indy wallet before running an agent: aca-py provision --wallet-type indy --seed $SEED Use the SEED to configure existing nodes in the indy pool, e.g. Stewards.
  • 10.
    Starting Aries Agent Whenstarting an agent instance, at least one inbound and one outbound transport MUST be specified. For example: aca-py start --inbound-transport http 0.0.0.0 8000 --outbound-transport http More Parameters: • Transports: inbound, outbound, endpoint • Logging/debugging settings • Label: self-attested agent name • Wallet implementation and related info • For controller: Admin API configuration • URL • Security selection • Protocol automation flags • Ledger parameters (e.g. genesis URL, etc.) • Add timing information to messaging • Optional protocols to load • From controller: Event webhook URL
  • 11.
    Using Aries withIndy aca-py start --inbound-transport http 0.0.0.0 8000 --outbound-transport http --admin-insecure-mode --admin 0.0.0.0 8001 --seed 000000000000000000000000Steward1 --replace-public-did --wallet-type indy --genesis-file /home/bishakh/Documents/TA/Blockchain/indytutorial/pool1.txn --wallet-name agent1 --wallet-key agent1 --log-level debug --log-file /tmp/arieslog.txt --admin-insecure-mode --admin 0.0.0.0 8001 For experimentation and debugging only
  • 12.
  • 13.
    Conclusion • Aries • Communicationbetween participants • Digital Credentials
  • 15.
    Blockchain and itsapplications Prof. Shamik Sural Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Lecture 52: Blockchain Security - I
  • 16.
    • Risks inBlockchain • Common Risks and Specific Risks
  • 17.
    • 51% Vulnerability •Private Key Security • Criminal Activities • Double Spending • Transaction Privacy
  • 18.
    Risks in Blockchain Risks CommonRisks Specific Risks Blockchain operation mechanism (Blockchain 1.0, 2.0) Development, deployment and execution of smart contract (Blockchain 2.0) "A Survey on the Security of Blockchain Systems", Xiaoqi Li, Peng Jiang, Ting Chen, Xiapu Luo and Qiaoyan Wen, Future Generation Computer Systems
  • 19.
    Risks in Blockchain Risk Blockchainoperation mechanism Smart contract execution 51% vulnerability Private key security Criminal activity Double spending Transaction privacy leakage Criminal smart contract Vulnerabilities in smart contract Under-optimized smart contract Under-priced operations
  • 20.
    Common Risk: 51%Vulnerability Block 10 Block 11 Block 12 Block 13 Block 11' Block 12' Block 13' Block 14' Hashing power Hashing power
  • 21.
    Common Risk: 51%Vulnerability Block 10 Block 11 Block 12 Block 13 Block 11' Block 12' Block 13' Block 14' Coins Coins
  • 22.
    Common Risk: PrivateKey Security Alice Bob Alice's private key to sign the message Alice's public key to verify the message Steal Alice's private key
  • 23.
    Common Risk: CriminalActivities Ransomware Underground market Money laundering Valid coin Chaff coin
  • 24.
    Common Risk: DoubleSpending 1. TXv is added to the wallet of the targeted vendor Attacker Mining Pool Vendor Bitcoin Network 2. TXa is mined as valid into the blockchain 3. The attacker gets TXv ’s output before the vendor detects misbehavior
  • 25.
    Common Risk: TransactionPrivacy Leakage A new transaction (the star) which spends an available coin (the second circle from the right) Transactions and tracing in Bitcoin Transactions and tracing in Cryptonote  Each transaction input explicitly identifies the coin being spent, thus forming a linkage graph  Each transaction input identifies a set of coins, including the real coin along with several chaff coins called ā€œmixins.ā€  Many mixins can be ruled out by deduction  The real input is usually the ā€œnewestā€ one
  • 26.
    • Introduced thebasic risk types in blockchain • Discussed in detail some of the common risks
  • 27.
    • Web resourcesas mentioned from time to time
  • 29.
    Blockchain and itsapplications Prof. Shamik Sural Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Lecture 53: Blockchain Security - II
  • 30.
    • Selfish MiningAttack • Different Scenarios and Attacker’s Actions
  • 31.
    • Selfish Mining •Attacker’s Pool • Public Chain • Block Suppression
  • 32.
    Selfish Mining Attack Block10 Block 11 Block 12 Block 13 Block 11' Block 12' Block 13' Block 14' Mining Pool Others "Majority Is Not Enough: Bitcoin Mining Is Vulnerable", Ittay Eyal and Emin Guen Sirer, Financial Cryptography, 2014
  • 33.
    Selfish Mining Attack Block10 Block 11 Block 12 Block 13 Block 11' Block 12' Block 13' Block 14' Mining Pool Others
  • 34.
    Selfish Mining Attack Poolintentionally forking the chain for keeping discovered blocks private Discovering more blocks by pool develops a longer lead on the public chain, and continues to keep these new blocks private The honest nodes continue to mine on the public chain The pool mines on its own private branch When the public branch approaches the pool’s private branch in length, the selfish miners reveal blocks from their private chain to the public
  • 35.
    Selfish Mining Attack 1.Any state but two branches of length 1, pools finds a block  The pool appends one block to its private branch, increasing its lead on the public branch by one  Revenue from this block will be determined later 1 0 11pub 11pool 12pool 13pool 14pool 15pool 10 11pub 11pool 12pool 13pool 14pool 10 11pool 10 Others' public chain Pool's private chain OR
  • 36.
    Selfish Mining Attack 2.Was two branches of length 1, pool finds a block 10 11pub 11pool 12pool 10 11pub 11pool 12pool  The pool publishes its secret branch of length two  Pool obtains a revenue of two 10 11pub 11pool
  • 37.
    Selfish Mining Attack 3.Was two branches of length 1, others find a block after pool head 10 11pub 11pool 12pub  The pool and the others obtain a revenue of one each - the others for the new head, the pool for its predecessor 10 11pub 11pool
  • 38.
    Selfish Mining Attack 4.Was two branches of length 1, others find a block after others’ head 10 11pub 11pool 12pub  The others obtain a revenue of two 10 11pub 11pool
  • 39.
    Selfish Mining Attack 5.No private branch, others find a block  Both the pool and the others start mining on the new head  The others obtain a revenue of one 10 10 11pub
  • 40.
    Selfish Mining Attack 6.Lead was 1, others find a block  There are two branches of length one, and the pool publishes its single secret block  The revenue from this block cannot be determined yet 10 11pub 11pool 10 11pub 11pool 10 11pool
  • 41.
    Selfish Mining Attack 7.Lead was 2, others find a block  The pool publishes its secret blocks, causing everybody to start mining at the head of the previously private branch  Pool obtains a revenue of two 10 11pub 11pool 12pool 13pool 10 11pub 11pool 12pool 13pool 12pub
  • 42.
    Selfish Mining Attack 7.Lead was 2, others find a block (Contd.)  The pool publishes its secret blocks, causing everybody to start mining at the head of the previously private branch  Pool obtains a revenue of two 10 11pub 11pool 12pool 13pool 12pub 10 11pub 11pool 12pool 13pool 12pub
  • 43.
    Selfish Mining Attack 8.Lead was more than 2, others win  The pool now reveals its i’th block  Pool obtains a revenue of one 10 11pool 12pool 13pool 10 11pub 11pool 12pool 13pool 10 11pub 11pool 12pool 13pool
  • 44.
    • Discussed selfishmining attack in detail • Decisions of the attacker under different conditions
  • 45.
    • Web resourcesas mentioned from time to time
  • 47.
    Blockchain and itsapplications Prof. Shamik Sural Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Lecture 54: Blockchain Security - III
  • 48.
    • Eclipse Attack •Front-running Attack
  • 49.
    • Eclipse Attack •Peer-to-Peer Network • Front-running Attack • Displacement, Insertion, Suppression
  • 50.
    Eclipse Attack To bevictim node Normal nodes "Eclipse Attacks on Bitcoin’s Peer-to-Peer Network", Ethan Heilman, Alison Kendler, Aviv Zohar and Sharon Goldberg, 24th USENIX Security Symposium, 2015
  • 51.
  • 52.
  • 53.
    Eclipse Attack Victim node Attacker node Rest of network Off-pathattack - attacker controls end-hosts, but not key network infrastructure between the victim and the rest of the bitcoin network
  • 54.
    Eclipse Attack 30% Hashing power 30% Hashing power 40% Hashing power Benefit: 51%attack with 40% mining power Attacker partitions miners so they can't build on each other blocks The attacker then outcompetes each partitioned miner 30% < 40% 40% >30%
  • 55.
    Eclipse Attack Attacker populatesthe victim node's peer tables with attacker's IP addresses The victim establishes all new outgoing connections to attacker IP addresses Victim node restarts and loses current outgoing connections
  • 56.
    Eclipse Attack 1. Populatingof IP addresses  Each node picks its peers from IP addresses stored in two tables  New table: IPs the node has heard about  Tried table: IPs the node peered with some point  The tables also store a timestamp for each IP  Each table stores the IPs in buckets  To find an IP to make an outgoing connection to: 1. Choose new or tired table to select from 2. Select an IP with newest timestamp 3. Attempt an outgoing connection to that IP Attacker populates tables with attacker IPs so that the victim node only connects to the attacker IPs Selection Bias: Attacker ensures its IPs are the newer one
  • 57.
    Eclipse Attack 2. Restartingnode event is natural?  Software/security updates  Packets of death/DoS attacks  Power/network failures  ISP outages
  • 58.
    Eclipse Attack 3. Bucketeviction  The bucket is full, and an IP is inserted into it 1. Randomly selects 4 IPs 2. Delete oldest IP 3. Insert new IP Eviction Bias: Attacker IPs will always have the most recent timestamps Try-Try-Again: If an attacker IP replaces another attacker IP, the evicted IP is resend and eventually replaced by honest IP
  • 59.
    Front-running Attack Ethereum Network Attacker 2.Detects Buy (1000) Alice "SoK: Transparent Dishonesty: Front-Running Attacks on Blockchain", Shayan Eskandari, Seyedehmahsa Moosavi and Jeremy Clark, FC 2019 Workshops, 2020
  • 60.
    Front-running Attack Front-running Attack Displacement Insertion Suppression AfterAttacker's run, Alice's function call is not important to the attacker After Attacker's run, the state of the contract is changed. Alice's function call is needed to run on this modified state After Attacker's run, she tries to delay Alice's function call. After the delay, Alice's function call is indifferent to the attacker
  • 61.
    Front-running Attack Front-running Attack (Displacement/ Insertion / Suppression) Asymmetric Bulk Alice is trying to cancel an offer, and Attacker is trying to fulfill it first Attacker is trying to run a large set of functions and Alice is trying to buy a limited set of shares offered by a firm on a blockchain
  • 62.
    Front-running Attack Markets andExchanges: Spotting a profitable cancellation transaction […] Cancel (order 100) Breed (cryptokittie 1, cryptokittie 2) Buy (order 101) Bid (Bj) Register (Bi) […] Ethereum Network (Unordered) mempool Block Height #N Register (Bi) Buy (order 100) Cancel (order 100) Buy (order 101) Bid (Bj) Breed (cryptokittie 1, cryptokittie 2) Reordered Block Adversarial miner mines a block with preferred order
  • 63.
    Front-running Attack Gambling: Bribingminers for prioritizing themselves  When the timer of Fomo3D game reached about 3 minutes, the winner bought 1 ticket and then sent multiple high gasPrice transactions to her own DApps  Transactions congested the network  Bribed miners to prioritize them ahead of any new ticket purchases in Fomo3D Attacker DApps Users
  • 64.
    • Described eclipseattack and front-running attack • Importance of identifying attacks on blockchain and suggesting remedies • Combining multiple attacks
  • 65.
    • Web resourcesas mentioned from time to time
  • 67.
    Blockchain and itsapplications Prof. Sandip Chakraborty Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Lecture 55: Use Cases
  • 68.
    • Blockchain usecases • What makes a good blockchain use case?
  • 69.
    • Use casesfor enterprises • Requirements for defining a blockchain • Network • People • Assets • Transactions
  • 70.
    Simple Use Casesby Industry
  • 71.
    What makes agood blockchain use case? • Identifying a good blockchain use-case is not always easy! • However, there should always be: 1. A business problem to be solved • That cannot be more efficiently solved with other technologies 2. An identifiable business network • With Participants, Assets and Transactions 3. A need for trust • Consensus, Immutability, Finality or Provenance
  • 72.
    Understanding the BusinessProblem 1. What is the specific business problem / challenge that the project will address? • Scope the business challenge up front 2. What is the current way of solving this business problem? • Understand current systems and areas for improvement 3. Assuming the business problem is large, what specific aspects of this business problem will be addressed?
  • 73.
    Understanding the Participants 1.Who are the business network participants (organizations) involved and what are their roles? • If there is no business network involved, then this is not a good use case 2. Who are the specific people within the organization and what are their job roles? • Understand the key users in a business network.
  • 74.
    Understanding the Participants •Who are the participants? How many types of participants? • How will they access and interact with the blockchain? • Will they be peer nodes? • Do you need web or mobile apps? • Are gateways (such as exchanges or data providers) needed? • Do you need to integrate to external data sources? • Who will operate the blockchain? Who will govern/regulate the blockchain? • What is the value/incentive for each participant to join the network?
  • 75.
    Identities • Do youneed to know your users? • Pseudo-anonymous blockchain like bitcoin does not require user identities to be verified
  • 76.
    Identities • In mostbusiness use-cases, some form of identity is required • In public blockchains, an identity oracle (linked to a trusted database) could provide such information sources • Sources can come from governments, financial institutions or utility providers • In private blockchains, a gateway or controller ensures identity is verified before credentials are issued to the user • Decentralized identity management is also possible – we have seen that – may be the preferred way for a blockchain application
  • 77.
    Understanding the Assetsand Transactions 1. What assets are involved and what is the key information associated with the assets? 2. What are the transactions involved, between whom, and what assets are associated with transactions? • Understand under what business or contractual conditions assets are under, as they transfer from one owner to another.
  • 78.
    Defining Transactions • Whattypes of processes need to take place in your blockchain network? • Invoke actions – add, delete, change, transfer • Query • Do you need to control access to these functions based on participant types or roles?
  • 79.
    Additional Points ofUnderstanding 1. What are the main steps in the current workflow and how are these executed by the business network participants? 2. What is the expected benefit of applying blockchain technology to the business problem for each of the network participants? 3. What legacy systems are involved? What degree of integration with the legacy systems is needed?
  • 80.
    Conclusion • We needto think carefully before applying blockchain directly on a problem • Do we really need to use blockchain? • What are the pros and cons of using blockchain to solve the problem? • Can there be a better technology? • Can we define the entities? • The business network • The participants, assets, and transactions