Slide 1

Slide 1 text

BLOCKCHAIN BASED FILE STORAGE

Slide 2

Slide 2 text

SHEHARYAR NASEER sheharyarn shyr.io

Slide 3

Slide 3 text

DIDN'T HODL

Slide 4

Slide 4 text

blockchain noun /ˈbläkˌCHān/ A decentralized, distributed digital ledger that is used to record transactions across many computers so that the record cannot be altered retroactively without the alteration of all subsequent blocks [...]

Slide 5

Slide 5 text

BLOCK 5 Data: Timestamp: Previous: Current: 34k0scf 2018-01-05 13:24:56 3662c6f8dc7b519123c f9d644657c3d7c80a6f rth760ls 2018-01-07 18:43:12 f9d644657c3d7c80a6f bbd658cb57bb0d2138 BLOCK 6 Data: Timestamp: Previous: Current: qnb49f0 2018-01-08 06:11:34 bbd658cb57bb0d2138 8327ed293f7834c6572 BLOCK 7 Data: Timestamp: Previous: Current:

Slide 6

Slide 6 text

ARCHITECTURE – Blockchain Structure – File Storage – Cryptography – Synchronization – Client API

Slide 7

Slide 7 text

BLOCKCHAIN %Block{ type: ..., timestamp: ..., data: %{ file_name: ..., file_hash: ..., file_key: ..., }, prev: ..., creator: ..., hash: ..., signature: ... }

Slide 8

Slide 8 text

FILE STORAGE – Nothing fancy – Directly on the disk – Encrypted – Block hash as identifier

Slide 9

Slide 9 text

CRYPTOGRAPHY – Public Key: RSA – Symmetric: AES

Slide 10

Slide 10 text

CRYPTOGRAPHY – Public Key: RSA – Symmetric: AES – Hashing: SHA256 – Encoding: Base64

Slide 11

Slide 11 text

SYNCHRONIZATION – Erlang VM: Easy Distribution – Consensus: Raft – Elect 'leader' – Use it as a reference

Slide 12

Slide 12 text

SYNCHRONIZATION – Find where the chain diverges – Send the succeeding block def sync_next(leader, hash) do %{block: block, file: file} = :rpc.call(leader, Blockchain, :next, [hash]) Blockchain.insert(block, file) end

Slide 13

Slide 13 text

CLIENT API – Phoenix – List, Upload, Download – Ecto Validations – Status Channel

Slide 14

Slide 14 text

CLIENT API – React – Encrypt the file on client-side – Form the block – Sign it and calculate hash – Insert it into the blockchain

Slide 15

Slide 15 text

DEMO

Slide 16

Slide 16 text

OUTRO Elixir App: to.shyr.io/dbfs React App: to.shyr.io/dbfs-web shyr.io [email protected] sheharyarn