# Ethereum: A Visual Explanation

### What is Ethereum?

When you try to find out what Ethereum really is, it doesn't take long to get lost in jargon and buzzwords. It's uncensorable. It's decentralized. It's a blockchain. It's unregulated. It's secure. When you string all of those together, you could say that Ethereum is a generalised protocol for decentralized, secure transaction-based state-changing virtual machines.

If you're like me, you're now stuck with more questions than before. What on earth is a 'decentralized virtual machine'? What is a blockchain? How does it look like, and why is it secure?

And most of all, why should I care?

I decided to delve into books and papers on Ethereum to explain - in plain English - how Ethereum really works.

### The Big Picture

There is a lot of hype around digital currencies like Bitcoin and Ethereum. This is in no small part because of the insane price rises over the last few years. In 2010, a Bitcoin enthusiast used 10,000 bitcoins to buy two pizzas. Seven years later, those pizzas are worth over forty million dollars. \$40,000,000! (You can check the current pizza price here.)

[img of pizza]

The Ethereum currency, called Ether (and shortened to ETH) has also risen dramatically. So on the one hand, you have a bunch of speculators cheering this new technology on, hoping that it will continue to rise spectacularly. They don't need to understand how it works as long as the price continues to go up.

But on the other hand, you have people who believe that Ethereum could just be the biggest innovation in economics since the invention of money.

And yes, this has to do with all the buzzwords I mentioned. What makes Ethereum unlike anything before is that it is designed as a global, programmable computer with programmable money. It's not just a digital way to store value like Bitcoin is.

This global computer consists of thousands of individual computers connected to each other. These computers work together as if they're one single, robust machine. Every computer has a copy of all the information so if one computer fails it's not a big deal.

[img of global node network]

This global computer - called the Ethereum Virtual Machine - can be used to write agreements about anything of value, between anyone on the planet, in a transparent and secure way. It can be used to write apps that anyone can access and interact with. And it's not just limited to people - computers can interact with the Ethereum Virtual Machine as well.

These exchanges of value cannot be controlled by any individual, organization or government. Once something is on the blockchain it can't be changed on a whim.

Ethereum can give everyone the power to exchange value, much like the Internet has given everyone the power to communicate.

Note the word 'can' and 'could'. Although Ethereum in its current state can do an awful lot already, development is ongoing and learning curves are remarkably steep.

With that in mind, what is Ethereum made of that makes this all possible?

### Part One: Information

Because exchanging value is arguably the most important thing Ethereum does, we're gonna start there. What happens when you transfer money to someone? Well, your account is reduced by some amount of money, and another account is increased by the exact same amount of money.

Regular banks keep a record of all transactions and use that to determine how much you have. Your balance is simply all money that went in minus all money that went out. To keep track of everyone's money, banks create a large, time-ordered list of transactions. Such a record of all transactions like that is called a ledger :

FromToValue
0001AliceBob2 Coins
0002CarolDave6 Coins
0003.........

The blockchain is basically a digital ledger. A block is nothing more than a few dozen transactions with some information about the block itself. Really, see for yourself. The information about itself is called the header of the block, and contains information like the block's number and who created it.

[img of block]

Each block must say which block came before it - this is the chain part of blockchain. In other words, there is a chain of blocks from the first block (aptly called the 'genesis block') to the current block.

[img of blockchain]

Every computer in the network store a copy of this blockchain locally. When a new block is successfully added to the chain, every computer updates their version of the blockchain with peer-to-peer filesharing.

The above is true for both Bitcoin and Ethereum (and a bunch of other blockchains), but this is also where the differences begin. Ethereum stores not just transactions, but also states. A state is simply something that an object has and that can be changed. The color state of a traffic light might be green, but it might also be red. color = green and color = red are two different states.

Ethereum can store all kinds of states describing all kinds of real things, from monetary value and data files to your pet's name. If you have an Ethereum wallet, its balance is stored as a state (literally as balance = ...). This information is not stored in the blockchain, but in a separate state database. As you might expect, you use a transaction to reduce your balance and increase someone else's balance by the same amount.

