by Achal Srinivasan and Yorke Rhodes IV

Consensus & Industry

Blockchain Beyond Bitcoin | Lecture 4

Yorke Rhodes IV
Rice Blockchain
Published in
20 min readFeb 4, 2019

--

Recap

Welcome! If you’re a returning reader, thank you for keeping up with our series, Blockchain Beyond Bitcoin! If you are a new reader, we’d like to provide you with a TL;DR from the previous lecture. In How Bitcoin Works, we took a deep dive on the Bitcoin protocol.

We discussed how Bitcoin solves the double spending problem typically associated with digital currencies where data is easily duplicated. This is accomplished through a clever combination of digital signatures and mining. Digital signatures enforce that only a private key holder can spend funds of the corresponding public key on the ledger; each transaction on the ledger is attached with a unique identifier called a nonce which prevents simple forgery of previous transactions. Processing power used to validate transactions (in a block) based on the principle of preventing debt is sourced by introducing financial incentives: this is Bitcoin’s mining scheme in essence. Everyone in the network maintains their own copy of the ledger, and updates based on broadcast messages. The Bitcoin network is able to arrive at consensus on the contents of the ledger because everyone agrees to trust the ledger with the most computational work (proof of work). This means fraudulent transactions and conflicting ledgers are expensive to achieve from a computing resource perspective.

These discussions justified the soundness of the Bitcoin protocol from a programmable trust perspective. Although we talked at length about the protocol, we did some hand waving with respect to the network, and how “broadcasting transactions” really works. Recall that Bitcoin is a network maintaining a distributed ledger. Network users participate with the intent of making payments securely and anonymously. Network miners participate as users but also seek to tap into the potential of available financial rewards. There are many problems associated with a network of this scale, especially when they need to coordinate behavior and communicate effectively in real-time.

Types of Network Architecture

  • Centralized: one central authority or server through which all other nodes act like clients who accept messages and act accordingly
  • Decentralized: multiple servers who receive messages from each other, and communicate to local nodes which are connected to them
  • Distributed: no central authority where each node is connected to every other node and has the exact same authority

A fundamental problem in distributed computing is to achieve system reliability in the presence of a number of faulty processes: this is consensus which is fault-tolerant. As the network becomes less centralized, there are fewer nodes which can cause critical failure.

Byzantine Generals Problem

The BGP is a problem faced by any distributed computer network, like Bitcoin. The problem definition is derived from a historical story about the Byzantine empire. A Byzantine army is surrounding a city and must decide collectively to attack or defend and at what time. Some of the lieutenants and/or general are treacherous and may attempt to mislead others about the plan. A commanding general must send an order to his lieutenant generals such that

  1. all loyal lieutenants obey the same order
  2. if the general is loyal, then every loyal lieutenant obeys his order
  3. if the general is a traitor, the lieutenants must still reach consensus

It turns out that the group can reach consensus as long as >2/3 of actors are honest. If the traitors exceed 1/3, consensus cannot be reached. The algorithm to reach consensus in this case is based on the value of majority of the decisions a lieutenant observes.

Below is an example where the commanding general is loyal and the loyal lieutenants can reach consensus despite the presence of a <1/3 traitorous proportion.

Another example is provided below where the commanding general is traitorous, but the lieutenants still reach consensus because they all take act based on the value of majority(x, y, z).

Byzantine Fault Tolerance

BFT is a characteristic which defines a system that tolerates the class of failures that belong to the Byzantine Generals’ Problem. Byzantine Faults are the most severe and difficult to deal with because very few assumptions are made about the kind of behavior a node can have. This type of fault tolerance has been needed in airplane engine systems, nuclear power plants and many other systems whose actions depend on the results of a large amount of sensors with potential faults. Blockchains are essentially distributed ledgers; due to the immense value stored in these ledgers, bad actors have huge economic incentives to try and cause faults. Therefore, it should be very unlikely that this class of faults can cause critical failure.

Blockchain Network BFT

When analyzing the possibility of faults in blockchain networks, a few assumptions must be made.

  1. Miners are altruistic := true to the code no matter what comes or economically egoistic := maximize personal profits.
  2. Purely destructive miners are a minority because it would not serve them a purpose.
  3. Network lag is negligible; it is assumed that no node will ever fall behind the chain, it will have received a block before the next one is mined

