Il était une fois en

166  Download (0)

Full text

(1)

Le web décentralisé

(2)

Il était une fois en 2017...

(3)

Censure

(4)
(5)

https://ipfs.io/ipfs/QmT5NvUtoM5nWFfrQdVrFtvGfKFmG7AHE8P34isapyhCxX/wiki/Anasayfa.html

(6)

https://ipfs.io/ipns/QmZxWEBJBVkGDGaKdYPQUXX4KC5TCWbvuR4iYZrTML8XCR/

(7)

Suppression des

données

(8)
(9)

http://www.climatecentral.org/news/trump-delete-climate-change-webpage-21091

(10)

https://www.datarefuge.org/

(11)
(12)

https://datproject.org/explore

(13)

Centralisation

des services

(14)
(15)

Centralisation

du trafic

(16)
(17)

Un point

commun ?

(18)
(19)

Single

point of

failure

(20)

Single

point of

control

(21)

Une solution ?

(22)

Décentralisé

(23)
(24)

https://joinmastodon.org/

(25)

Distribué

(26)
(27)
(28)
(29)

Comment ca marche ?

?

(30)

?

(31)

Bootstraping

Comment on rentre ?

(32)

Node publique

(33)

Pair à pair

(34)

Multicast DNS (ZeroConf, Apple Bonjour)

(35)

Démo

(36)
(37)
(38)

foo.txt ?

(39)

Discovery

Ils sont où mes copains ?

(40)

Retour dans les années

2000...

(41)

foo.txt ?

foo.txt ?

foo.txt ?

foo.txt ?

foo.txt ? foo.txt ?

foo.txt ? foo.txt ?

foo.txt ?

foo.txt ?

foo.txt ?

Query Flooding

(42)

Distributed Hash Table

foo.txt ? foo.txt ?

foo.txt ?

(43)

Distributed Hash Table

DHT ?

(44)

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

Kademlia

(45)

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

GUID sur 4 bits 0 → 15

15 pairs max.

(46)

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

Chaque pair référence 4 autres pairs à une distance

2N, N: 0 → 4

(47)

0

1

2

4 3

6

7 9

10 11

12 13

14

15

5

Si une node est absente du réseau, on prend le GUID

au dessus

(48)

La fonction de distance utilisée est XOR

(simplicité, symétrie et unicité)

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

(49)

qui possède foo.txt ?

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

(50)

qui possède foo.txt ?

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

infohash(foo.txt) = 15

(51)

qui possède foo.txt ? il sait !

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

infohash(foo.txt) = 15

(52)

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

On prend le plus près

(53)

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

(54)

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

(55)

0

1

2

4 3

6

7 8

9 10

11 12

13

14

5 15

(56)

0

1

2

4 3

6

7 8

9 10

11 12

13

14

15

5

Trouvé en O(log N)

(57)

Démo

(58)
(59)
(60)
(61)

var _ = require('lodash')

var DHT = require('bittorrent-dht')

var geoip = require('geoip-lite-country')

(62)

var _ = require('lodash')

var DHT = require('bittorrent-dht')

var geoip = require('geoip-lite-country')

var peers = []

var dht = new DHT()

(63)

var _ = require('lodash')

var DHT = require('bittorrent-dht')

var geoip = require('geoip-lite-country') var peers = []

var dht = new DHT()

dht.on('peer', function (peer, infoHash, from) { var geo = geoip.lookup(peer.host)

peers.push(

peer.host + ':' + peer.port + ':' + geo.country

) })

(64)

var _ = require('lodash')

var DHT = require('bittorrent-dht')

var geoip = require('geoip-lite-country') var peers = []

var dht = new DHT()

dht.on('peer', function (peer, infoHash, from) { var geo = geoip.lookup(peer.host)

peers.push(peer.host + ':' + peer.port + ':' + geo.country) })

setTimeout(function () { dht.destroy()

console.log(_.uniq(peers)) }, 10 * 1000)

(65)

var _ = require('lodash')

var DHT = require('bittorrent-dht')

var geoip = require('geoip-lite-country') var peers = []

var dht = new DHT()

dht.on('peer', function (peer, infoHash, from) { var geo = geoip.lookup(peer.host)

peers.push(peer.host + ':' + peer.port + ':' + geo.country) })

setTimeout(function () { dht.destroy()

console.log(_.uniq(peers)) }, 10 * 1000)

dht.lookup(infoHash)

(66)
(67)

Et la blockchain dans tout ca ?

(68)

tx

tx tx

tx

tx

tx

tx

tx

tx tx

Gossip protocol

Chaque node se connecte à un grand nombre de nodes

(69)
(70)
(71)

?

? ?

?

?

?

? ?

? ?

? ?

?

(72)

Transport

email ? Téléphone ? Courrier ? Pigeon ?

(73)

WEB RTC BLUETOOTH

CHAT ...

HTTP

WEB SOCKET ...

UDP TCP µTP WEB RTC

...

CLIENT SERVEUR

(74)
(75)

?

(76)

A

diff ?

A’

(77)

Content

addressed data

C’est la bonne donnée ?

(78)

Merkle “Tree”

