ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
MozfestDecentralised
David Dias & Pedro Teixeira
Using IPFS, Y.js a Browser and some JavaScript
Decentralised collaborative
documents
a.k.a. Building Google Docs without
the ¡°Google¡±
MozfestDecentralised
Warning
This is going to envolve some coding.
Probably pairing up!
MozfestDecentralised
Agenda
? Grouping
? Motivation for Decentralising Web Apps
? Goal
? Setup
? Code! (30 mins)
? Discussion: Decentralised Web Apps
? Quick Announcement
MozfestDecentralised
Motivation
Cloud-based software has taken the web a long way,
but lead us into centralisation.
DNS
a.com 30.30.30.30
b.com 40.40.40.40
c.com 50.50.50.50
cvs/svn
cvs/svn
cvs/svn
Building Decentralised Realtime Collaborative Applications - Building Google Docs without Google
Building Decentralised Realtime Collaborative Applications - Building Google Docs without Google
Building Decentralised Realtime Collaborative Applications - Building Google Docs without Google
Building Decentralised Realtime Collaborative Applications - Building Google Docs without Google
Building Decentralised Realtime Collaborative Applications - Building Google Docs without Google
MozfestDecentralised
Goal
Create a
decentralised collaborative web-based real-time
Flipchart application
MozfestDecentralised
Materials
? Modern Browser
? JavaScript
? IPFS (js-ipfs)
? CRDT
? Code Editor
? Command line
MozfestDecentralised
Setup:?
Install Node.js
MozfestDecentralised
Setup:?
Download code
? Through git:
? or download zip ?le from
http://bit.ly/2xsCJfP
MozfestDecentralised
Setup:?
Install dependencies
MozfestDecentralised
Setup:?
Build and watch
MozfestDecentralised
Setup:?
Start HTTP server
MozfestDecentralised
Setup:?
Test ?ipchart app
MozfestDecentralised
MozfestDecentralised
The source
code
Open a code editor and take a peek
at
src/index.js
MozfestDecentralised
Add 1 IPFS
Let¡¯s create an IPFS node
inside the browser app.
MozfestDecentralised
Wait for
IPFS to start
¡­by handling the IPFS
¡°start¡± event.
MozfestDecentralised
Print IPFS status
and IPFS Peer ID
MozfestDecentralised
? Content-addressable storage
? DAG formed by cryptographically
secure links
? Pub-sub network
? Naming (IPNS)
? Multi-transport
? Multi-discovery
? Multi-*
? Community-driven open-source
? Go, JS and more!
? Future-proof
MozfestDecentralised
Of?ine-?rst, real-time,
shared editing for data
structures
MozfestDecentralised
MozfestDecentralised
Add 1 CRDT
Let¡¯s replace direct manipulation of
the line array with an array of lines.
Each line is (still) an array of points.
MozfestDecentralised
Y.js
step 1
Import Y.js dependencies
MozfestDecentralised
Y.js
step 2
Initialise Y.js
MozfestDecentralised
Y.js
step 3
Routine to draw a line
from a Y.js array
MozfestDecentralised
Y.js
step 4
Listen for changes in
drawing and act.
MozfestDecentralised
Y.js
step 5
Draw pre-existing lines
MozfestDecentralised
Y.js
step 6
Create new line on drag
MozfestDecentralised
Y.js
step 7
When user drags,
add points to
current line
MozfestDecentralised
Y.js
step 8
When user clears,
remove all lines
from CRDT
MozfestDecentralised
MozfestDecentralised
Under
the
hood
MozfestDecentralised
Homework
Challenge
? Allow user to take a snapshot
? Save the snapshot to IPFS
MozfestDecentralised
CRDTs
CRDTs will be the building block of
decentralised collaborative
applications.
This type of data structures allows
building con?ict-free of?ine-?rst
reliable decentralised apps.
MozfestDecentralised
Discussion
CRDTs allow you to build a
decentralised collaborative store.
What other building blocks will be
necessary to build DApps?
? Identity
? Authentication
? Access Control
? Privacy
? Files
? non-local Key/Object
store
? Messaging
? ¡­ ?
MozfestDecentralised
PeerPad
PeerPad is a real-time collaborative
editing tool, powered by IPFS and
CRDTs.
https://peerpad.net
MozfestDecentralised

More Related Content

Building Decentralised Realtime Collaborative Applications - Building Google Docs without Google