Under these circumstances, the BGP can be solved because all nodes agree on a common truth. Sometimes, though, these assumptions are not necessarily true. There might exist an economic incentive for miners to behave destructively and perform a 51% attack. Governments, big companies, or investors who shorted a given cryptocurrency might benefit from destroying it. Network lag is plausible. Shorter block times imply a higher probability of two blocks being mined at the same time, forking the chain. The confidence that consensus is reached grows with every block appended to the chain, but theoretically never reaches 100%.

Consensus Algorithm Options

Blockchain networks like Bitcoin use consensus algorithms to elect a leader who will decide the contents of the next block. Different consensus algorithms impact…

  1. the security of the protocol
  2. the economic framework of the protocol

Creating consensus algorithms involves the study of mechanism design. Mechanism design is an entire sub-discipline of economics which can be thought of as the inverse of game theory. Game theory takes a game as a given and analyzes the outcomes according to players’ utilities. Mechanism design starts with defining socially desirable outcomes and works backwards to create a game that incentivizes players towards outcomes.

Bitcoin’s consensus algorithm and solution to the Byzantine Generals Problem is the probabilistic solution called Proof of Work which we saw in detail last week. This algorithm is the reason why it is very unlikely that a critical failure will occur on the Bitcoin network.

Proof of Work

In PoW, in order for an actor to be elected as a leader and create the next block, they have to find a solution to the hash-puzzle. Importantly, it is hard to find a solution for that given problem. When given a solution to that problem, it is easy to verify that it is correct without repeating the same work. Due to the limited supply of computational power, miners are also incentivized not to cheat due to high costs and potential missed profits. If Bob has more computational power and energy than Alice, and thus can output more work, he is more likely to find a solution and mine the next block.

Advantages

  • scalable: from a security perspective, the hash-puzzle system can easily accommodate more users
  • proven: well-understood and widely implemented

Disadvantages

  • energy consumption: environmental impact and availability/accessibility restricted by geography
  • vulnerability: 51% attack group can collude to manipulate the blockchain to their advantage
  • latency: block time needs to be sufficiently large to guarantee that work is prioritized over low latency of broadcast

Proof of Stake

In PoS, instead of miners with fancy and costly computer equipment racing to mine blocks, a validator stakes cryptocurrency as a signal of candidacy in the election. Their stake is the amount of currency that they are willing to lock up for a fixed duration, risking liquidity. Validators receive a chance proportional to their stake. If Bob has more staked than Alice, he is more likely to be elected and decide the next block. Importantly, Proof of Stake relies on penalties instead of rewards for security, in contrast to Proof of Work. The one-sentence philosophy of proof of stake is thus not “security comes from burning energy” but rather “security comes from putting up economic value-at-loss.”

Advantages

  • speed: Provides faster processing of transactions (no lower bound on block times from hash-puzzle)
  • efficiency: Consumes less energy
  • access: doesn’t limit potential profits to domain experts with supercomputers

Disadvantages

  • vulnerability: someone can manipulate the network by investing only money, as opposed to PoW where they need to invest money, time, expertise, hardware, electricity
  • rich get richer: only the richest stakeholders are likely to be selected for consensus

Delegated Proof of Stake

In DPoS, users use their balance to elect delegates, who in turn have the opportunity to stake blocks of new transactions similar to traditional Proof of Stake. A user’s voting power is determined by wealth, proportional to their balance. Delegated Proof-of-Stake and traditional Proof-of-Stake are very different, and the difference can be compared to the difference between direct democracy and representative democracy. In regular PoS, accounts with non-insignificant balances can stake. This means they can participate in the process of validating transactions and forming the distributed consensus, earning profits in return. In a DPoS system, accounts with non-insignificant balances can vote, but are not necessarily rewarded for voting. These users are rewarded by whatever scheme their delegate implements.

Advantages

  • reward distribution: users will elect those delegates who give them the most rewards, so casual users — not just the rich — can earn rewards
  • real-time security: malicious actions by a delegate can be immediately detected by voters and they can be ousted

Disadvantages

  • cartels: delegates can easily organize into cartels
  • vulnerability: fewer users in charge of keeping the network alive means less surface area for attackers to target
  • centralization: power is again concentrated in the hands of few

The Bitcoin Ecosystem

Let’s begin with the problem of accepting and sending Bitcoin. To do this, it is necessary to have a bitcoin wallet. A wallet is a combination of a public and private key; the public key allows you to receive funds at a known address, and a private key allows you to sign transactions from your wallet.

