Quick Links

If you've been watching the news lately, you might have heard about something called a blockchain. It's a concept that makes data ultra-secure for specific uses. You've probably heard it in connection with Bitcoin, but it has applications far beyond everyone's favorite cryptocurrencies. Here's a quick explanation of how it works.

It All Begins with Encryption

Related: What Is Bitcoin, and How Does it Work?

To understand blockchains, you need to understand cryptography. The idea of cryptography is far older than computers: it merely means rearranging information in such a way that you need a specific key in order to understand it. The simple decoder ring toy you found in your box of Kix cereal is a form of the most basic cryptography---create a key (also known as a cipher) that replaces a letter with a number, run your message through the key, and then give the key to someone else. Anyone who finds the message without the key can't read it, unless it's "cracked." The military used more complex cryptography long before computers (the Enigma Machine encoded and decoded messages during World War II, for example).

Modern encryption, though, is entirely digital. Today's computers use methods of encryption that are so complex and so secure that it would be impossible to break them by simple math done by humans. Computer encryption technology isn't perfect, though; it can still be "cracked" if smart enough people attack the algorithm, and data is still vulnerable if someone aside from the owner finds the key. But even consumer-level encryption, like the AES 128-bit encryption that's now standard on the iPhone and Android, is enough to keep locked data away from the FBI.

The Blockchain Is a Collaborative, Secure Data Ledger

Encryption is normally used to lock files so they can only be accessed by specific people. But what if you have information that needs to be seen by everyone---like, say, the accounting information for a government agency that has to be public by law---and still needs to be secure? There, you have a problem: the more people that can see and edit information, the less secure it is.

Blockchains were developed to meet the security needs of these specific situations. In a blockchain, every time the information is accessed and updated, the change is recorded and verified, then sealed off by encryption, unable to be edited again. The set of changes are then saved and added to the total record. The next time someone makes changes, it starts all over again, preserving the information in a new "block" that's encrypted and attached to the previous block (hence "block chain"). This repeating process connects the very first version of the information set with the latest one, so everyone can see all the changes ever made, but can only contribute and edit the latest version.

This idea is sort of resistant to metaphors, but imagine you're in a group of ten people assembling a LEGO set. You can only add one piece at a time, and can't ever remove any pieces at all. Each member of the group must agree on specifically where the next piece goes. In this way, you can see all the pieces at any time---right back to the very first piece in the project---but you can only modify the latest piece.

For something a bit more relevant, imagine a collaborative document, like a spreadsheet on Google Docs or Office 365. Everyone who has access to the document can edit it, and every time they do, the change is saved and recorded as a new spreadsheet, then locked in the document history. So you can go back, step by step, through the changes made, but you can only add information to the latest version, not modify the past versions of the spreadsheet that have already been locked.

As you've probably heard, this idea of a secure, constantly-updated "ledger" is mostly being applied to financial data, where it makes the most sense. Distributed digital currencies like Bitcoin are the most common use of blockchains---in fact, the very first one was made for Bitcoin and the idea spread out from there.

The Technical Stuff: Step By Step, Block By Block

How does all of this actually play out on a computer? It's a combination of cryptography and peer-to-peer networking.

Related: How Does BitTorrent Work?

You might be familiar with peer-to-peer file sharing: services like BitTorrent that allow users to upload and download digital files from multiple locations more efficiently than from a single connection. Imagine the "files" as the core data in a blockchain, and the download process as the cryptography that keeps it updated and secure.

Or, to go back to our Google Docs example above: imagine that the collaborative document you're working on isn't stored on a server. Instead, it's on each individual's computer, which are constantly checking and updating each other to make sure that no one has modified the previous records. This makes it "decentralized".

That's the core idea behind the blockchain: it's cryptographic data that's continuously accessed and secured at the same time, without any centralized server or storage, with a record of changes that incorporates itself into each new version of the data.

