Table of Contents
LevelDB
Introducing LevelDB
James Halliday introduces and sets up LevelDB, a key-value storage library written at Google that provides an ordered mapping from string keys to string values.Methods and Lexicographically
After James reviews the methods that are available with LevelDB, he notes that LevelDB uses lexicographic sorting, which alphabetical order of string values based on the alphabetical order. JOrganizing Keys
With the LevelDB setup, James demonstrates how to organize keys for different situations such as a simple blog and creates queries against that data.Secondary Indexes
James introduces how to create multiple keys for each post to create a secondary index.Inserting Data
With the database set up, James reviews how to build a system to add new data into LevelDB.Adding and Querying Data
James adds new posts with timestamps to the database. Then James examines different ways to query that data from the LevelDB database.Subleveldown
James introduces Subleveldown, which a library for LevelDB that creates nested sub-databases with unique namespaces;Level-Livefeed
James installs Level-Livefeed package that allows for one to subscribe to a live feed of changes to the database.Designing Modules
To use LevelDB in the browser, James switches from level package to include level-browserify. This change allows the use of the LevelUP code to be portable making it work with node and in the browser.Best Practices
After reviewing the best use cases for LevelDB, James creates a demo application with LevelDB, node, and IndexedDB.Q&A: IndexedDB vs. LocalStorage
James takes questions from the students about IndexedDB and LocalStorage, browser support, and more.
Cryptography
Hashes
James introduces hashes. While encryption is a two-step process used first to encrypt and then decrypt a message, hashing condenses a message into an irreversible fixed-length value or hash.Approaches to Cryptography
James discusses approaches to cryptography including random number generators, symmetric ciphers, and asymmetric crypto. Cipher is a shared algorithm for performing encryption or decryption whereas asymmetric crypto uses public and private keys to encrypt and decrypt data. James also notes that is an important tool with cryptography is picking a robust random number generator. Finally, James warns against creating your encryption process.Sodium and Chloride
James introduces Sodium, a library for encryption, decryption, signatures, and password hashing. Then James demonstrates how to setup Chloride, which is based on Sodium, and generate key pairs.Using Sodium
James discusses how to use Sodium cryptography with or without a signature, using a symmetric cipher, and using public key encryption.Secret-Handshake
James reviews secret-handshake library, which is used to keep both parties unaware of each other with mutually authenticating key agreement handshake. James takes questions from students.merkle DAGs
James reviews merkle DAGs, which is a directed acyclic graph whose objects are linked to each other (usually just by their hash), where the hash(object) includes all hash(linked_object).Working with merkle DAGs
James demonstrates how to use merkle DAGs with node using shasum, which checks for SHA checksums.
Kappa Architecture
Introducing Kappa Architecture
James introduces Kappa Architecture, where an immutable and append-only logs are used as the source of truth. To create these append-only logs, James notes that they are built hashes that are then trivial to replicate with concatenation.Using Hyperlog
James reviews hyperlog, which creates append-only merkle DAG log store. Hyperlog also can link to other documents by cryptographic hash and provides hooks for cryptographic signing and verification. Then James shows how to set up hyperlog.Database Replication and Duplex Streams
James discusses how to synchronous two databases. James takes questions from students.Hyperlog-index
James reviews hyperlog-index, which builds materialized views on top of a hyperlog.Hyperkv and Hyperlog-sodium
James shows hyperkv, which provides a p2p key/value store as a materialized view over a hyperlog. Then James discusses hyperlog-sodium, which more easily configures hyperlog for cryptographic signing.Kappa Architecture Examples
James reviews several examples of kappa architecture: P2P social database; map database built on hyperlog, hyperkv, hyperlog-kdb-index; and P2P file sync over an append-only merkle DAG log.WebRTC Swarm with Hyperlogs
Create a swarm of P2P connections using WebRTC and a signalhub.