A private key can be generated using a cryptographic library from the terminal of your operating system. Since private keys are 32 byte values, there are ²²⁵⁶ possible values, which is an astronomical amount — there is essentially no chance that your randomly generated private key will be found or generated by someone else.

It is then possible to derive a public key from this private key using a deterministic function known as an elliptic curve equation, which will map the generated public key to the private key. Many wallets implement compressed public keys, which are half as big as uncompressed keys.

The address is a hash of the public key; this protects the public key from being revealed until you spend the money. Some mention that it’s important not to reuse addresses, since a possible vulnerability in the elliptic curves implemented in the hashing functions means a hacker could find your private key from the public key (though, this is incredibly unlikely). Therefore, they recommend transferring your funds to a new wallet after an outgoing transaction has been made.

If the signature is valid and the public key’s hash matches the output transaction, then the transaction is valid, the money can be spent, and the transaction made from the wallet is broadcast to the rest of the network.

There are many different types of wallets, each which grant you a certain level of security and control over your funds. We can categorize them into two categories: “user-controlled” and “custodial”. The former form of wallet grants the user autonomy over their private key, while the latter attempts to abstract away the private key for convenience or utility’s sake, signing transactions on behalf of the user.

Paper wallets. A physical document containing your private and public key, while incredibly low-tech, is completely immune to hacks as the key is not stored digitally. Though, it can be easily lost if not careful.

Physical bitcoin. The physical coin is usually pre-loaded with some amount of bitcoin, and it cannot be spent unless a tamper-evident seal is broken revealing the private key. In some currencies, distributing these coins is considered money transmission, and requires a license or is subject to seizure.

Mobile wallet. This is the most convenient and accessible type of wallet, since the private keys are stored on the device, and payments can be made on-the-go using cellular service.

  • Mobile wallets use SPV (simplified payment verification) to work with small subsets of the blockchain, so that they do not need to contain the entire Bitcoin blockchain (growing rapidly in size).
  • They also usually rely on some trusted nodes on the Bitcoin network to ensure that their history of transactions is valid.
  • These wallets are somewhat prone to hacks and theft; if someone gains access to your mobile device and is able to surpass biometric authentication (fingerprint, facial detection, etc.), they can spend your funds. Though, advanced wallets secure your private key on a secure enclave that is very difficult to decrypt.
  • This is likely how the majority of users will spend and receive cryptocurrencies in the future; there are over 3 billion iOS and Android users worldwide, and these platforms have allowed Bitcoin wallets onto their respective app stores.

Web wallet. With an internet-enabled wallet, where interactions with the wallet take place through the browser, private keys are usually stored on the server of the application developer or service provider.

  • These wallets have varying functionality, for instance allowing you to access funds from devices across different platforms.
  • These also allow access on-the-go, but sacrifice privacy since your private keys are not held locally.
  • Web wallets are especially common in the context of exchanges — they usually come in the form of hot wallets, which enable instant access to spend and receive Bitcoin, but are meant to be ephemeral (temporary) since the private keys are stored server-side. We’ll touch on exchanges in a bit.

Desktop wallet. These wallets come in the form of applications which are downloaded and installed to your computer, and use your computer’s local storage to maintain private keys. These wallets store private keys locally, and therefore are safer than web and mobile wallets, but are still internet-connected. This is currently one of the most popular forms of wallets in the Bitcoin community, since they are very easy to setup and use. Though, they sacrifice convenience, since they do not enable on-the-go access to your funds.

Hardware wallet. These are the safest and most trusted option for securing private keys locally. They require explicit user actions, and can be plugged into any laptop or desktop to send, receive, and store Bitcoin. Wallets like the Trezor or Ledger Nano S are some of the best personal “cold storage” options for consumers, significantly minimizing the risk of theft. Though, they are somewhat expensive (>$50) and can be lost.

Companies such as Overstock, Microsoft, Reddit, Expedia, and more now accept Bitcoin as a valid form of payment, helping to drive the utility of the technology. Other efforts like Coinbase Commerce enable small businesses to begin accepting cryptocurrencies with a Stripe-like merchant experience.

Due to a lack of KYC (know-your-customer) with the anonymous nature of transactions using decentralized cryptocurrencies, it is hard for merchants to discern who they are doing business with, which poses a legal barrier to adoption of cryptocurrencies.

Generally speaking, due to the present volatility of Bitcoin (and other cryptocurrencies) as well as shifting regulations and slow block times, Bitcoin is currently unpopular as a method of payment in retail establishments.

