L2 History

Historical Context of Ledger Technology

Anyone who’s worked retail is familiar with the end-of-day routine – reconcile the tally of today’s transactions with what’s in the cash register. Unlike simple merchant businesses, however, banks aren’t able to just “check the vault” to see where they stand. Most of a bank’s assets and liabilities are all on paper[1]. Deposits are essentially loans to the bank. Loans given out are spent and re-deposited, allowing even more loans to be given out with the loaned money! A bank essentially is its ledger.

Spreadsheets

  • Ancient technology
  • Simple
  • Relies on a trusted, secure environment and scribe
  • Limited to a single, centralized “canonical” location
  • Errors can accumulate and propagate unless manually fixed
  • Transactions can be reordered and erased (see Appendix 1: Transaction Reordering)
  • Can be made auditable by keeping an auxiliary journal that is able to reconstruct the ledger step-by step, but you in turn have to trust the journal keeper’s honesty

Databases

  • 20th century technology
  • Data is automatically kept internally consistent with an enforced schema
  • Data is automatically kept externally consistent with enforced transaction atomicity (“all-or-nothing” edits of multiple fields at once)
  • Journaling and backups are also automatic with a digital log and other redundancies
  • Can be allowed to be externally accessed and edited with built-in user privileges
  • Still relies on a trusted environment on the core server
  • Auditability still replies on a log held by a fully trusted and independent party[2]
  • Transactions can still be reordered by the database administrator
  • Fast and scalable

 

Chaining

Using a hash function (see Appendix 2) it’s possible to prevent some types of transaction reordering.

Each new transaction in a ledger is given a hash made from the current and the previous transaction. This forms an unbreakable chain of hashes.

Changing a transaction will thus change its own hash and all the hashes of the transactions that came after it. If they have already been logged, it’s impossible to go back and change the ledger without going back and changing the log too![3] This idea has been around for a long time.[4] [5]

P2P

Formed in 1980, Usenet is an early example of a messaging network using a distributed database. Users post articles (i.e. messages) to newsgroups (i.e. forums). Anyone can run a Usenet server that automatically downloads, stores, and rebroadcasts messages within a certain retention period of time. Messages are stored in sequential order.

 

Usenet depends mostly on cooperative behaviour and human moderators. It’s now swamped by spam and pirated files[6], though many newsgroups still thrive.

 

Although nothing financial ran on Usenet, its pioneering idea of widely replicating data on a truly decentralized P2P network was a sign of things to come.

 

[1] The United States uses fractional-reserve banking, where a bank must keep a small % of each deposit in the vault without lending it back out. Canada and almost all other countries have no such restrictions. Some economists, such as those of the Austrian School, view anything less than 100% reserves as tantamount to a pyramid-scheme that inevitably leads to a financial crises when the bubble pops. Satoshi viewed Bitcoin as partly an experimental, fully-reserved, fully-backed bank.

https://wiki.mises.org/wiki/Full_reserve_banking

[2] Signed bank statements could be seen as a sort of legally accountable distributed log. (Maybe that’s why they don’t like giving them out anymore?)

[3] For a metaphysical treatment of errors in committed transaction chains, see https://www.youtube.com/watch?v=gGAiW5dOnKo

[4] S. Haber, How to Time-Stamp a Digital Document, 1990.

[5] Also see https://en.wikipedia.org/wiki/Linked_timestamping and uses in rsync/zsync.

[6] It’s prohibitively expensive to run a full Usenet server these days. https://gizmodo.com/5343260/how-to-kick-your-torrent-addiction-with-usenet

Appendix 2: Hash Functions

 

Cryptography deals with encrypting and decrypting messages. A "message" is an entire exact string of bytes (e.g. text) such as "Leroy Jenkins" or "[email protected]" or "2187.01" or even a complete computer file.

 

For any given message you feed it, a hash function spits out a short, uniquely identifying number called a hash[1]. Hashes are useful for things like confirming that copied data is error-free. Cryptographic functions are slow, cumbersome, and only work on small pieces of data like hashes instead of the full messages themselves.

 

A simple hash function could just add up the letters, say "acd" = 1 + 3 + 4 = 8. Of course, this hash would be pretty big for long messages! Hash functions limit the size of these numbers by "wrapping around" at a huge limit, such as 2256, and call it a day.

 

Hashing is pretty much irreversible. Given only the above hash of 8, you can't tell if the original message was "acd" or "bbd" or "dd". Real-world hash functions don't just add letters, they use really convoluted algorithms so that they make unique hashes. These two properties underpin digital unforgeability.

SHA 256

  • Today's most popular secure hash algorithm
  • Accepts any size of message
  • Makes unique, 256 bit hashes (i.e. between the numbers 0 and 2256)
  • Researchers haven't found any collisions (two messages with the same SHA 256 hash)
  • Examples:
    • SHA256("Leroy Jenkins") = 71b2755d3c30205505463e162295a6e06cb68f5b156b3ef7e1d203a7d4bbf280
    • SHA256("Leroy Jenkins.") = d7581807ad5f88d0ac9356765cd91dfae501143658addc87c3d5006e6a22bcf9
  • Try it out:

[1] Other, more descriptive names for a hash is a digest or a fingerprint.