How Do Blockchains Work?

There are several places that you can read about the blockchain technology that underpins modern cryptocurrencies, smart contracts, and the Ethereum Virtual Machine. However, you can easily get inundated in technical details about block confirmation times, mining difficulty, double spending, 51% attacks, consensus algorithms… … …see, I told you.

It’s easy to get overwhelmed, because blockchain explanations can start to get tangential rather quickly. If you’re just starting to learn about “crypto”, then you’re probably just looking for a simple answer to a simple question. It’s a good thing that Mr. Gwei can temporarily set aside his unbounded enthusiasm about all that the blockchain makes possible and answer your simple question.

How Do Blockchains Work?

A blockchain is a record of transactions that is recorded by and agreed upon by multiple parties and then made unalterable via mathematics. Seriously, it’s as simple as that. You’re dismissed…

But… if you want… you can certainly hang around just a minute and we’ll unpack that simplistic answer just a little bit.

You don’t need the internet or even computers to have a blockchain. You and a friend could have a very simple blockchain with nothing more than two sheets of paper, some pens, and a little free time. See, a blockchain is just a distributed ledger of transactions.

  1. So you could pay your friend ten dollars, write that transaction down, and you’d be off to a good start.
    You’d have a ledger. A record of a transaction.
  2. Then, if your friend would just write down that transaction too, you’d already be halfway there.
    Because now you’d be distributed. See, two copies of identical ledgers.
  3. At this point you could agree that the single transaction is enough to make a “block”. In which case you’d simple need to apply a little math to the transaction and move on. The math step can be complicated, but it needn’t be too complicated in your simple case. You just need to reduce your transaction to a number that will help you check for any errors quickly and accurately, because you’re going to use that number to complete your blockchain.
    1. If you assigned yourself a number, say the number 5.
    2. And you assigned your friend another number, say number 7.
    3. And you assigned the grocery store another number, say 3.
    4. And then you put these together with your transacted amount, you might end up with a number like this: 10.57
    5. $10 transacted, from you (5) to your friend (7). As long as we agree and are consistent, this method would work fine in our simple case.
  4. Next transaction rolls along: your friend pays the grocery store fifteen dollars. You both record. You both follow the same plan for assigning a number to your transaction. You both end up with 15.73. Congratulations, you now have two transactions and two blocks.
  5. Here’s the fun part. You need to chain them. For simplicity, let’s say that you add your numbers to make a chain. So you add 10.57 + 15.73. You get 26.30. This number is recorded alongside your second block, and it is then used to chain your next block.
  6. You’re done. You have a distributed ledger of transactions that you can now be sure that your friend can’t simply edit at will without being quickly detected. Any attempts at editing a transaction towards the front of the ledger will necessarily change the block check number that you’ll compare at the end of every block.
  7. You can add another person to your network and they can follow along, too. You all will always be on the “same page”, and any bad actors or even legitimate accounting errors will be caught right away.

There you go. You can mull on that rudimentary scenario for a while and let the simplicity of the blockchain sink in.

Of course, the actual math involved is non-trivial. The whole system exudes mathematical complexity. If you can follow the logic here, then you’ll be well on your way for tackling real-world blockchain designs later… or, at the very least, you might be more comfortable buying in to something that you somewhat understand.

As always, if you want to get more academic about the topic, Wikipedia is your friend: Blockchain.