Demystifying Ethereum for folks who understand bitcoin and programming

 

I know there have been a number of thoughts already published on ethereum, but I wanted to try to write a brief  post demystifying ethereum for folks who (a) have a basic technical understanding of bitcoin and (b) have a basic understanding of web development.

Ethereum for Folks Who Understand Bitcoin

First, what is the essential theory of ethereum? Assuming you already understand bitcoin, this is the clearest explanation I’ve heard, from fivedogit:

Bitcoin says “Send X from A to B”. Ethereum says “Send X from A to B if J and K but not L” Further[more], where all bitcoins always reside in the accounts of its participants, Ethereum has a second type of account: contracts. A contract can hold value and do something with it based on conditionals. For instance, a hundred people could pay $1 into a raffle contract which is rigged to pay out to a random user on the 100th payment.

In a nutshell, the Ethereum blockchain mimics a full-blown computer that can manage these so-called “contracts” with arbitrary complexity.

But how does this actually work? How/where do these Ethereum programs that manage these contracts actually run? If you understand bitcoin and the blockchain, you know that one of the key insights into bitcoin is that it is a giant, trusted, transactional, distributed ledger. One way of visualizing this is that every bitcoin transaction (i.e. the entire ledger) since the beginning of time is stored on every full node and there are roughly 5100 codes as of this writing.

Imagine that, instead of storing bitcoin transactions in this blockchain, you’re actually storing pieces of a program’s working memory– i.e., its “state”– and that the program itself was also stored in the blockchain. Yes, it would be very expensive, but it’s possible. In this type of “computer,” things like calculations that aren’t stored permanently would still be relatively cheap– e.g. calculating 123*4123. Writing something permanently– e.g. x = 123*4123– is expensive. And writing something big permanently– e.g. x = <a 1 GB string>– is super-expensive.

That’s exactly how ethereum works. Ethereum is basically an underpowered, distributed computer where everyone agrees on what the programs are and what the current state of each of the programs is, because both the programs and their state are written directly into the Ethereum blockchain. In fact, many writers have noted that the entire computational power of the Ethereum blockchain is similar to a 1999 smartphone.

Why would anyone want such a thing? One canonical example is slock.it. As this Coinbase article explains:

Airbnb works fine, but it has drawbacks, like:

  • Fees. Airbnb charges 9-15%.
  • Handing off the key. What if you’re on an airplane? What if you have two guests staying one after the other? How do you prevent guest number 1 from entering during guest number 2’s stay?
  • Limited payment options. If the guest doesn’t have an international credit or debit card, booking through Airbnb can be hard or even impossible. This may not seem like a big deal, but keep in mind that in many countries getting those cards is much harder.

One way to cut out Airbnb is to let your guest arrange the logistics – booking, payment, deposit, checking in and out – directly with the door lock itself. This requires a lock that isn’t just “smart” (electronic), but one that can handle these interactions with guests over the Internet, on terms specified by the host.

If you’ve been following this article so far, it should be clear how the Ethereum network enables this type of application. Essentially, you pay some amount– say $60– to an Ethereum contract that controls a physical electronic door lock. The entirety of the program runs on the Ethereum distributed computer, a.k.a. the “Ethereum Virtual Machine” (EVM). When you pay $60 to the contract, it gives you access to unlock the door automatically– no middleman, not even a middleman computer that could be hacked.

Ethereum Downsides

A huge downside of Ethereum is that it requires the programs on its blockchain to be bug-free, and bug-free programs are notoriously difficult to write. By far the most important example of this recently was an Ethereum program/contract called (literally) “TheDAO,” which was essentially a contract that performed the functions of a venture capital fund. I don’t want to get into the details of this, but suffice it to say that many people sent millions of dollars into TheDAO contract and then a very smart hacker figured out how to extract more than his/her fair share.

It Gets Worse for Programmers

Let’s say that you understand all of this and want to build your own Ethereum program now. You could build a bulletproof Ethereum lottery, for example, where folks pay in and the entirety of the funds are distributed to a winner chosen at random as of a certain date. Or you could build a a non-profit fund where folks pay into a central contract and then the fund pays out to agreed-upon charities on a predefined basis at predefined time intervals, with zero overhead or potential for graft.

One problem is that the Ethereum programming infrastructure for standard developers, as of today, is very, very bad. If you remember programming assembler and then C came around, or remember programming CORBA and then RESTful webservices came around, or you handcrafted javascript functions and then jQuery came around, you know what I mean. The current state of Ethereum is that primitive. After trying to build a “hello, world”-type contract with Ethereum and Solidity (the de facto programming language for the Ethereum virtual machine), it feels very much like a first “dancing bear” version– amazing that the bear can dance, but incredibly cumbersome. Here’s my favorite post on what it’s like for a real web developer to put together something meaningful on Ethereum. Quote from there:

After 4 weeks of work by 2 experienced developers, we managed to make our code work in the public Ethereum network with lots of effort. Regressions and compatibility breaks in the Ethereum libraries between Frontier and Homestead versions didn’t help. Check the project source code at marmelab/ZeroDollarHomePage for a detailed understanding of the inner workings. Please forgive the potential bugs in the code, or the inaccuracies in this post – we have a limited experience in the matter. Feel free to send us your corrections in GitHub, or in the comments.

We didn’t enjoy the party. Finding our way across bad documentation and young libraries isn’t exactly our cup of tea. Fighting to implement simple features (like string manipulation) with a half-baked language isn’t fun either. Realizing that, despite years of programming experience in many scripting languages, we are not able to write a simple solidity contract is frustrating. Most importantly, the youth of the Ethereum ecosystem makes it completely impossible to forecast the time to implement a simple feature. Since time is money, it’s currently impossible to determine how much it will cost to develop a Decentralized App.

For what it’s worth, I felt exactly the same way when trying to program my app– it was just too hard to get something simple working.

Bottom Line

The bottom line is that Ethereum is a hugely interesting undertaking but it’s in its very early stages. A big part of the reason that I think that bitcoin is likely here to stay is that there’s enough at stake that if there were a huge bug in it somewhere, it would have likely already been found– that is, I think that the collective trust in the underlying bitcoin codebase is a crucial reason for its success.

A very big issue with Ethereum is that bug-free code is very difficult to write, but because Ethereum is designed to be a computer, that means that new, potentially important code is being constantly added to the Ethereum ecosystem. This means, in turn, that if there are Ethereum “killer apps” in the future, they will likely be written by a small subset of super-programmers and Ethereum will be a special-purpose blockchain for these super-programmers, not a general-purpose infrastructure for most programmers.

This is not to say that it will stay that way. It may be possible to de-skill Ethereum so that most of the basic things that you might want to do with it are bulletproof. Ethereum and its underlying toolsets will likely dramatically mature and that is a possible outcome.

Bottom line: Ethereum is deservedly interesting, but I think it may be years away from fulfilling its promise.

Leave a comment