Part 1: How it Works
1:1 dApp Revolution
Fear not, this is the experience 99% of people exposed to distributed ledger technologies for the first time have. To many, the learning process can be “like solving the plot of a murder mystery”. To help assuage these fears, we will spend this chapter laying out a broad knowledge framework which will serve as the scaffolding to hang the rest of the book on.
Like any process worth learning, we can't do Calculus until we've mastered Arithmetic and Algebra.
The great thing about sharing a collective body of knowledge like mathematics, is that we can do amazing things without understanding how the intricacies work at the lowest levels. Thankfully, some one before us was kind enough to figure out geometry, calculus, even writing itself, then record the information in a way future generations can learn from.
If this book is trying to achieve anything, it is to translate what smart people in the distributed ledger space have figured out from obtuse technical jargon, into as plain English as possible.
As we illustrated in our registrar example from the previous chapter, modern life would not be possible without entities keeping track of transactions, then sharing records with each other. Expanding out, “transactions” can represent anything from votes, to banana imports, to the results of last Thursday’s Knicks’ game.
From this we can deduce that:
“Keeping track of things” is an immensely powerful responsibility.
When "keeping track of things" is concentrated in the hands of opaque record keepers, abuses can occur. (e.g., Enron)
To combat the potential for abuse in systems where fallible individuals can erase or modify records, we have invented elaborate systems of internal and external regulatory oversight throughout the centuries. These systems have evolved from basic common law precedent, all the way to oppressively complex systems like Sarbanes-Oxley and Basel III. While these systems are crucial to maintain trust, they often come at a high cost, and add friction into the system.
Classic economic theory teaches us about the value chain, where products become more valuable as each new input touches the product or service.
The root cause of this success involves specialization and gains from trade when groups are allowed to focus on only what they are best at, then interact with others for everything they are not the best at. The upshot of this is:
Raw bricks are worth more than the clay they are made from.
As they travel from the kiln to the job site they gain more value.
When the bricklayer places the bricks to build a home, the total value of the final product outweighs the value of the individual bricks, wood, and sheet rock.
This core economic process can be broken down into four primary categories of middlemen that separate the buyer from the raw materials that create the home.
Energy Cost: The raw market value of the energy required to create, transport, and place the product into its final form (or in fancy science terms the net amount of local entropy lowered, and global entropy increased). Each step along the way requires communication between suppliers, thus any inefficiencies in this process create excess entropy.
Unneeded material showing up at the job site
Defective drywall leaving the factory because cheaper pyrite was used in place of more expensive gypsum
Risk Cost: Or the profit motive needed to incentivize the development. A developer will not risk the substantial chance of losing money due to construction, market, and other risks without being compensated.
Margins the general contracting company earns for bidding the project correctly and taking on the risk of material costs or other unforeseen variables escalating final costs
Bonus the truck driver receives for delivering on-time despite the risk of weather or other unforeseen events delaying the journey
Transaction Cost: The cost to record transactions throughout the entire process. While this seems paltry in comparison to the skill and effort required in the first two categories, much of the economy is contingent on trusted middlemen to facilitate our transactions.
The official certificate of export at the drywall terminal in Shanghai
Paying said drywall manufacturer in US dollars which need to be converted to Chinese Yuan. (Creating a massive hoard of US dollars in the Chinese central bank)
Value gap: The most fun of the four costs where consumer willingness to pay exceeds the all-in cost of production. E.g. the branded Viking 10 burner cook top, the Nest Thermostat, or even the “good” school district.
Distributed ledgers offer the opportunity to disrupt all four categories of cost by drastically reducing friction, while maximizing trust in the system.
Bottom line risk stops trade. If any player in our complex web of suppliers feels they might not get paid back, or will receive an inferior product, the cost of doing business goes up.
What if "getting paid back" was written into computer code that all parties could trust? In this Brave New World, the cost of business can be greatly reduced as a neutral entity exists where all parties can go to which guarantees the validity of all transactions.
The roots of a "digital" money precede Bitcoin by decades. The existence of email (a system where any two parties on earth can talk to each other with only servers and cables as a third party intermediary) is in essence a digital currency of information. While there is no inherent monetization inherent for the server to process your email request, the protocol has specific rules to ensure your email will only be sent if it is formatted properly.
So what makes Bitcoin different than email?
Try this thought experiment.
Have your friend order you a sandwich.
Pull out your wallet and take a picture of a 10 dollar bill with your phone.
Now email that picture to your friend as payment.
Obviously this would never work.
The 1s and 0s abstracted as a digital picture is not a "real" 10 dollar bill.
This gets to the primary breakthrough Bitcoin brought to the world: digital scarcity, or the notion that a digital artifact is unique, and its authenticity can be guaranteed.
If Alice sends 10 dollars worth of Bitcoin to Bob from her account, she will be debited 10 dollars worth of Bitcoin from the global ledger, and Bob will be credited 10 dollars worth of Bitcoin from the global ledger.
If Alice then tries to send the same 10 dollars worth of Bitcoin to Charlie, the shared ledger will not match has her balance is now -10 dollars, and her transaction will be automatically rejected by the system.
That's it, the entire blockchain revolution explained in one sentence.
In other words:
We all share the ledger of credits and debits collectively (peer-to-peer), rather than trusting an opaque all powerful institution to dole our money out to us little bits at a time.
Right now if you want to send money to Bob using the legacy banking system you.
Write a check/Paypal/ACH to Bob
Middleman Bank 1: Your bank verifies you have the funds, then sends your funds to Bob’s bank on your behalf.
Middleman Bank 2: Bob's bank accepts the payment, then credits his account with the payment
If Bob banks at the same bank as you then only one middleman is needed, however if say you want to send money from Nigeria to Chile. How many middlemen might be involved? What keeps any bank in the complex series of intermediaries from holding your money hostage?
Looking Inside the Black Box
Our current economic system functions as a massive web of interconnected middlemen that receive -> process -> validate -> and store information.
In recent decades, this process has become incredibly efficient with digital databases capable of processing millions of transactions per second. Middlemen record everything from the number of clicks we make on websites, to all driver’s license information at the state motor vehicle office, in an infinitely more efficient way than paper databases of centuries past.
The problem at the core of any centralized system is not how efficiently they process information. Today we live in a world where Google can crunch through millions of search requests per second, while Facebook stores and analyzes nearly as many likes. The problem goes much deeper than servers and bandwidth. Sure we know Google and Facebook are capable of processing vast amounts of information, but how do we know an opaque black box to do what they say they will?
Notice the new fourth component of the receive -> process -> store called "validate".
In our registrar example, the local administrator at the school validates that the teachers properly recorded grades for each student before being placed into the ledger.
The middleman in this example is the administrator that acts as a regulatory backstop to ensure the accuracy of the records. If this role can be outsourced to a distributed ledger, then Alice is free to send her college transcript directly to Bob without needing to rely on anyone in the middle. Put simply, distributed ledgers allow any two peers to transact scarce information directly.
We trust banks, you're solving a problem only libertarians, anarchists, and plutocrats trying to hide their wealth care about.
But what if tokens floating around on distributed ledgers could represent any transaction.. not just A sending to B, but any arbitrarily complex transaction like buying a house, posting to social media, or even submitting a general computation to a global super computer?
Most of us are familiar with what an "application" is.
In the 1980s, the app on your clunky workstation computer might have been VisiCalc, an early spreadsheet program. Now apps are the little boxes on your phone you press to play Angry Birds, or call an Uber.
Let’s take the humble calculator, often the simplest app on any computer, as an analogy for how centralized applications (cApps??) operate differently than decentralized apps (dApps).
Your calculator has a formal system of rules (logic) it uses to help you add/subtract/multiply & divide.
A master copy of the application exists in the app store that developers push updates to when they want to fix a bug or add a new feature (such as square root)
Your phone then communicates with the app store, who pushes the update from their cloud to your device (provided you meet their ever changing terms and conditions)
What your local app store has in common with a bank is of course:
There is a central administrator with a master copy of the calculator code.
You implicitly trust this administrator to safeguard your calculator app from hackers that might infiltrate the app store, and co-opt the calculator to put spyware on your machine. (Eg. the square root button launches an attack to turn on your microphone on and record your conversations)
What if the same fundamentals that ran bitcoin transactions ran an entire network of distributed applications (dApps)?
The calculator app you downloaded from the dApp store was hosted by thousands of interconnected nodes each verifying the integrity of the code.
Malicious changes in the code could be spotted and audited in real time by checking your version against a shared global network of other calculator apps.
No single entity with control of the distribution channel can stop you from downloading the calculator. This doesn’t mean the calculator is free. In fact, it is natively monetized requiring a token to access. No centralized control just means that no one can stop a publisher from creating the dApp, or a user from downloading the dApp.
The upshot of this all is instead of Alice only being able to send a bitcoin to Bob, now Alice and Bob can enter into complex contractual relationships with each other using the same middleman free technology.
Smart Contract: Welcome to dBay
Never has there been more of a misaligned term. To clarify a "smart" + “contract” is simply a piece of computer code deployed to run on a distributed ledger network instead of a single physical or cloud computer.
Smart: because a computer automatically executes the logic if the correct terms are met
Contract: because on the distributed ledger there is no going back on terms. Once executed, there is no reversing, only appending. (Remember read and write but not modify and delete)
Previously, Alice only wanted to send 10 dollars to Bob. But now Alice wants to send 10 dollars to Bob, but ONLY IF Bob mails her his prized Beanie Baby first.
Welcome to decentralized eBay.
On dBay, Alice browses listings until she finds what she wants and clicks “buy now” (the interface frontend can be cloned to look identical to eBay as the only real difference happens on the backend)
By clicking buy she enters into a "smart contract" with Bob. This piece of code transfers 10 dollars from her account into an automated escrow account.
There are many ways a decentralized eBay could function, but in this example Bob also places 10 dollars into the same escrow account to initiate the sale.
Bob then ships the beanie baby to Alice as promised.
When Alice opens the box to examine her prized Beanie Baby, two things could happen:
Alice could accept that the Beanie Baby arrived in the condition promised. Funds are then released, and Bob gets both Alice's 10 Dollars and his 10 dollars in collateral back.
Alice is not happy, the Beanie Baby arrived with missing buttons. Either Bob makes things right with Alice, or Alice detonates the smart contract where both her 10 dollars AND his 10 dollars are destroyed.
Clearly option 2 seems pretty brutal, hence why we have intermediaries like eBay instead of Hammurabi.
What if there was a third option?
Charlie is a professional arbitrator. We'll say Charlie is a person, but Charlie could also easily be pattern recognizing artificial intelligence program running on top of the dBay application.
Bob as the seller of the Beanie Baby, includes Charlie as his designated arbitrator as part of the smart contract listing. Charlie does not charge several percent like a traditional broker, but say .01% or a fixed fee of 25 cents. Whatever the market will bear, as Charlie is just one of many free lance arbitrators.
Alice agrees to choose Charlie as the arbitrator as he is the default in the dBay app, but could choose someone else as long as Bob agrees to it.
Let's run the same scenario again.
Bob sends the Beanie Baby to Alice.
Alice is not happy with the missing buttons.
Alice initiates arbitration with Charlie.
Charlie offers Alice two choices:
1. Return the Beanie Baby to Bob.
2. Accept some compensation for the missing buttons.
IF: Alice elects to return the Beanie Baby, the process then moves to Bob to verify he received the Beanie Baby back in acceptable condition.
ELSE: Charlie arbitrates and decides on the compensation awarded to Alice for the missing buttons, deducting some amount from Bob's collateral and returning him the rest.
Why dBay is Different
Note dBay (decentralized eBay) and the regular eBay both accomplish the same thing: Namely people want to sell things, and also want to be assured they won't get ripped off. The services eBay offers such as insurance and arbitration are merely features that enable the true value add eBay offers the market: trusted exchange of value.
However, on eBay, eBay itself is the ONLY arbitrator as they are a single centralized authority running a single master copy of the database. In effect, this gives eBay monopoly power to set prices within their ecosystem. In a free market, competitors are free to create a competing centralized database with cheaper fees, or better services. In reality, new entrants are at a massive disadvantage due to eBay’s economies of scale and network effects.
Conversely on dBay, no one is in charge, yet everyone is in charge. There is no monopoly on arbitration. Whomever the individual participants in the market want to govern their purchase, are elected to govern their purchase.
Of course, the tyranny of choice and natural pull towards the most competitive will coalesce the market into only a few default "top arbitrators", but the inherent design of the system itself is infinitely more transparent. This transparency will drive the marginal cost of middleman services like arbitration towards 0, as competition is always around the corner if monopolistic practices begin to raise prices.
dBay is just one tiny example of the power of distributed ledgers. Bitcoin truly is the canary in the coal mine. Its' success begets more innovation, which begets more innovation.
However, the raw number of "transactions" or updates the Bitcoin ledger can currently process is severely limiting. To usher in the dApp revolution, we need ledgers that can process unlimited amounts of general computation with electricity usage on par with the value added by automating & disintermediating trust.
In the next chapters, we will formalize how next generation distributed ledgers more efficiently process -> validate -> and store transactions from a technical perspective. This will prepare us for part II of the book we’re we explore the more squishy game theoretic aspects of the space.
Did you notice we made it this far without mentioning "cryptocurrencies" or "blockchains" once?! The language used to describe these new distributed systems can often color the conversation in a negative light before any substantive conversation begins.
As you can see, "cryptocurrencies" are just an extremely simple distributed application. They are no different from our registrar's office and dBay examples, except that the tokens traded between users don't represent anything in the real world like a degree or a beanie baby.
Before we can expand to the entire DLT mental map, we first need to fully explain how Bitcoin (the original creator of the entire ecosystem) is structured. Once we understand the most basic operations of the Bitcoin protocol, we can expand to how other protocols work (some of which don't even use blocks so can't be called blockchains). After that, we are all set to dissect the many layers of architecture and computer science best practice that will allows these systems to scale up to run the backend of the entire world.