by Yorke Rhodes IV and Achal Srinivasan

Ethereum & How It Works

Blockchain Beyond Bitcoin | Lecture 6

Yorke Rhodes IV
Published in
10 min readMar 18, 2019

--

Recap

In the last lecture, we introduced a few concepts and mental models which will be important in our discussion of Ethereum this week.

Combinatorial Innovation

Software is by nature composable: it is designed from building blocks which can be combined to solve more complex problems and interactions. Denis Nazarov describes this phenomenon as “combinatorial” innovation:

A good medium of communication for a flow of ideas, a culture of sharing which develops and refines ideas through discourse, and strong competition providing incentives to motivate entrepreneurs are all necessary for this type of innovation to flourish. The internet enables modern communication technology, and an open-source software community which competes for network effects provides the ideal breeding ground.

Open State

State is the ability for software to remember; the internet does not natively maintain state for its users. Initially, cookies were introduced to maintain local state on devices allowing users to continue where they left off. With the advent of cloud computing, internet companies have begun to store user state on proprietary servers for increased efficiency and data analysis. Users are unable to control or transfer this state which is inherent to them between applications, stunting their ability to transfer value in the digital economy. As a result, these companies yield disproportionate economic benefits from holding user state. Monetization of state has primarily taken the form of digital advertising, reliant on intense data harvesting, leading to poor user experience and misaligned incentives between users and applications. Since the inception of Bitcoin, we have seen an emergence of a new model for internet state which is publicly maintained and accessible. This is called open state, enabling a new class of applications for users.

Abstract Blockchain Components

A blockchain is a distributed computing architecture utilized by a network to ensure the same transactions, grouped into blocks, are executed and recorded on ledger copies for all the network nodes. One block is added at a time, and every block contains a cryptographic proof which verifies that it follows in sequence from the previous block, forming an ordered chain. Specific implementations of a blockchain define protocol rules which the network nodes conform to, governing what transactions are considered valid. Profits built into the protocol incentivize nodes to validate transactions according to these rules, encouraging the network to maintain ledger consensus. We have identified 5 important components of blockchains irrespective of implementation:

Bitcoin Application Layer

Developers sought to create applications on top of Bitcoin given its novel ability to store cryptographically verifiable data on a public ledger. While Bitcoin scripting allowed for primitive applications such as escrow and green addresses, more useful applications which explore the full potential of open state necessitate more complex data be stored on the blockchain. In 2013, Vitalik Buterin (19-year-old Russian-Canadian) published the Ethereum whitepaper, beginning with an acknowledgement of Bitcoin’s success in defeating the double-spending problem. With his analysis of the Bitcoin network and its application layer limitations, Vitalik expressed what his design philosophy for Ethereum was.

Ethereum Design Philosophy

  1. simplicity — the average programmer should be able to follow and implement the entire spec, following a vision for an open protocol
  2. universality — no features or bias toward any specific applications
  3. modularity — small protocol modifications should not affect entire application stack
  4. agility — opportunities for optimization (scalability, performance, efficiency) will be taken advantage of
  5. non-discrimination/non-censorship — protocol regulatory mechanisms should regulate harm and not oppose specific “undesirable” applications

What is Ethereum?

Ethereum is a programmable blockchain. Instead of a predefined set of valid ledger operations akin to Bitcoin transactions, Ethereum allows users to create and define their own operations through code. This extensibility comes from the Ethereum Virtual Machine (EVM), which can execute code of arbitrary algorithmic complexity.

In computer science terms, this means the EVM is Turing-complete. Every node on the network maintaining a copy of the “ledger” runs a copy of the EVM and listens for transactions, executing broadcast instructions locally to validate broadcast outcomes. As a result, the EVM is oft described as a world computer.

Implications of a World Computer

This massive parallelization of computing across the entire Ethereum network is not done to make computations more efficient. In fact, this process makes any computation on Ethereum far slower and more expensive than on a traditional home desktop or cloud-compute VM. Rather, every Ethereum node runs the EVM in order to maintain consensus across the blockchain. Decentralized consensus gives Ethereum extreme levels of fault tolerance, ensures zero downtime, and makes data stored on the blockchain immutable and censorship-resistant, enabling a powerful class of business applications. As such, the additional value derived from this consensus should exceed the cost of performing the same computation in a centralized manner.

Ethereum’s Components

We will now use our new understanding for abstract blockchains in modelling Ethereum.

The consensus layer of Ethereum defines the ledger format to be the memory contents of the EVM, which includes a table of ether balances (native currency). The consensus algorithm is familiar: defer to the longest ledger (with the most associated computational work).

The mining layer of Ethereum incentivizes network nodes with a proof of work style puzzle with plans to move to a proof of stake model soon, and sophisticated transaction fees which will be discussed in depth below.

The propagation layer of Ethereum is a collection of peer-to-peer protocols called libp2p which allows for network nodes to communicate about the contents of new blocks.

The semantic layer of Ethereum defines the transaction rule set; certain state transitions should only be executable by certain parties to prevent an abuse of open state within the EVM.

The application layer is central to Ethereum and motivates many of its design principles. It consists of smart contracts, which exist as code stored in the memory of the EVM, and web/mobile/iot client interfaces which enable users to interact with business logic deployed in smart contracts.

How does Ethereum work?

Whereas the Bitcoin blockchain was purely a list of transactions, Ethereum’s basic unit is the account. All accounts have associated state within the EVM and can be identified by their corresponding memory address. All state transitions which represent transfers of value and/or information between accounts are valid only when a digital signature matching that of the sender account’s public/private key pair (derived from their address) is attached.