We spoke last class about the technical underpinnings of mining, and the role it plays in establishing both programmatic monetary policy and establishes trust on the Bitcoin network. The role of mining in Bitcoin to issue new coins in exchange for computational power that is require to secure and broadcast transactions across the network.

Mining helps to achieve consensus, which is the agreement on the set of transactions that is considered valid across bitcoin nodes (recall that it is necessary to have a history of all past transactions in order to participate in the network, since the ledger history defines “ownership” of Bitcoin).

Since the amount of computational power needed to mine a block on the network increases over time as the issuance schedule of coins slows over time, mining cryptocurrencies from a desktop computer is no longer viable. This has a significant impact on power consumption and effectiveness.

Thus, special chips called ASIC’s (application-specific integrated circuits) have been designed to solve the type of hash functions implemented in cryptocurrency mining. This hardware is designed to be more effective than the average computer’s GPU, and therefore has a higher likelihood of successfully and quickly mining a block.

The first industry that has formed is around Bitcoin miners: hardware solutions that enable a competitive advantage in the mining process due to increased computational abilities and performance. The equipment offered by suppliers such as Bitmain gets progressively more capable over time in response to both competition and the increased complexity of mining the currency; this breeds an arms race, since more performant technology is correlated with a competitive advantage in mining.

Since mining is fundamentally a puzzle with increasing complexity, the likelihood of solving the puzzle increases if you have more miners, and thus more computational power, at your disposal. Thus, another industry that has formed is around mining operations: large-scale operations, sometimes state-sponsored, which amass extraordinary amounts of computational power using server farms.

The producers of mining hardware often also run mining operations. For instance, Bitmain runs one of the largest mining operations in the world. Since mining operations are almost always for-profit entities, users of the Bitcoin network who want to subvert private corporations but amass computational power to compete with operations have joined mining pools. These groups share the rewards more evenly while increasing the probability that they see rewards for computational power spent.

By design, the proof-of-work consensus model implemented in Bitcoin is physically resource-intensive. Thus, mining has significant negative externalities on the environment due to the power consumption of the computers attempting to solve an increasingly difficult hash puzzle. As of late 2017, Bitcoin mining was responsible for more power expenditure than over 20 European countries combined. Countries like China have been sponsoring discounted electricity in order to sponsor mining operations; since hash power is considered an invaluable resource given that Bitcoin is here to stay, it is in the interest of national governments to incentivize mining. More notably, it is said that China is home to over two-thirds of all mining.

In order to buy or sell Bitcoin, a user will likely have to interact with an exchange. An exchange is a digital marketplace where fiat currencies can be exchanged into cryptocurrencies; it acts as an intermediary between the buyers and sellers of cryptocurrencies, allowing buyers to convert to crypto, and sellers to convert to fiat (and thus exit their position).

While we won’t dive into the specifics of how trading on crypto exchanges works, they are one of the most crucial components of the ecosystem since without a fiat on-ramp, many users would be unable to access or start using Bitcoin.

Since exchanges are essentially matching buy- and sell-orders, they are able to make money in both bear (trending down) and bull (trending up) markets. Thus, exchanges can be incredibly profitable enterprises, especially when there exists large transaction volume, since orders usually involve some sort of transaction fee.

Exchanges use hot wallets; these are ephemeral wallets meant to be used for a handful of transactions on exchanges, before the funds are moved into a more secure storage option (like a hardware wallet).

Though, many users keep their funds stored on exchanges for convenience. This proves to be a massive opportunity for hackers; given that the private keys to these hot wallets are usually stored on servers owned by the exchange, and not provided by the user, exchanges must be highly cautious of security vulnerabilities.

For instance, over 1.35M BTC was stolen from the Mt. Gox exchange by hackers, which equates to over $7B USD lost. This is a captivating story worth reading about. Moreover, less legitimate exchanges have run away with users’ funds in the past, setting a poor precedent for trust and safety of accessing Bitcoin in countries where more reliable exchanges like Coinbase are not yet available.

There are fundamentally two types of exchanges; centralized exchanges, which are for-profit, private companies which match buy & sell orders and collect a transaction fee in order for providing a convenient and secure trading process, and decentralized exchanges, which operates without a centralized authority (peer-to-peer).

