For fun I changed just one word in there. Hashing it again gives me 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 / Bitcoin maximalist wanted to 'rewrite history' in the blockchain, changing just a single digit somewhere would be instantly noticeable 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. If the input can be anything, it will take around 2 511 guesses. That's around a 1 with 154 zeroes behind it, in case you were wondering.

Despite this difficulty, a computer in the Ethereum network of computers makes a correct guess every 15 seconds.

Maybe this number thing isn't always helpful...

This guessing game is what's called mining. The reason why this guessing game doesn't take forever is that the input isn't entirely random. If I give you a copy of the Adventures of Sherlock and tell you that a hash is exactly the same with only one word altered, it's suddenly much easier to guess. All you have to do to guess is change a random word and leave the rest untouched. You have 99% of the input already, so guessing becomes much easier.

This is why each block stores a hash of all previous states and transactions. What the miners are guessing is [hash of everything until now] + [some number] . Miners can thus only make a correct guess in a reasonable timeframe if they download the most recent block.

The result is that all miners always work on the latest block and can't make a single change to older blocks. If you don't mine on the most recent block, it will take hundreds of thousands of years to guess the entire input. But if you do, you know most of the input already so solving can be done in months, not millennia. And when you have 25,000 computers all guessing at the same time, you get a winner every 15 seconds on average.

That 15 second time - also called the 'block time' - is intentional. As more computers join the network, the some number part is made longer to keep the winners 15 seconds apart. This gives everyone the time to download and validate the latest block.

Because all computers in the network are guessing at random the winner is also random. The winning computer gets to add a new block to the blockchain. They're also awarded 5 ETH for their hard work.

Mining in a nutshell. This loop happens millions upon millions of times a second, all over the globe.

Simply winning the guessing game isn't enough to add your block to the chain though. Every single computer in the network needs to double-check if you've done the work. Only when the majority of the network agrees that your guess was correct and that you changed states correctly is your block valid and thus considered 'true'.

Validating the guess is easy: all you need to do is input the guessed number and last block's hash 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.

This whole system of making lots of calculations is often called Proof of Work. Ethereum's security thus comes from a) keeping everyone on the latest block, b) having miners do an arbitrary amount of work, and c) only accepting the result after the majority has validated it. So where normal money (called 'fiat' by people who clearly have never driven a small Italian cars) is secure because it's backed by governments, cryptocurrency is only as secure as its protocols are.

If you, Mr. Supervillain, wanted to simply ignore the protocol and create Ether out of thin air, the only real way of doing that is to have the majority of the network in your own hands. Such an attack - called a '51% Attack' - is technically possible, but in reality unreasonably expensive and very easy to notice. (So not profitable at all.)

That's enough explanations for now. I hope you liked it! What should I explain next? Metropolis? ZK Snarks? (Below you can find my infographic about transaction pools and MyEtherWallet.) Tweet your suggestions!



If you learned something from my explanation, consider a tip at 0x1fe2C0B66007F6C1BaDF18b0Feea4c2Dc1d68353 .

For further reading, I recommend Chris Dannen's "Introducing Ethereum and Solidity" from Apress. If you're not afraid of math, the Ethereum Yellow Paper is not impossible to understand.

"What Happens When You Send a Transaction via MyEtherWallet (A Very Simple Illustration):