Merkle Directed Acyclic

Graph

(79)

Merkle “Tree”

Merkle Directed Acyclic

Graph

(80)

DATA #1

(81)

DATA #1 HASH #1

(82)

DATA #1 HASH #1 ROOT HASH #1

(83)

DATA #1 HASH #1

DATA #2 HASH #2 ROOT HASH #12

ca a changé !

(84)

DATA #1 HASH #1

DATA #2 HASH #2

ROOT HASH #1234

DATA #3 HASH #3

DATA #4 HASH #4

HASH #12 HASH #34

(85)

#3 ?

(86)

DATA #1 HASH #1

DATA #2 HASH #2

DATA #3 HASH #3

DATA #4 HASH #4

HASH #12 HASH #34

je connais le root hash de source sûre

ROOT HASH #1234

(87)

DATA #1 HASH #1

DATA #2 HASH #2

ROOT HASH #3

DATA #3 HASH #3

DATA #4 HASH #4

HASH #12 HASH #34

voilà la donnée demandée

ROOT HASH #1234

(88)

DATA #1 HASH #1

DATA #2 HASH #2

ROOT HASH #3

DATA #3 HASH #3

DATA #4 HASH #4

HASH #12 HASH #34

ROOT HASH #1234

je vérifie

(89)

DATA #1 HASH #1

DATA #2 HASH #2

ROOT HASH #3

DATA #3 HASH #3

DATA #4 HASH #4

HASH #12 HASH #34

ROOT HASH #1234

je vérifie

(90)

DATA #1 HASH #1

DATA #2 HASH #2

ROOT HASH #3

DATA #3 HASH #3

DATA #4 HASH #4

HASH #12 HASH #34

ROOT HASH #1234

je vérifie

(91)

DATA #1 HASH #1

DATA #2 HASH #2

ROOT HASH #3

DATA #3 HASH #3

DATA #4 HASH #4

HASH #12 HASH #34

ROOT HASH #1234

ok !

(92)

Utilisé ?

(93)

DATA #1 BLOB HASH #1

DATA #2 BLOB HASH #2

COMMIT HASH

DATA #3 BLOB HASH #3

DATA #4 BLOB HASH #4

TREE HASH #12 TREE HASH #34

(94)

TRANSACTION #1 HASH #1

TRANSACTION #2 HASH #2

ROOT HASH

TRANSACTION #3 HASH #3

TRANSACTION #4 HASH #4

HASH #12 HASH #34

PREVIOUS HASH NONCE

BLOCK HEADER

(95)

TRANSACTION #1 HASH #1

TRANSACTION #2 HASH #2

ROOT HASH

TRANSACTION #3 HASH #3

TRANSACTION #4 HASH #4

HASH #12 HASH #34

PREVIOUS HASH NONCE

BLOCK HEADER

(96)

PIECE #1 PIECE HASH #1

PIECE #2 PIECE HASH #2

TORRENT

PIECE #3 PIECE HASH #3

PIECE #4 PIECE HASH #4

(97)

CAT.JPG

/FOO/CAT.JPG HASH

INDEX.HTML

/FOO/INDEX.HTML HASH

/ HASH

PACKAGE.JSON

/BAR/PACKAGE.JSON HASH

APP.JS

/BAR/APP.JS HASH

/FOO/ HASH /BAR/ HASH

(98)

https://ipld.io

(99)
(100)

A A

(101)

A A A’

(102)

A A

A’ A’

(103)

A A

A’

?

A’

(104)

Conflict

resolution

Salt u! ca Comment ca ?va

(105)

Conflict-free Replicated Data Types

CRDT ?

(106)
(107)

Operation based (CmRDT)

COUNTER 1

+1

(108)

Operation based (CmRDT)

COUNTER

+1 2

+1 +1 = 2 +1

(109)

Operation based (CmRDT)

COUNTER

+1 +3 5

+1 +1 + 3 = 5 +1

(110)

Operation based (CmRDT)

COUNTER 1

+1

COUNTER

+1 +3 5

+1 +1 + 3 = 5 +1

(111)

Operation based (CmRDT)

COUNTER

+3 4

+1 +3 = 4 +1

COUNTER

+1 +3 5

+1 +1 + 3 = 5 +1

(112)

Operation based (CmRDT)

COUNTER

+1 +3 5

+1 +1 + 3 = 5 +1

COUNTER

+1

+3 5

+1 +3 +1 = 5 +1

(113)

Operation based (CmRDT)

COUNTER

+1 +3 5

COUNTER

+1

+3 5

Nécessite peu de bande passante

Faible tolérance au réseau (exactly once delivery)

+1 +1 + 3 = 5

+1 +3 +1 = 5 +1

+1

(114)

State based (CvRDT)

COUNTER 1

1

0 1 + 0 = 1

(115)

State based (CvRDT)

COUNTER

2

max(1,2) + max(0,0) = 2

2 0

1 0

(116)

State based (CvRDT)

COUNTER

2

max(1,2,2) + max(0,0,3) = 5

5 0

2 3 1

0

(117)

State based (CvRDT)

COUNTER 1

1 + 0 = 1 1

