Node.js Interactive

87
Stellar Module Management David Dias, Protocol Labs

Transcript of Node.js Interactive

Page 1: Node.js Interactive

Stellar Module Management

David Dias, Protocol Labs

Page 2: Node.js Interactive
Page 3: Node.js Interactive

Stellar Module ManagementPackageRepoTarballContainer

Page 4: Node.js Interactive
Page 5: Node.js Interactive

• Module Management

• npm

• The Web

• IPFS, the InterPlanetary Filesystem

Page 6: Node.js Interactive

• Module Management

• npm

• The Web

• IPFS, the InterPlanetary Filesystem

• 🌠

Page 7: Node.js Interactive
Page 8: Node.js Interactive

Modules Management

Page 9: Node.js Interactive

• What interfaces are available

• Language biased

• Reusable code, library or project all together

Scope

Page 10: Node.js Interactive

• Share it

• Make a webpage for the project

• Register it in a public listing

Discover a module

Page 11: Node.js Interactive

• Use a tool

• Download from a webpage

• Sneaker net

• Email

Transport

Page 12: Node.js Interactive

• How to deal with constant new

• Notify users

• Avoid breaking compatibility

• Cope with demand

• Security patches

Update

Page 13: Node.js Interactive

• How to store these modules

• Storage space and bandwidth concerns

Structure

Page 14: Node.js Interactive

• Check what I’m running

Integrity

Page 15: Node.js Interactive

• Who owns it

• Who is allowed to change it

• Where can it run

• Where can it be accessible

Ownership

Page 16: Node.js Interactive

• Scope • Discovery • Transport • Update

• Activity • Structure • Integrity • Ownership

Page 17: Node.js Interactive
Page 18: Node.js Interactive
Page 19: Node.js Interactive

• Storage is cheap

• Bandwidth is virtually “free”

Page 20: Node.js Interactive
Page 21: Node.js Interactive
Page 22: Node.js Interactive
Page 23: Node.js Interactive
Page 24: Node.js Interactive
Page 25: Node.js Interactive
Page 26: Node.js Interactive

Location Addressing

Page 27: Node.js Interactive

http://10.20.30.40/foo/bar/baz.png

location path

http://example.com/foo/bar/baz.png

Page 28: Node.js Interactive

http://10.20.30.40/foo/bar/baz.png

you

Page 29: Node.js Interactive

http://10.20.30.40/foo/bar/baz.png

10.20.30.40

you

Page 30: Node.js Interactive

http://10.20.30.40/foo/bar/baz.png

10.20.30.40

you

Page 31: Node.js Interactive
Page 32: Node.js Interactive
Page 33: Node.js Interactive
Page 34: Node.js Interactive
Page 35: Node.js Interactive
Page 36: Node.js Interactive

Permanence Security

IoT

Control

Offline

Bandwidth

Disconnected

Page 37: Node.js Interactive

a protocol to upgrade the web

Page 38: Node.js Interactive

PermanentDistributed Safer

SmarterOffline

Faster

Page 39: Node.js Interactive

SFS

web

DHT+

Page 40: Node.js Interactive

web

DHT

SFS

routing

network

exchange

merkledag

naming

applications

The Stack

Page 41: Node.js Interactive

routing

network

exchange

merkledag

naming

applicationsThe Stack

Defining the Data

Moving the Data

Using the Data

IPLD - IP Linked Data

libp2p

IPNS - IP Naming System

Page 42: Node.js Interactive

{name: ‘martian’…

}

{user: ???

}

Page 43: Node.js Interactive

{name: ‘martian’…

}

{user: ???

}

hash( ) -> KQsXSobGtbNhF

Page 44: Node.js Interactive

{name: ‘martian’age: 9001…

}

{user: KQsXSobGtbNhF…

}

hash( ) -> KQsXSobGtbNhF

MERKLE LINK

Page 45: Node.js Interactive
Page 46: Node.js Interactive
Page 47: Node.js Interactive
Page 48: Node.js Interactive
Page 49: Node.js Interactive
Page 50: Node.js Interactive
Page 51: Node.js Interactive

cvs/svn

Page 52: Node.js Interactive

cvs/svn

Page 53: Node.js Interactive

cvs/svn

Page 54: Node.js Interactive
Page 55: Node.js Interactive
Page 56: Node.js Interactive
Page 57: Node.js Interactive
Page 58: Node.js Interactive
Page 59: Node.js Interactive

MerkleDAG

in IPFS data forms a dag

it’s called the merkle dagbecause the links are hashes

Page 60: Node.js Interactive

blob, tree, commit

unix files and dirs

any data structures are represented as dags

blocks, txns, wallets

kv-stores

Page 61: Node.js Interactive

http://10.20.30.40/foo/bar/baz.pnglocation path

