decentralized consensus and the death of the server

42
1 Decentralized Consensus and the Death of the Server

Upload: gordon-hall

Post on 01-Jul-2015

140 views

Category:

Software


0 download

DESCRIPTION

From Connect.JS Atlanta 2014. Trust nobody unless it's everybody. Gordon will be discussing the problems with the centralization of information and leading an interactive demonstration of how to implement a completely decentralized peer-to-peer voting system using Node.js.

TRANSCRIPT

Page 1: Decentralized Consensus and the Death of the Server

1

Decentralized Consensusand the

Death of the Server

Page 2: Decentralized Consensus and the Death of the Server

2

sp0rkyd0rky

gordonwritescode

Page 3: Decentralized Consensus and the Death of the Server

3

The Client-Server Model is Broken

Page 4: Decentralized Consensus and the Death of the Server

4

Popular services become susceptible to targeted attacks

Use of software requires an active network connection

Page 5: Decentralized Consensus and the Death of the Server

5

Your data is stored, handled, and secured by a third party

The remote server is a single point of failure

Page 6: Decentralized Consensus and the Death of the Server

6

Necessitating Trust has Consequences

Page 7: Decentralized Consensus and the Death of the Server

7

You are only as secure as the remote host and there is no means to audit remote software

Experience is controlled by a man behind a curtain

Page 8: Decentralized Consensus and the Death of the Server

8

Using centralized social networking software is the most widely demonstrated

form of a MITM attack.

Page 9: Decentralized Consensus and the Death of the Server

9

(centralization === tyranny)

Page 10: Decentralized Consensus and the Death of the Server

10

Monetization becomes more important than user privacy and freedom

Software products begin manifesting as instruments of power

Page 11: Decentralized Consensus and the Death of the Server

11

●Users are reduced into tools serving the interest

of the software.

Page 12: Decentralized Consensus and the Death of the Server

12

Which, in turn, serves the interests of the

developer.

Page 13: Decentralized Consensus and the Death of the Server

13

while(true) { resist() }

Page 14: Decentralized Consensus and the Death of the Server

14

To say that anarchists subscribe to anarchism is like saying that pianists subscribe to pianism

Page 15: Decentralized Consensus and the Death of the Server

15

Anarchy is simply cooperative self-determination – it is part of everyday life.

Page 16: Decentralized Consensus and the Death of the Server

16

It is a mode of being, a manner of responding to conditions and relating to others, a class of human behavior.

Page 17: Decentralized Consensus and the Death of the Server

17

Peer-to-peer networking undermines the necessity of authority.

Decentralized systems empower users to compute freely.

Page 18: Decentralized Consensus and the Death of the Server

18

Trust is not vital to the operation of decentralized systems.

Cryptography replaces the need for trust with math.

Page 19: Decentralized Consensus and the Death of the Server

19

Really, really hard math.

Page 20: Decentralized Consensus and the Death of the Server

20

This enables you to restrict who can access information that belongs to you.

And can verify the authenticity of information shared with you.

Page 21: Decentralized Consensus and the Death of the Server

21

Decentralizedor

Distributed(or the difference between agnostic and atheist)

Page 22: Decentralized Consensus and the Death of the Server

22

Page 23: Decentralized Consensus and the Death of the Server

23

Page 24: Decentralized Consensus and the Death of the Server

24

The difference lies in trading some trust for some performance.

Page 25: Decentralized Consensus and the Death of the Server

25

if (centralized > decentralized) process.exit(1);

Page 26: Decentralized Consensus and the Death of the Server

26

Centralized application design is popular because it is easy to control.

Peer-to-peer problems are more difficult to solve.

Page 27: Decentralized Consensus and the Death of the Server

27

Software should improve life by enabling users to solve problems they have in common, collectively.

Why do you write software?

Page 28: Decentralized Consensus and the Death of the Server

28

Building Decentralized Consensus with Node.js

Page 29: Decentralized Consensus and the Death of the Server

29

Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications.

Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

Page 30: Decentralized Consensus and the Death of the Server

30

I mean, duh.

Page 31: Decentralized Consensus and the Death of the Server

31

SmokeSignal is P2P networking in a box.

Tiny is an in-process key/value store.

Page 32: Decentralized Consensus and the Death of the Server

32

The protocol defines how peers communicate.

Defining this is more than half of your application design.

Page 33: Decentralized Consensus and the Death of the Server

33

{ message: JSON({ id: String(base64(sha1(pubkey)), key: String, value: Mixed, time: Date }), pubkey: String, signature: String(privkey.sign(message))}

Page 34: Decentralized Consensus and the Death of the Server

34

The public key and signature allow peers to verify the authenticity and origin of the message.

The timestamp prevents old messages from taking precedence.

Page 35: Decentralized Consensus and the Death of the Server

35

The message ID lets peers store the record under a namespace that is unique to the message author.

Key/value pairs are unique per identity.

Page 36: Decentralized Consensus and the Death of the Server

36

Consensus can be defined as the aggregate of values for a given key.

This resembles a vote for a arbitrary topic.

Page 37: Decentralized Consensus and the Death of the Server

37

When peers connect, they stream their record of history from each other.

This is used to synchronize the consensus.

Page 38: Decentralized Consensus and the Death of the Server

38

All peers have the same record of history.

Trusting nobody unless it's everybody.

Page 39: Decentralized Consensus and the Death of the Server

39

Streams are your best friend.

They are indispensable for both performance of nodes and maintainability of software.

Page 40: Decentralized Consensus and the Death of the Server

40

var parser = new MsgParser();var handler = new MsgHandler();

node.pipe(parser).pipe(handler);

Page 41: Decentralized Consensus and the Death of the Server

41

npm install -g dside

Page 42: Decentralized Consensus and the Death of the Server

42

(decentralization === liberty)