Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DBFS - ElixirConf EU 2018 (Lightning Talk)

DBFS - ElixirConf EU 2018 (Lightning Talk)

My lightning talk about building a naive blockchain-based file storage in Elixir and React, with scalability and distribution in mind.

Sheharyar Naseer

April 16, 2018
Tweet

More Decks by Sheharyar Naseer

Other Decks in Technology

Transcript

  1. 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 [...]
  2. 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:
  3. BLOCKCHAIN %Block{ type: ..., timestamp: ..., data: %{ file_name: ...,

    file_hash: ..., file_key: ..., }, prev: ..., creator: ..., hash: ..., signature: ... }
  4. FILE STORAGE – Nothing fancy – Directly on the disk

    – Encrypted – Block hash as identifier
  5. 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
  6. CLIENT API – React – Encrypt the file on client-side

    – Form the block – Sign it and calculate hash – Insert it into the blockchain