http://example.com/foo/bar/baz.png

Page 62: Node.js Interactive

http://10.20.30.40/foo/bar/baz.pnglocation path

http://example.com/foo/bar/baz.png

/ipns/example.com/foo/bar/baz.png

/ipfs/QmW98pJrc6FZ6/foo/bar/baz.pngcontent path

Page 63: Node.js Interactive

10.20.30.40

you

HTTP

http://10.20.30.40/foo/bar/baz.png

/ipfs/QmW98pJrc6FZ6/foo/bar/baz.png

Page 64: Node.js Interactive

http://10.20.30.40/foo/bar/baz.png

10.20.30.40

you

/ipfs/QmW98pJrc6FZ6/foo/bar/baz.png

IPFS

Page 65: Node.js Interactive

/ipns/example.com/foo/bar/baz.png

/ipfs/QmW98pJrc6FZ6/foo/bar/baz.pngcontent path

MUTABILITYIPNS - InterPlanetary Naming System

Page 66: Node.js Interactive

/ipns/QmYJPtosPTfoC/foo/bar/baz.png

/ipfs/QmW98pJrc6FZ6/foo/bar/baz.pngcontent path

/ipns/example.com/foo/bar/baz.png

IPNS - InterPlanetary Naming System

MUTABILITY

Page 67: Node.js Interactive

/ipns/QmYJPtosPTfoC/foo/bar/baz.png

/ipfs/QmW98pJrc6FZ6/foo/bar/baz.png

QmW98pJrc6FZ6

Page 68: Node.js Interactive

/ipns/QmYJPtosPTfoC/foo/bar/baz.png

/ipfs/QmW98pJrc6FZ6/foo/bar/baz.png

QmYJPtosPTfoC

publickey

secretkey

QmW98pJrc6FZ6

Page 69: Node.js Interactive

publickey

QmW98pJrc6FZ6

secretkey

/ipns/QmYJPtosPTfoC/foo/bar/baz.png

/ipfs/QmW98pJrc6FZ6/foo/bar/baz.png

QmYJPtosPTfoC

QmW98pJrc6FZ6

Page 70: Node.js Interactive

publickey

QmW98pJrc6FZ6

secretkey

/ipns/QmYJPtosPTfoC/foo/bar/baz.png

/ipfs/QmW98pJrc6FZ6/foo/bar/baz.png

QmYJPtosPTfoC

signed by QmYJPtosPTfoC

QmW98pJrc6FZ6

Page 71: Node.js Interactive

publickey

QmW98pJrc6FZ6

secretkey

/ipns/QmYJPtosPTfoC/foo/bar/baz.png

/ipfs/QmW98pJrc6FZ6/foo/bar/baz.png

QmYJPtosPTfoC

signed by QmYJPtosPTfoC

QmW98pJrc6FZ6

Page 72: Node.js Interactive

DHT - Distributed Hash Table

Page 73: Node.js Interactive

DHT are the Holy Grail of P2P Networks

Page 74: Node.js Interactive

15

610

50

55

Page 75: Node.js Interactive

1 10 12 20 30 50 54 58 70 88 81 83 88 90 92 95 97 99 101105 300411 500

Page 76: Node.js Interactive

1 10 12 20 30 50 54 58 70 88 81 83 88 90 92 95 97 99 101105 300411 500

Page 77: Node.js Interactive

1 10 12 20 30 50 54 58 70 88 81 83 88 90 92 95 97 99 101105 300411 500

hash( ) = 91

Page 78: Node.js Interactive

1 10 12 20 30 50 54 58 70 88 81 83 88 90 92 95 97 99 101105 300411 500

hash( ) = 91

Page 79: Node.js Interactive

1 10 12 20 30 50 54 58 70 88 81 83 88 90 92 95 97 99 101105 300411 500

Who has fim , which hash( ) = 91?

Page 80: Node.js Interactive

What you get

✓ Discovery (through IPNS)

✓ Integrity (through cryptographic hashing)

✓ Activity (the more downloads, the merrier)

✓ Structure (download things at most once)

✓ Transport (stream from every peer that has the module)

✓ Update (just sync the parts that are changed)

✓ Ownership (private clusters, IPNS records signed,

Page 81: Node.js Interactive
Page 82: Node.js Interactive

registry-mirror

npm i <insert-module-name> –-registry=<IPFS bridge>

Page 83: Node.js Interactive

registry-mirrordemo

Page 84: Node.js Interactive
Page 85: Node.js Interactive

LXJS 2013 - http://yearbook.lxjs.org

Page 86: Node.js Interactive
Page 87: Node.js Interactive

Thank you!David Dias - http://daviddias.me IPFS http://ipfs.io Protocol Labs http://ipn.io