Hvor rask er Ethereum?

Ethereum bruker blokkjeden som database for en datamaskin hvor man blant annet kan kjøre smarte kontrakter. Applikasjonene kjører innenfor en Ethereum Virtual Machine som omformer applikasjonens opprinnelige tilstand til en ny tilstand på en verifiserbar måte. Hvis starttilstanden for eksempel er

{variabel1: 100, variabel2: “hallo verden”}
, og noen kaller en smart kontrakt slik at dette endres til
{variabel1: 101, variabel2: “farvel verden”}
, skal alle nodene i Ethereum komme fram til den samme nye tilstanden.

Forskjellen fra en vanlig datamaskin er altså at Ethereum kan utføre operasjoner på blokkjeden, så som å overføre verdier, og at resultatet er verifiserbart på samme måte som andre blokkjededata er det.

En annen viktig forskjell er at Ethereum, som datamaskin betraktet, er dyr og treg.

Regnekraften i Ethereum måles i gas, “bensin”, som har en pris. En enkel operasjon krever mindre bensin enn en kompleks. Bensinprisen varierer etter etterspørsel: De som tilbyr mest står først i køen for å få bli inkludert i neste blokk, altså å få lov til å få sin operasjon og nye tilstand inkludert i den neste blokken i blokkjeden. Hver blokk kan nemlig bare forbruke en viss mengde bensin. Nicholas Weaver forklarer implikasjonene for Ethereums hastighet i artikkelen The Web3 Fraud:

Any given block of the Ethereum blockchain represents a maximum amount of execution, currently 30 million gas. And the system adds a new block every 15 seconds, which means the total compute of the Ethereum network as 2 million gas/second, since that is the amount of computation that gets recorded into the Ethereum ledger.

Estimating the cost (measured in ‘gas’) of an arbitrary computation is complex but let’s assume that we are only interested in the most simple operation: 256 bit integer addition. Each addition costs 3 gas each. So on a worldwide basis this system rates at 600,000 adds per second.

Compare this amount of compute to a Raspberry Pi 4, a $45 single-board computer which has four processors running at 1.5 GHz. Each core has 2 ALUs and it will take 4 instructions to perform a 256 bit addition, as the basic unit for the Raspberry Pi (and most other modern computers) is 64 bits. So each core has a peak performance of 750,000,000 adds per second for a total peak of 3,000,000,000 adds per second. Put bluntly, the Ethereum “world computer” has roughly 1/5,000 of the compute power of a Raspberry Pi 4!

This might be acceptable if the compute wasn’t also terrifyingly expensive. The current transaction fees for 30M in gas consumed is over 1 Ether. At the current price of roughly $4000 per Ether this means a second of Ethereum’s compute costs $250. So a mere second of Ethereum’s virtual machine costs 25 times more than a month of my far more capable EC2 instance. Or could buy me several Raspberry Pis.

What about the storage? The entire Ethereum blockchain is just 1 terabyte of data and adds a total of a few hundred kilobytes a minute. Storing the Ethereum blockchain using a robust commercial service like Amazon S3 costs just $20 a month.

Even the most optimal storage strategy in Ethereum requires 600 gas per byte. Yet the total network compute capacity is only 2M gas/second so storing 1 megabyte will require 300 seconds. So not only can the Ethereum blockchain only store 3 kB of data a second, storing that 3kB costs $250! So the cost of writing a single 3kB message to the Ethereum blockchain is the same price as a year of storage on Amazon for the entire 1 TB Ethereum blockchain. Or the same price as buying a 1 TB M.2 SSD.

For at bruken av Ethereum skal være verdt ventetiden og kostnaden, må altså programmene være svært effektive og utføre eksepsjonelt viktige oppgaver.