0

COUNTER

2 5

0

2 3 1

0 max(1,2,2) + max(0,0,3) = 5

(118)

State based (CvRDT)

COUNTER

1 4

max(1,1) + max(0,3) = 4 3

1 0

COUNTER

2 5

0

2 3 1

0 max(1,2,2) + max(0,0,3) = 5

(119)

State based (CvRDT)

COUNTER

2

1 5

max(1,1,2) + max(0,3,3) = 5

3 3

1 0

COUNTER

2 5

0

2 3 1

0 max(1,2,2) + max(0,0,3) = 5

(120)

State based (CvRDT)

Nécessite de la bande passante

Tolérance au réseau (packet loss)

COUNTER

2

1 5

max(1,1,2) + max(0,3,3) = 5

3 3

1 0

COUNTER

2 5

0

2 3 1

0 max(1,2,2) + max(0,0,3) = 5

(121)

Delta state based (δ-CRDT)

COUNTER 1

1

(122)

Delta state based (δ-CRDT)

COUNTER 2

max(1,2) = 2 2

1

(123)

Delta state based (δ-CRDT)

COUNTER

3 5

max(1,2) + max(3) = 5 2

1

(124)

Delta state based (δ-CRDT)

COUNTER 1

1

COUNTER

3 5

max(1,2) + max(3) = 5 2

1

(125)

Delta state based (δ-CRDT)

COUNTER

3 4

1 + 3 = 4 1

COUNTER

3 5

max(1,2) + max(3) = 5 2

1

(126)

Delta state based (δ-CRDT)

COUNTER

3 5

COUNTER

3 5

max(1,2) + max(3) = 5

max(1,2) + max(3) = 5 2

2 1

1

(127)

Delta state based (δ-CRDT)

COUNTER

3 5

COUNTER

3 5

Nécessite peu de bande passante

Tolérance moyenne au réseau (at least once delivery)

max(1,2) + max(3) = 5

max(1,2) + max(3) = 5 2

2 1

1

(128)

Utilisé ?

(129)

Bases de données distribuées

(130)

Mais aussi...

Chat (70M utilisateurs) Distributed Data

News feed

Sync. des localisations favorites

(131)

… et pour notre sujet ?

Libs JavaScript

P2P Chat

Swarm.js Y.js

orbit-db

KVStore Eventlog

Feed Documents

Counters

(132)

Démo

https://acailly.github.io/roti/

(133)

Et si on quittait le monde des bisounours ?

(134)

http://slideplayer.com/slide/9719156/

Sybil attack

(135)

http://slideplayer.com/slide/9719156/

Sybil attack

(136)

Proof of work

(137)

tx

tx tx

tx

tx

tx

tx

tx

tx tx

Eclipse attack

(138)

tx

tx tx

tx

tx

tx

tx

tx

tx tx

Eclipse attack

(139)

tx

tx tx

tx’

tx’

tx

tx

tx tx

Eclipse attack

(140)

Denial Of Service

51% attack ...

Man in the middle

(141)
(142)
(143)

Réseau privé Réseau public Réseau privé

(144)

NAT Traversal

(Network Address Translation )

a.k.a La box internet

(145)

Session Traversal Utilities for NAT

(STUN)

(146)

Adresse IP privée

Adresse IP privée

(147)

Adresse IP privée

Adresse IP privée Serveur STUN

Quelle est mon adresse IP publique ? Suis-je accessible de l’extérieur ?

(148)

Adresse IP privée

Adresse IP privée Serveur STUN

Vous êtes 208.141.55.130:3255 Vous êtes 208.124.56.102:4562

(149)

208.141.55.130:3255

Adresse publique du routeur

Port unique pour chaque device derrière le routeur

(150)

Adresse IP privée

Adresse IP privée Serveur STUN

Vous êtes 208.141.55.130:3255 Derrière un NAT symétrique

Vous êtes 208.124.56.102:4562 Derrière un NAT symétrique

Qui n’accepte que les

connexions entrante s’il y a une connexion sortante sur ce pair

(151)

Traversal Using Relays around NAT

(TURN)

(152)

Adresse IP privée

Adresse IP privée Serveur STUN

Vous êtes 208.141.55.130:3255 Derrière un NAT symétrique

Vous êtes 208.124.56.102:4562 Derrière un NAT symétrique

Serveur TURN

(153)
(154)

Que nous réserve le futur ?

(155)
(156)

Impact écologique ? Arnaques ?

Centralisation ? Scalabilité ?

(157)

https://ipfs.io/

(158)

https://www.coindesk.com/257-million-filecoin-breaks-time-record-ico-funding/

(159)

https://datproject.org/

(160)

https://beakerbrowser.com/

(161)

Mais aussi...

(162)

http://scuttlebot.io/

https://unhosted.org/

https://remotestorage.io/

https://solid.mit.edu/

https://matrix.org/

https://ethereum.org/

(163)

http://dci.mit.edu/decentralizedweb

(164)

Démo

https://louis.center/p2p-social-networking/

(165)

Démo

https://acailly.github.io/roti/

(166)

Figure

Updating...

References

Related subjects :