But how do you create a state for your pet's name, and how do you change it? Here's the key: Ethereum transactions don't just change account balances. In Ethereum, a transaction can change any kind of state. If you - for some reason - have stored petname = Mr. Fluffalopolous , you use a transaction to change that state to petname = Mr. Fluffalopolous the Third.

Note that you can't just change someone else's states - this isn't Wikipedia. There are rules about what you can and can't do with transactions. This is what people mean when they talk about the Ethereum protocol. A protocol is simply a bunch of rules about what is and isn't allowed.

Some things are never allowed by the protocol. You can't send more money than you have, for example. You also can't just create money out of thin air, or make it disappear. The Ethereum ledger balances itself because the protocol doesn't allow unbalanced transactions.

It's not always so restrictive. The protocol leaves it up to you to decide who can and cannot change your pet's name. This is one of the freedoms you have when programming with Ethereum.

So if someone asks you what Ethereum is, you can now give them a good answer. Ethereum is a global mainframe computer. This computer runs on three main ingredients:

1. States, which can be changed by...
2. Transactions, which are governed by...
3. The Ethereum Protocol

Having a global computer is nice and all, but how do I know it's safe? What makes Ethereum so secure?

### Part 2. Decentralized Security

Ethereum is often called a cryptocurrency. This is not just because it sounds cool - although it obviously does. The 'crypto' part refers to the science of cryptography. Cryptography aims to define secure protocols to allow communication without anyone reading or tampering with it.

One of the cryptographic tools that Ethereum uses a lot is called a secure hashing algorithm, or SHA. This algorithm takes any kind of data as an input and changes that data in a specific way. For example, if I hash veenspace with the SHA-1 algorithm, the output is the hash e4a192365543903d6015465069f262b7d707e5b6. ('Hash' is both a verb and a noun.)

You can picture hashing as a cryptographic blender. Put any kind of data in, blend it for a fixed amount of time and the result is a blended - 'hashed' - bunch of letters and numbers.

It's not just any blender though. It blends one way only: you can't retrieve the original words from the mess of letters and numbers. The blender always blends the same way: when you give it a specific input, it will always produce the same output. If you put veenspace through SHA-1, which you can do here, it will always give you the hash e4a192365543903d6015465069f262b7d707e5b6 .

Most importantly, even the smallest change to the input will create a different output. Take, for example, the entire Adventures of Sherlock. If you hash the entire book, the result is 85ce3d0483d114fe67ee304c0d7522a31fa4e8a6. Now I changed one word in there, hashed the entire book agian and the result is 08f0ee20fcffe7028787ee5232b9ae80de016857. Note how pretty much every part of this second hash is a completely different letter or number than the first.

You might think that's the lamest party trick ever (and you wouldn't be wrong) but it's the key to Ethereum's security. Each block in the blockchain contains a hash of all previous states and all previous transactions. So if some supervillain wanted to 'rewrite history' in the blockchain, changing just a single digit somewhere would be instantly noticable because the hashes would be completely different.

I said that there was no way to reverse the blender, which is not entirely true. You can try and guess what the original input was, and see if the hash you end up is the same. How many guesses? More than you think. If you were to make ten million guesses each second on Ethereum's hashing algorithm, it would still take - on average - 1,600 days or about 4,5 years to find the correct answer.

How hard is it? Well, imagine picking a random Canadian, and having them pick another random Canadian. Now guess which pair of people are the correct ones by asking all 36,000,000 Canadians about all 36,000,000 other Canadians, one by one. That's roughly how hard it is to guess.

Despite this difficulty, the Ethereum network of computers makes a correct guess every 15 seconds. This guessing game is what's called mining. Because all computers in the network are guessing at random the winner is also random. As a reward, the computer that is the first to guess correctly (so, to find the original word) gets to add a new block to the blockchain. This computer - the 'miner' - is also awarded 5 ETH for their hard work.