So we have three elements to consider in this relationship. One, the network of peer-to-peer users that all store copies of the blockchain record. Two, the data that these users add to the latest "block" of information, allowing it to be updated and added to the total record. Three, the cryptological sequences that the users generate to agree on the latest block, locking it into place in the sequence of data that forms the record.

It's that last bit that's the secret sauce in the blockchain sandwich. Using digital cryptography, each user contributes their computer's power in order to help solve some of those super-complex math problems that keeps the record secure. These extremely complex solutions---known as a "hash"---resolve core parts of the data in the record, like which account added or subtracted money in an accounting ledger, and where that money went to or came from. The more dense the data, the more complex the cryptography, and the more processing power is needed to resolve it. (This is where the idea of "mining" in Bitcoin comes into play, by the way.)

So, to sum up, we can think of a blockchain is a piece of data that is:

  1. Constantly updated. Blockchain users can access the data at any time, and add information to the newest block.
  2. Distributed. Copies of the blockchain data are stored and secured by each user, and all must agree on new additions.
  3. Verified. Both changes to new blocks and copies of old blocks have to be agreed upon by all users through cryptographic verification.
  4. Secure. Tampering with the old data and altering the method of securing new data is prevented by both the cryptographic method and the non-centralized storage of the data itself.

And believe it or not, it gets even more complicated than this...but that's the basic idea.

The Blockchain in Action: Show Me the (Digital) Money!

So let's consider an example of how this applies to a cryptocurrency like Bitcoin. Say you have one Bitcoin and you want to spend it on a new car. (Or a bike, or a house, or a small-to-medium sized island nation---however much one Bitcoin is worth this week.) You connect to the decentralized Bitcoin blockchain with your software, and you send your request in to transfer your Bitcoin to the seller of the car. Your transaction is then transmitted to the system.

Every person on the system can see it, but your identity and the seller's identity are only temporary signatures, tiny elements of the huge math problems that form the heart of digital cryptography. These values are plugged into the blockchain equation, and the problem itself is "solved" by the members on the peer-to-peer network generating cryptography hashes.

Once the transaction is verified, one Bitcoin is moved from you to the seller and recorded onto the latest block in the chain. The block is finished, sealed and protected with cryptography. The next series of transactions begins, and the blockchain grows longer, containing a complete record of all transactions each time it's updated.

Now, when you think of a blockchain as "secure," it's important to understand the context. Individual transactions are secure, and the total record is secure, so long as the methods used to secure the cryptography remain "uncracked." (And remember, this stuff is really hard to break---even the FBI can't do it with mere computing resources alone.) But the weakest link in the blockchain is, well, you---the user.

If you allow someone else to use your personal key to access the chain, or if they find it by simply hacking into your computer, they can make additions to the blockchain with your information, and there's no way to stop them. That's how Bitcoin gets "stolen" in highly publicized attacks on major markets: it's the companies that were operating the markets, not the Bitcoin blockchain itself, that were compromised. And because the stolen Bitcoins are transferred to anonymous users, through a process that's verified by the blockchain and recorded forever, there's no way to find the attacker or retrieve the Bitcoin.

What Else Can Blockchains Do?

Blockchain technology started with Bitcoin, but it's such an important idea that it didn't stay there for long. A system that's constantly updated, accessible to anyone, verified by a non-centralized network, and incredibly secure, has a lot of different applications. Financial institutions like JP Morgan Chase and the Australian Stock Exchange are developing blockchain systems to secure and distribute financial data (for conventional money, not cryptocurrency like Bitcoin). The Bill & Melinda Gates foundation is hoping to use blockchain systems to provide free, distributed banking services to billions of people who can't afford a regular bank account.

Open source tools like Hyperledger are trying to make blockchain techniques available to a wider range of people, in some cases doing so without needing the monstrous amounts of processing power it takes to secure other designs. Collaborative working systems can be verified and recorded with blockchain techniques. Pretty much anything that needs to be constantly recorded, accessed, and updated can be used in the same way.

Image credit: posteriori/Shutterstock, Lewis Tse Pui Lung/ShutterstockZack Copley