There are 2 types of accounts. Externally owned accounts (EOAs) have state only in the form of an ether balance. These accounts are controlled simply by private keys. Thus, humans can exist only as EOAs within the EVM by generating a private key. Contract accounts have state in the form of a balance and additional allocated EVM memory called storage. These accounts cannot be externally controlled and their private keys are unknown. A smart contract refers to the code which governs a contract account’s behavior, which is a program that is executed when a transaction is sent to the account. This code lives within the account’s storage space, where persistent program variables are read from and written to. EOAs can perform contract deployment which allows them to instantiate contract accounts containing specific code, but no further special permissions are granted to the deployer beyond the contents of the code. Thus, if a contract is controlled by a human user, it is because it is programmed to be.

The Ethereum network requires nodes to be able to agree on the outcome of computation, which requires a guarantee of strictly deterministic execution. Consequently, the rule set at the semantic layer of Ethereum restricts write-access of contract code to their own allocated storage space, mitigating race conditions.

Account Interactions

State transitions within the EVM activated by transfers between accounts are separated into 2 categories: transactions and messages. A transaction refers to the signed data package that is sent from an EOA to any other account. A message refers to the data package that is sent from a contract account to any other account. Messages allow contracts to have relationships with other accounts in exactly the same way that external actors can, enabling a unique form of combinatorial innovation.

Note that any communication via messages between contracts must be triggered by an EOA’s transaction. As a result, contracts lack work-time autonomy.

Due to the arbitrarily complex nature of the relationships between contracts, the necessary computation and associated costs grow quickly. Ethereum introduces a clever payment mechanism for this which allows developers to avoid paying maintenance and usage costs on their EVM code, marking a paradigm shift for the open source community.

Fuel for Miners

In Bitcoin, a fixed amount of processing power is required to validate a transaction. Bitcoin users attach fees to their transactions to encourage miners to include them in mined blocks. In Ethereum, the amount of processing power required to validate a transaction is variable due to arbitrarily complex code. EOAs that send a transaction to a contract account must pay for each operation of the program they activate, including computation and memory storage. Fees are paid in a denomination called gas which is the unit of computational work performed in the EVM.

Gas cost is the amount of work associated with a transaction. Gas price is the wage that the miners receive for each unit of work, insulating the cost of computation from the potentially volatile ether price. The product of gas cost and gas price determines the overall transaction fee, which is charged by the miner who processes the transaction and includes it in their winning block successfully.

If the gas price is too low, no miner will bother including the transaction in their block. If the gas cost is less than the computational work necessary to complete execution, upon discovery the miner will stop processing, revert any state transitions, and include the failed transaction on the ledger so they can still collect fees for their incomplete work. The combination of these two economic mechanisms makes complex computations safe for the network to work on and validate, and limits negative effects of bad programming to only those who have paid sufficiently to invoke bad code.

Decentralized Applications (DApps)

Ethereum apps commonly interface with users via an HTML/Javascript web application using a Javascript API to communicate with the blockchain. These apps have their own suite of associated contracts in the EVM which they use to encode business logic and allow persistent storage of their consensus-critical state. Because of the self-governing nature of contract accounts and the publicly maintained and accessible open state, this application stack is considered to be the basis of decentralized applications. This emerging application stack greatly subverts the traditional web application stack that was solidified in the dotcom era.

When a DApp interface publishes its underlying smart contract library, users have the unique ability to audit the business logic with which they are engaging in a contract. More significantly, due to the nature of the EVM, the outcome of their transaction are deterministically known, empowering an entirely trustless relationship between users and applications.

Evolving Web Application Stack

We talked previously about shared internet protocols: TCP/IP, SMTP, HTTP. Due to companies like Facebook, Google, Amazon, and Microsoft, and their breadth of internet services built on top of these protocols, an enormous amount of value has been captured through web applications. These applications collect lots of state, which provides an obvious monetization opportunity (advertising). This results in data silos: the content and state that you aggregate within these applications only exists within the scope of one company’s products and services. Due to the self-reinforcing nature of network effects within these walled gardens, most of the value on the web application stack has been captured at this applications layer. Venture capitalists quickly realized that investing in these proprietary services had great potential return, maximized by competitive advantages and moats, whereas investing directly in protocol technologies generally produced low returns.

Fat Protocol Thesis

With Ethereum, and more generally, with the blockchain application stack, value is amassed at the shared-protocol layer, and only a fraction of the value is distributed along the applications layer. Joel Monégro of Union Square Ventures famously described this as a stack with fat protocols and thin applications.

As clear examples of this, Bitcoin has a $60B market cap, yet the most successful proprietary services built on top are worth at most a few hundred million. Ethereum has a $12B market cap, but we are still waiting for the killer applications to come to consumer markets.

Shared Data Layer

By replicating and storing user data in an open and decentralized network rather than siloing data inside individual applications, the barrier to entry for new applications is decreased, creating a more vibrant ecosystem of products and services.

In 2016, Monégro pointed to cryptocurrency exchanges as the most apparent example of this. It is easy to move money across exchanges, like Coinbase or Kraken, because they have equal access to the underlying transaction logs. The exchanges are by nature interoperable despite non-cooperation, which results in the market finding ways to build better products and reduce costs.

By building on top of shared protocols, companies benefit from their significant liquidity and network effects which cannot be captured by bootstrapping new protocols or blockchains.

The shared data layer is the first of 2 causes of the trend towards a fat protocol web application stack. Next week we will explore the second cause: the tokenization of protocols, and evaluate how venture capital markets are being transformed by this phenomenon.

--

--

Yorke Rhodes IV

Ethical technology optimist and smart contract engineer