Simply winning the guessing game isn't enough to add your block to the chain though. Every other computer in the network needs to double-check your block. Not only do they check if you haven't altered the blockchain, they also validate each transaction in the block and validate your guess.

Validating the guess is easy: all you need to do is input the guess into the Ethereum hashing algorithm, and it should spit out the hash that everyone's been working on. It's hard to guess veenspace when all you have is e4a192365543903d6015465069f262b7d707e5b6 , but the other way around can literally be done in less than 0.1 seconds.

Only when the majority of the network agrees that your guess was correct and that you changed the states correctly is your block valid and thus considered 'true'. If you happen to be a supervillain who wants to ignore the protocol and create Ether out of thin air, you would need to have the majority of the network in your own hands. Such an attack - called a '51% Attack' - is unreasonably expensive and very easy to notice, so not profitable at all.

### Part 3. Ethereum And You

• Consensus
• Cryptography
• Hashing -> Validation
• Mining Algorithm

## Notes

• What makes a blockchain cool

• P2P
• Asymmetric Cryptography
• Crypto Hashing

Ether allows you to build an economic system in software. That's the promise. For whatever you like, and run it on the EVM. Ether is Turing complete and is based on states.

Those states make it different from regular web apps, who need to be constantly running and allowing connections. Once a state is in the blockchain, every node will know about said state change and querying is trivial. No cc, no payment API, accounts required. You can move money around faster than you can email someone.

Microtransactions are thus feasible.

Blocks can store dictionaries, so you can also store files, licenses, royalties, and what more.

Ether is more a cryprocommodity than a currency. You can use ETH to run programs in the EVM and pay for transactions, so it has intrinsic value and is not just a store of value like BTC.

No individual can create more Ether out of thin air, unlike central banks.

Decentralized; Secure; Generalized; Transaction Ledger

• A ledger is a method of keeping track of who has what.
• It needs to be in balance. With regular banking systems, millions of dollars are required to keep this in balance; if not, you could create money out of thin air.
• The Ethereum protocol disallows unbalances. It can rapidly check balances and validate transactions.
• The blockchain is a bunch of data objects pointing to earlier data objects (genesis block being the first)
• Eth is a network of computers
• Each computer keeps a copy of the blockchain and runs any program that happens in there.
• This is why it can be trusted. And it makes querying trivial
• "In Ethereum, it is fast and inexpensive (if not yet easy) to develop and deploy unalterable, always-up, uncensorable applications that move real value over arbitrary distances."

Yellow Paper:

• Ethereum provides the general technology to power transaction-based state machines

• Why?

• To facilitate transactions that are not bound by geography, interface difficulty, incompatibility, incompetency, uncertainty, inconvenience or trust
• It allows an incorruptible judgement to be made over things: 'the algorithmic enforcement of agreements'
• It allows complete transparancy and deterministic behaviour
• Blockchain, saywhaaat?

• Ethereum is a transaction-based state machine
• Anything that can be represented by a computer can be put in the blockchain
• Transactions are valid arcs between two states (emphasis on valid)
• The Ethereum state transition function is the protocol.
• Each block contains a header, a bunch of transactions and ommers (headers of blocks with the same parent). It does not contain all of the rest of the blockchain; instead, it hashes its parents header, which allows a tree of transactions to be figured out.
• States

• World State: this maps addresses (0x....) to account states (nonce, balance, storageRoot, codeHash.
• Structure is a Merkle-Patricia trie. Its root depends on all internal data, so hashing the root means you have a unique result. This makes it safe and quick to validate.
• The Merkle tree is a binary tree, meaning every branching node has 2 children. Its label is the hash of its two children, meaning that the root is a hash of everything that's in the entire tree.
• Consensus

• Reached by whichever block has the highest total heaviness, which is just [parent total difficulty] + [block difficulty]. For each block, the difficulty is calculated. So the heaviest block in this branch is the correct one.