A Byte of Blockchain - Week 39 EVM, State Transition & Turing Completeness revisited

·

4 min read

A Byte of Blockchain - Week 39                                           
EVM, State Transition & Turing Completeness revisited

Photo by RODNAE Productions: pexels.com/photo/person-writing-on-a-whiteb..

Recap

Last week we explained the key factor that separates Ethereum from the Bitcoin Blockchain which is the ability to add a data payload along with the transaction value into a transaction. This "data payload" can evaluate "conditions" which triggers the outcome of the transaction e.g., check if a condition has been satisfied to make a payment.

Let us recap some of the concepts we discussed in Week 36 again & take it further.

Concepts Revisited

Virtual Machine

In Week 36, we explored Virtualization which means creating multiple computers inside one physical machine. This is achieved through specialized software called Hypervisors. Below visualizations makes it more clear:

Virtual_Machine.jpg

Hypervisor.jpg

State Machine

In Week 36, we used the analogy of a balance sheet change to explain state changes in a company financials. Now, let us take it one step further. We use applications like Microsoft Excel, Word etc when we work on our laptops or PCs. We add new files or modify an existing file, & then save the file.

When we do this, the state of the machine changes from what it was before we saved the file to the one after saving the file. The below visualization makes it clear:

EVM-1.jpg

Turing Complete

We know that applications are developed on laptops or desktops using programming languages. The logic of an application is coded in a programming language & run on the laptop / desktop or server.

If we are able to develop applications to solve problems or do some computation, it means that the laptop & programming language supports such computation or problem solving. For example, if we want to solve mathematical problems, we use a programming language like python to create an application to solve these problems. We then run the code in the laptop / PC / server to make the application work.

Thus, the language as well as the laptop / PC is Turing Complete. (It is not that simple however this will suffice for now).

The below visualization makes the above clear :

EVM-2.jpg

What has all the above to do with Ethereum? Read on.....

Analogy to Single Computer

Now, imagine your laptop is connected to a lot of other laptops & all of them are trying to run the same code to make an application work.

Ethereum is a network of computers connected through the Ethereum client (software used to connect all the computers through peer-to-peer network). Hence the same state is distributed across all the computers. This means it is a DISTRIBUTED STATE MACHINE.

Let us rewind back to Bitcoin Blockchain. What does a Bitcoin blockchain actually do?

In very simple terms, it tracks

a. The STATE of Bitcoin units &

b. Who owns them

A change in either of the above is updated in all the connected computers.

  1. A change in ownership of Bitcoin changes the STATE of Bitcoin blockchain

  2. which means transactions causes a global STATE TRANSITION due to this change in ownership of Bitcoins.

  3. Global means it affects all the computers forming part of the network.

The difference between Bitcoin Blockchain & Ethereum is that instead of tracking only ownership of coins, Ethereum also tracks the change in general data like conditions or other information related to a transaction which causes the state of the Ethereum Blockchain to change. This means we can add logic to any transaction which expands the scope of application development tremendously.

It is the Ethereum Virtual Machine which runs like a single laptop on all the machines. Just like a computer or laptop, Ethereum Virtual Machine has memory that tracks code & data, & it uses the Ethereum Blockchain to track changes in this memory. Also, like a computer, Ethereum can load code into the Virtual Machine & RUN that code, storing the resultant changes in the Blockchain.

Since Ethereum can load and run code with any sort of logic, it is Turing Complete, the only limitation being the finite memory available.

So, Ethereum is like this giant network of computers functioning as one single computer through the Decentralized Blockchain & all the machines reflecting the same state. The only difference between Ethereum and a single computer is that :

a. The state changes are bound by consensus rules meaning all the computers in the Ethereum network has to agree to the transactions causing the state change &

b. Ethereum is one huge network of computers in sync while a computer is one device.

So, this means we can deploy programs or apps in Ethereum like we do in a single device which has a lot of implications & creates new paradigms.