Centralized exchanges, while reliable and providing some of the best user experiences for the average Bitcoin user to buy and sell crypto, are seen as “re-centralizing” cryptocurrencies. Exchanges with large pools of funds can simply reallocate funds instead of submitting transactions to the blockchain, and many hold private keys for their users while encouraging them to use their hot wallets as their primary mode of storage. Thus, the user has less control over their funds, defeating the purpose of a self-sovereign currency, and exchanges begin to assume the role of traditional banks.

Centralized exchanges serve as the entry and exit points to interacting with a blockchain and charge fees for access, which is antithetical to the libertarian vision of cryptocurrency enthusiasts.

Decentralized exchanges reduce the risk of hacking since users do not transfer assets to the exchange. Though, they a lackKYC (know-your-customer) process, and therefore cannot insure any loss of funds. Moreover, they are harder to use and generally more expensive than centralized exchanges.

Arbitraging the price of cryptocurrencies on exchanges — either day-trading or by implementing algorithms — is a byproduct of the speculative (and programmable) nature of Bitcoin. Since Bitcoin is still an experimental technology, its potential as a store of value is unclear; though, volatility provides traders with an excellent opportunity to recognize market movements and profit off of well-timed buys and sells.

Exchanges such as Binance and Coinbase Pro are building institutional-grade tools for traders in an effort to promote Bitcoin and other cryptocurrencies to a top-level asset class.

Many trading strategies rely on sentiment analysis: much of how the market feels about prices, movements, and reactions to various changes in laws, policies, and asset listings on exchanges are publicly accessible via forums such as Twitter, Reddit, etc.

Many institutional and venture capital funds are investing into privately owned companies working on blockchain tech. For instance, more than 25% of Union Square Ventures’ recent investments are in the blockchain / cryptocurrency space, including Coinbase which was recently valued at $8B. a16z, a premier VC fund whose founders played pivotal roles in the development and expansion of the internet, has launched a crypto-focused fund. Bakkt is a new digital asset platform that is partially owned by the NYSE and the Intercontinental Exchange (ICE). Likewise, Fidelity will be launching a digital assets platform for custody and trading of Bitcoin.

Given that cryptocurrencies are anonymous (using hash-based addresses instead of names or personal identifiers), one of the most prevalent use cases of Bitcoin in its early history was for the purchase of contraband: drugs, counterfeit goods, and various other illegal paraphernalia.

The Silk Road was the first modern darknet marketplace, serving exactly this purpose; it was launched as early as February 2011. Ultimately, it was shut down by the FBI and its founder was charged two life sentences. The total revenue generated from these sales was 9,519,664 Bitcoins, and the total commissions collected by Silk Road from the sales amounted to 614,305 Bitcoins. Notably, the FBI auctioned off the ~140k Bitcoin seized from the operators of the drug market. It’s now worth nearly $500m.

Kathryn Haun, the formal federal prosecutor who was responsible for finding and taking down corrupt FBI agents on the Silk Road task force, as well as the head of an exchange popular with criminals called BTC-E, is now the first-ever female general partner at Andreesen Horowitz, focused on their crypto fund. Clearly, even those who previously were focused on prosecuting fraud, cybercrime, and online darknet markets recognize the value and promise of decentralized currencies.

This introduces an interesting intersection between policy and cryptocurrencies. How are governments reacting to currency whose monetary supply, usage, and governing rules are outside of their control?

Governments are beginning to explore cryptocurrencies of their own.

Decentralization is not a property of cryptocurrencies which governments favor; government-managed cryptocurrencies, which are being explored by countries including the US, China, Japan, Canada, Venezuela, and more, could yield a new era of centralization.

Centralized digital currencies would provide people with a cheap and secure way to buy things with programmable and digital money, but would enhance privacy concerns in authoritarian countries. Governments are also interested in regulating the usage and exchange of cryptocurrencies.

Since cryptocurrencies can sponsor illegal activity, companies who allow people to buy and sell cryptocurrencies are subject to rules surrounding money transmitters; this includes submitting transaction records to regulatory bodies like the SEC.

Given that cryptocurrencies enable a new form of funding for business ventures, the new trend of “ICO’s” — initial coin offerings — as a fundraising strategy is heavily subject to government scrutiny. Many ICO’s have allowed fundraisers to run away with investments providing investors with no security or guarantee of return.

Initiatives like Coin Center are working hard to fight misinformation and educate policymakers on the benefits of cryptocurrencies, especially given its ability to restore financial agency to citizens.

Resources

--

--

Yorke Rhodes IV
Rice Blockchain

Ethical technology optimist and smart contract engineer