Università degli Studi di Pisa
Dipartimento di Informatica
P2P Systems and Blockchains
Spring 2020,
Instructor: Laura Ricci
[email protected] Lesson 1: introduction
19/2/2020
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 1
Introduction
THE CLIENT SERVER PARADIGM
●
runs on end-hosts ●
runs on dedicated host
●
on/off behavior ●
always on
●
service consumer ●
service provider
N-1 N
●
issue requests ●
receive requests
●
do not communicate ●
satisfies all client
directly among them requests
●
need to know the ●
need a fixed IP
server IP address (or DNS name)
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 13
Introduction
THE PEER TO PEER PARADIGM
runs on end-hosts
●
on/off behavior, handle churn
●
need to join
●
need to discover other peers
●
service providers and consumers
●
communicate directly among them
●
need to define communication rules
●
prevent free riding
●
incentivate participation ... and
reciprocation
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 14
Introduction
THE PEER TO PEER PARADIGM
Notice that:
●
servers are typically needed for bootstrap
●
but servers aren’t needed for resource sharing
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 15
Introduction
THE PEER TO PEER PARADIGM
●
runs on end-hosts
●
On/off behavior, handle churn
●
Need to join
●
Need to discover other peers
●
Service providers and consumers
●
Communicate directly among them
●
Need to define communication rules
●
Prevent free riding
●
Incentivate participation
and reciprocation
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 16
Introduction
PEER TO PEER: A GENERAL DEFINITION
Definition 1:
A peer to peer system is a set of autonomous entities (peers) able to auto-
organize and sharing a set of distributed resources in a computer network.
The system exploits such resources to give a service in a complete or partial
decentralized way
Shared Resources:
Read Only Information (Files)
Read/Write storage space (Distributed File System)
Computing power
Bandwidth
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 17
Introduction
PEER TO PEER: A GENERAL DEFINITION
Definition 2:
A P2P system is a distributed system defined by a set on nodes interconnected
able to auto-organize and to build different topologies with the goal of sharing
resources like CPU cycles, memory, bandwidth. The system is able to adapt to
a continous churn of the nodes maintaining connectivity and reasonable
performances without a centralized entity (like a server)
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 18
Introduction
RESOURCE SHARING
P2P: is relative to give and receive from a a community. Each peer shares a set
of resources and obtains, in return, a set of resources
the most common scenario:
share musics (audio files) and obtain music, in return (Napster, Gnutella,
Bittorrent, …)
contribute to the maintenance of a blockchain
a peer behaves both like a client and like a server (symmetric functionality =
Servent)
but a peer can decide of offering for free a resource, for instance to participate
to a project
searching extra-terrestrial life
cancer therapies research
contributing to the maintenance of a distributed ledger
the shared resources are at “the border” of Internet, they are directly shared
by the peers, there are no “special purpose nodes” for their management.
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 19
Introduction
RESOURCE SHARING
the peers' connection is transient: the connections and disconnections to the
network are very frequent
the resources offered by the peers are dynamically added and removed
each peer is paired with a different IP address for each connection to the
system
a resource cannot be located by a static IP
new addressing mechanisms have to be defined, at the application level, not
at the IP level
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 20
Introduction
P2P: FILE SHARING AND BEYOND...
P2P file sharing
file sharing: light weight/ best effort
persistence and security are not the main goal
anonymity is important
examples:
Napster
Gnutella, KaZaa
eMule
BitTorrent
P2P Media Streaming
Skype (first versions)
Cyptocurrencies and blockchains
Distributed file System: Internet Planetary File System
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 21
Introduction
FILE SHARING: THE FIRST P2P 'KILLER APPLICATION'
A P2P file sharing application
A user U has a P2P client on its notebook
the connection of the to Internet is intermittent : each time the user
obtains a new IP address for each new connection
the user stores the shared files in a directory and pairs each file with a
set of keys able to identify it (for a song: title, author, publication date,...)
U is interested in finding a song and sends a query to the system
the client finds and shows to the user information about the other
peers which own the required song
U chooses a peer P among these (according some criteria, we will see in
the following)
the file is copied from the notebook of P to that of U
while U is performing the download, other users can upload the parts of
the file already downloaded by U and put in the shared directory
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 22
Introduction
FILE SHARING: THE FIRST P2P 'KILLER APPLICATION'
File Sharing: begins with the rapid success of Napster, at the end of nineties,
about 10 years later than Wide Web
First generation: Napster
introduces a set of servers where the users register the descriptors of the
files they are going to share
only the content transmission (download/upload) exploits a P2P protocol,
content search is centralized
the presence of a centralized directory has been the 'Achille's heel' of this
application
its was convicted because it did not respect the law on the copyright
it could have detected the content exchanged between the users
through the analysis of the centralized directory
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 23
Introduction
FILE SHARING: THE FIRST P2P 'KILLER APPLICATION'
File sharing: second generation
no centralization point
both file search and content transfer are completely distributed
Gnutella, FastTrack/Kazaa, BitTorrent
Side effects of the diffusion of file sharing applications: change of the way users
music is accessed by the
from CD to online music
iTunes
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 24
Introduction
FILE SHARING: THE FIRST P2P 'KILLER APPLICATION'
The P2P client behaves like a servlet and allows:
the user to define a directory, in its file system, where the file it is going to
share are stored. Each other peer of the P2P network may download files from
this directory
a peer behaves like a web server
the user to download files from the shared directory
a peer behaves like a client
the user to find the content it is interested in, through queries submitted to the
system
this functionality is similar to that of Google
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 25
Introduction
FROM FILE SHARING TO BITCOIN
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 26
Introduction
BLOCKCHAIN DEFINITIONS
Definition #1
a shared database stored in multiple copies on computers throughout the
world
maintained without the need for a central authority (e.g. a bank, a
government, Google, etc.)
Definition #2
replicated and consistent, immutable, append-only data storage system
resistant to tampering
Definition #3
a write-only, decentralized, state machine that is maintained by untrusted
actors, secured by economic incentive
cannot delete data
cannot be shut down or censored
supports defined operations agreed upon by participants
participants may not know each other (public)
in actors best interest is to play by the rules
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 27
Introduction
THE BLOCKCHAIN ABSTRACTION: HOW?
Digital signatures (e.g. public-key cryptography)
provide authentication
Cryptographic hash functions (e.g. hash chains of data transactions)
provide tamper-resistant immutability
Replication (e.g. full copies stored everywhere)
provides availability
Distributed consensus amongst mutually trusting or distrusting replica
provides integrity and decentralized control
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 28
Introduction
EVOLUTION OF BLOCKCHAINS
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 31
Introduction
“THE MOTHER OF ALL BLOCKCHAIN”: BITCOIN
Paper published in October 2008: ten years of Bitcoin!
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 32
Introduction
BITCOIN: P2P CRYPTOCURRENCIES
●
written in the first coinbase trasaction by
Satoshi
●
in italian: “Il Cancelliere dello
scacchiere Alistair Darling ipotizza
un secondo salvataggio per le banche”
●
ending the control of banks and
government on your money
●
witness the date of the first transaction
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 33
Introduction
BITCOIN: P2P CRYPTOCURRENCIES
payments directly done between the users, no a centralized financial entity
which guarantees the electronic payment, lower costs
the cypherpunk vision: “we can revolutionize our world by building secure
protocols”
new motivation and tools for learning traditional concepts in computer security
“Blockchain technology,” a related and more general concept
a new technology for developing secure applications in an untrusted
environment
Ethereum and many others
affects many processes, companies and societies
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 34
Introduction
THE BITCOIN BLOCKCHAIN
a distributed ledger of transactions
limited computational functionality
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 35
Introduction
BITCOIN: A COMPLEX ECOSYSTEM
different actors are involved
Miners, Exchangers, Wallets, Mixer,.....
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 36
Introduction
AND LOTS OF OTHER BLOCKCHAINS...
Permissionless
no permission to join
everyone allowed to use
everyone untrusted and potentially malicious
no central authority
Bitcoin, Ethereum,Steem,...
Permissioned
only selected and authenticated users can participate (via consortium or
central authority)
support information sharing and immutability as in permissionless
but also support data privacy as transactions visible only to parties involved
or allowed
Hyperledger,Corda,...
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 39
Introduction
WHY NOT?
A classical question: instead of a blockchain, why you do not use:
Regular databases?
Distributed databases like Cloud Spanner, Amazon Aurora?
Hosted data warehouses like BigQuery, Amazon Athena?
Append-only (ledger) databases? (AWS QLDB)
git repositories?
Internet time machine?
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 40
Introduction
WHEN DO YOU NEED A BLOCKCHAIN?
Do you need a Blockchain? https://eprint.iacr.org/2017/375.pdf
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 41
Introduction
YOU DO NOT NEED A BLOCKCHAIN WHEN....
If all parties are known and trusted, DO NOT use a blockchain
use any number of databases
many proposed uses of blockchains for business applications fall in this
category!
if all parties are known and trusted, but you also need immutability DO NOT
use a blockchain
use databases augmented with cryptographic checksums (e.g. AWS QLDB,
Kafka)
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 42
Introduction
TARGETS FOR BLOCKCHAIN
applications that require shared common, append-only database with limited
capacity
applications with multiple participants with varying degrees of trust amongst
them
applications that must run in a distributed manner
applications that require a complex settlement process with a trusted third
party
applications needing integrity, authentication, and non-repudiation
applications governed by precise rules that do not change and are simple to
encode
applications requiring transparency (as opposed to privacy)
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 43
Introduction
BLOCKCHAIN APPLICATIONS: CURRENCY
Alternative to fiat currencies:
breaks status-quo where:
only government issues money, defines issuing procedures
central authorities (banks) decide which transactions are valid and which
are not
fiat currencies decouple supply from a physical good (i.e. gold)
block-chain typically ties supply to a bounded, virtual good
cryptographic bounded
blockchain records and verifies transfers
blockchain solves the problem of double spending
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 44
Introduction
CURRENCY ASSET TRANSFERS
international bank transfers: real $ transfers
sending money to friend overseas can involve a third bank unless your two
banks have a direct agreement
many hops and long transaction times.
can be solved via distributed ledger in which only banks are writers
(Permissioned Blockchain)
transactions happen only between the bank and the ledger
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 45
Introduction
GENERAL ASSET TRANSFERS
Real estate, fine art, equity, investment funds.
deeds to property put on blockchain to provide public verification
provides a safer way to transact with property owners
buyer can directly check for ownership!
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 46
Introduction
LOANS AND FINANCE
Lending bank, borrower’s bank and the loan applicant see transparent processing
of loans
strong identity and consensus of blockchain reduces fraud
use of blockchain reduces time over traditional processing and issuing a loan.
TwigaFoods and IBM microfinancing
pilot of 220 small food kiosks across Kenya.
220 loans with the average loan around $30 (3,020 KES)
loan duration four and eight days with an interest rate of one and two
percent, respectively.
increased the order size by 30 percent and profits for each retailer, on
average,
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 47
Introduction
PROVENANCE AND SUPPLY CHAIN
auditing to track provenance and chain of custody for materials and products
conflict diamonds (e.g. blood diamonds)
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 48
Introduction
PROVENANCE AND SUPPLY CHAIN: FISHING
restaurants can view and verify chain of custody for fish
sensors attached to fish can log location/temperature/humidity
https://youtu.be/Buw3g8oNG74
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 49
Introduction
BUT...BLOCKCHAIN IS NOT ALL FOR SECURITY
Garbage-in to a Blockchain, garbage-out
https://blog.smartdec.net/you-do-need-blockchain-eight-popular-use-cases-and-
why-they-do-not-work-f2ecc6cc2129
expensive wine bottle emptied of contents and refilled with cheap wine –still
tracked in the supply chain
but events are registered and can be more easily detected.
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 50
Introduction
INTELLECTUAL PROPERTY
Digital content owner hashes content together with their identity and
commits to the blockchain.
if nobody else can prove they published it prior to that commitment, this
is evidence that they own it.
more convenient than a patent office and allows for you to not have to
disclose details of the digital object.
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 51
Introduction
CENSORSHIP RESISTANCE
Bitcoin ransom (2019)
group attempting to get paid to release damaging papers on 9/11 attacks
payment mileposts in BTC determine which documents are released
banned from mainstream social media platforms
messaging via Steemit to prevent censorship. Bunned by Steemit, but track
remains on Steem blockchain
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 52
Introduction
IDENTITY AND REPUTATION MANAGEMENT
Record transactions and reputation ratings to build a web of trust
https://www.zdnet.com/article/fujitsu-develops-blockchain-based-digital-
identity-play/
Dipartimento di Informatica P2P Systems and Blockchains: Laura Ricci
Università degli Studi di Pisa 53
Introduction