Hello!

© 2024 Kishan Kumar. All rights reserved.

Understanding Ethereum

Ethereum is a distributed state machine, it is open source, globally decentralized computing infrastructure that executes programs called smart contracts, that are written in Solidity.

May 23, 2023

Hero

Ethereum is an open source, globally decentralized computing infrastructure that executes programs called smart contracts.

It uses a blockchain to synchronize and store the system’s state changes, along with a cryptocurrency called ether to meter and constrain execution resource costs.

In other words, whenever someone wants to perform an operation within this system, they need to pay a certain amount of ether to cover the costs associated with that operation. This helps ensure that resources are used wisely and that the system remains stable and efficient.

How is Ethereum different from Bitcoin?

  • The purpose and construction of Ethereum are strikingly different from those of the open blockchain that preceded it, including Bitcoin.
  • Ethereum’s purpose is not primarily to be a digital currency payment network. It is intended as a utility currency to pay for use of the Ethereum platform as a world computer.
  • A set of rules for independent transaction validation and currency issuance (consensus rules)
  • Where Bitcoin’s script language is, intentionally, constrained to simple true/false evaluation of spending conditions, Ethereum’s language is Turing complete, meaning that Ethereum can straightforwardly function as a general-purpose computer.

In December 2013, Vitalik started sharing a whitepaper that outlined the idea behind Ethereum: a Turing-complete, general-purpose blockchain. The founders worked for years, building and refining the vision. And on July 30, 2015, the first Ethereum block was mined.Ethereum’s development was planned over four distinct stages, with major changes occurring at each stage. A stage may include sub releases, known as “hard forks”, that change functionality in a way that is not backward compatible.

The four main development stages are codenamed Frontier, Homestead, Metropolis, and Serenity.

Ethereum is a distributed state machine. It has memory that stores both code and data, and it uses the Ethereum blockchain to track how this memory changes over time. Ethereum can load code into its state machine and run the code, storing the resulting state changes in its blockchain.

Two of the critical differences from most general-purpose computers are that Ethereum state changes are governed by the rules of consensus and the state is distributed globally.

What do we mean by the word Turing Complete?

Turing completeness is a concept in computer science that refers to a system or language’s ability to simulate a Turing machine.

A Turing machine is an abstract mathematical model that can perform any computation that can be described algorithmically.

To be Turing complete, a system or language needs to have a few key abilities:

  1. It should be able to represent and work with data, like numbers, words or lists.
  2. It should have instructions or commands that allow it to make decisions (like if-else statements) and repeat actions (like loops).
  3. It should have a way to store and retrieve data from memory.

Why is Bitcoin not considered Turing Complete?

Bitcoin is not considered Turing complete because its scripting language, known as Bitcoin Script, is intentionally designed to be simple and limited in order to prioritize security and prevent certain types of vulnerabilities.

It is a stack-based scripting language used for defining conditions under which Bitcoin transactions can be spent. It intentionally avoids looping constructs (such as traditional while loops) and recursive function calls, which are key features of Turing complete languages. Why? These limitations are imposed to ensure that the validation of Bitcoin transactions remains predictable and deterministic.

Ethereum’s groundbreaking innovation is to combine the general-purpose computing architecture of a stored-program computer with a decentralized blockchain, thereby creating a distributed single-state (singleton) world computer. Ethereum programs run “everywhere” yet produce a common state that is secured by the rules of consensus.

Turing completeness is very dangerous, particularly in open access systems like public blockchain, because of the halting problem. What is the halting problem?

The halting problem is a famous problem in computer science that deals with determining whether a given program will eventually halt or it will run indefinitely.

Modern printers are Turing complete and can be given files to print that send them into a frozen state. The fact that Ethereum is Turing complete means that any program of any complexity can be computed by Ethereum. But the flexibility brings some thorny security and resource management problems. An unresponsive printer can be turned off and turned back on again. That is not possible with a public blockchain.

Ethereum can’t predict if a smart contract will terminate, or how long it will run, without actually running it (possibly running forever). Whether by accident or on purpose, a smart contract can be created such that it runs forever when a node attempts to validate it. This is effectively a DoS attack. In a world computer, a program that abuses resources gets to abuse the world’s resources. How does Ethereum constrain the resources used by a smart contract if it cannot predict resource use in advance?

To answer this challenge, Ethereum introduces a metering mechanism called gas. As the EVM executes a smart contract, it carefully accounts for every instruction (computation, data access, etc). Each instruction has a predetermined cost in units of gas. The EVM will terminate execution if the amount of gas consumed by computation exceeds the gas available in the transaction. Gas is the mechanism Ethereum uses to allow Turing-complete computation while limiting the resources that any program can consume.

How does one get gas to pay for computation on the Ethereum world computer?

It can only be purchased as part of a transaction, and can only be bought with ether. Ether needs to be sent along with a transaction and it needs to be explicitly earmarked for the purchase of gas, along with an acceptable gas price. (The price is not fixed, it depends on demand and supply, similar to how a normal petrol pump works.)

..... To Be Continued. Stay Tuned.

.   .   .

The 0xkishan Newsletter

Subscribe to the newsletter to learn more about the decentralized web, AI and technology.

Comments on this article

Please be respectful!

© 2024 Kishan Kumar. All rights reserved.