What is the Blockchain?

 

One of the big terms that you hear in cryptocurrency is “the blockchain”. But what is the blockchain? What is it for? How does it work? How does everyone agree on what is included in the blockchain? Here, we answer these questions and more and take away the mystery of “the blockchain”.

What is the blockchain
 

What is the Purpose of the Blockchain?

All that the blockchain is a way for everyone in a cryptocurrency network to store the current state of the network. Cryptocurrencies are designed to be a way for people to exchange and store money without needing to rely on a central banking system. However, without a central bank, there needs to be some way to keep track of the amount of money in everyone’s account and who is sending money to whom. Otherwise, it would be impossible to buy anything with cryptocurrency since the merchant wouldn’t trust that you have the money and you’d have no way of sending money to a merchant.

The blockchain in cryptocurrency is designed to be a decentralized “ledger” recording every transaction that has ever occurred in the history of the cryptocurrency. This replaces a bank’s centralized ledger that keeps track of the amount of money that you have in your account and updates this information when you transfer money to and from your account by making deposits and withdrawals/purchases.

For a transaction to be recognized as valid by a merchant, it has to be published to the blockchain. Therefore, it is important that transactions be added quickly to avoid large delays on purchases. You don’t want to wait 1-3 days for your payment to process for a cup of coffee. The blockchain is designed to have its ledger updated quickly and regularly to include the latest transactions.

However, cryptocurrency is designed so that the blockchain is stored in a decentralized manner and secured so that no-one can modify transactions after they are added to the blockchain. Several methods of securing a blockchain exist, but they are too expensive to perform for each transaction. Doing so would be like requiring the president of every bank in the country to sign some paperwork each time any of their members used a credit card; it just won’t work.

Since the security measures used in blockchain work equally well for single transaction or a thousand, cryptocurrencies group transactions into blocks created at regular intervals and containing many transactions. This provides a reasonable tradeoff between the cryptocurrency’s needs for speed, efficiency, and security.
 

What Goes in a Block?

What goes in a block

Unsurprisingly, the blockchain consists of many blocks that are chained together. But what is a block in the blockchain? A block is a lot like a single page of a business’s account ledger. It includes all of the information for a set period of time and it is part of a larger collection that includes the complete picture of the business’s financial history. So, what exactly is included in a block in the blockchain? This varies based upon the cryptocurrency; however, there are a few things that are included in the blocks of most if not all existing cryptocurrencies.
 
  • Transaction Record

he purpose of the blockchain is to store transaction information in a way that makes it difficult for anyone to modify blocks. So, it makes sense that the most important contents of a block are a record of the transactions that have occurred since the previous block. While different cryptocurrencies store different types of data and secure it in different ways, their blocks always include a section for the data to be stored on the blockchain.

  • Timestamp

The exact time a block is created is useful for several reasons. One example is organizing a copy of the blockchain from blocks received independently. Since some blockchains have a quick block time, it’s possible that you may receive blocks out of order and need to organize them.

Another reason is that many cryptocurrencies are designed to create a block at regular intervals. In many cases, this is enforced by creating a puzzle with a difficulty set so that it takes the entire network the desired amount of time to solve the puzzle. As the network grows, the difficulty needs to be adjusted and the best way to determine when this occurs is to check how quickly the network is solving each puzzle (which is the difference in timestamps between two blocks).

  • Miner Identifier

One of the main principles of blockchain is decentralization. No one person should have control of the blockchain, which means that no-one officially adds blocks to the blockchain. However, if everyone decided on their own what the next block contains, the blockchain would be in chaos, with no-one’s ledge matching anyone else’s.

To maintain decentralization, cryptocurrencies include a process to select the person who will create the next block. Since this process involves that person doing work (at a minimum collecting all transactions, creating the block, and sending it out), they get paid to do it. A block includes an identifier for this person both to say who created the block (in case they did a bad job of it or did it when they weren’t supposed to) and to make sure that the correct person gets paid for doing so.

  • Previous Block Hash ​

Each block in the blockchain contains the hash of the previous block in the chain. Here, a hash means the output of a mathematical function with a few useful properties:

  1. It’s not possible to determine the input from the output (unless you’re willing to try each possible input until you get lucky)
  2. It can take an input of any size and create an output of a fixed size
  3. Similar inputs create very different outputs
  4. The same output can be created by many different inputs
  5. It’s nearly impossible to find two inputs that will produce the same output

This may sound complicated but you don’t need to understand the details of hash functions to understand blockchain. The most important part of this is the last point: “It’s nearly impossible to find two inputs that will produce the same output”. Even if you have the output of a hash function for a block, you can’t find another input that produces the same output without doing a lot of work.

And by a lot of work, we’re saying that it will take the Bitcoin network (which is huge) several times the life of the universe to calculate two hashes with the same output. And that doesn’t guarantee that they’re the output of the hash for the block that you care about or even that they’re the hash for a block on the blockchain. In other words, as long as hash functions remain secure, you’re never going to be able to find two inputs that produce the same hash output. The reason that this is important and that the previous block’s hash is included in the block is related to the “chain” part of “blockchain”. We’ll get to that in the “How are the Blocks “Chained” section.

  • Digital Signature

Any legal or official document will include a signature or a stamp saying that someone important verifies the authenticity and correctness of the information included in it. If you believe that the signature is genuine, you can be certain that the document is official and genuine as well. Since each block of the blockchain contains several transactions of real money, it’s not surprising that everyone wants some verification that the supposed author of the block actually created it and that nothing has been modified. Since blocks are digital, a handwritten signature isn’t really an option, so the blockchain includes digital signatures. All you really need to know about digital signatures is the following:

  1. It’s easy to verify the authenticity of the signature
  2. It’s very difficult to impossible to modify the data included in a signed block without invalidating the signature

Basically, a digitally signed block was actually created by the person it claims and hasn’t been messed with since and you can easily verify this.
 

How are the Blocks “Chained”?

3. How are the blocks chained.jpg

Since we’ve talked about the blockchain being a chain of blocks and what is included in a block, the next logical questions are “How are blocks chained?” and “Why is chaining necessary?” Blocks are chained together using the hash function described briefly in the previous section. We determined there that no-one could find a way to find two inputs that create the same hash output. This means that including the hash of the previous block in the blockchain in a block guarantees that the block was created to follow that block and verifies the authenticity of that block. It’s highly unlikely that anyone could create another block that produces the same hash, so these two blocks are “chained” together. 

Following this logic, that block contains the hash of the previous block, which contains the hash of the block before that and so on. This allows anyone with a copy of the blockchain to verify each link in the chain up to the first or genesis block. This block is created by the inventor of the cryptocurrency and is usually designed to be easily verifiable by containing a given phrase, etc. This means that anyone can take a supposed copy of the blockchain and verify every link in the chain from the most recent block to the original block.

This is the reason that blocks are chained together in the blockchain rather than distributed as independent chunks of the ledger. The blockchain is intended to be decentralized and not require trust between any of the members of its network. If every block was independent, a forger only needs to successfully forge a single block to convince someone of a fake transaction happening or a real transaction not happening. With chained blocks, an attacker needs to forge a plausible, complete blockchain, which is much more difficult.

 

Who Stores the Blockchain?

We’ve talked about how the blockchain is a decentralized ledger for all of the transactions in a network. This means that we can’t rely on a central repository (like a bank) to hold the official record of the blockchain. So who does store it?

Anyone who wants to can store a copy of the blockchain. Since it’s easy to verify, many nodes don’t bother saving an entire copy and instead only store a set of the most recent blocks. As long as one node in the network has a complete copy, anyone can request it and verify its authenticity and the authenticity of any chunk. However, a single node with a complete copy means a single point of failure, so networks should have multiple storage locations to provide robustness and high download speeds (since it’s quicker to download from a local repository than one halfway around the globe).

 

How is the Blockchain Updated?

The blockchain is decentralized and distributed, meaning there is no central organization to add blocks and send out official updates to anyone interested. So how is the blockchain updated? We discussed previously that each block is created by someone chosen from among the community to create that block. Several processes exist for choosing this person, for a description of two of the most widely-used, see Proof of Stake (POW) and Proof Os Stake (POS). Once a block creator is chosen, they define the authoritative version of the block and sign it so that everyone knows that it is the correct version.

But how does the block creator know which transactions to include in a block? The list of transactions gets to each node via a peer-to-peer network where nodes communicate with their neighbors. Eventually, each transaction will make it to the entire network, like a Facebook post that goes viral from people sharing it with their friends, who share with their friends, etc. This means that the block creator should have the full list of transactions when they’re preparing to create a block.

The transactions that are included in a block depend on the cryptocurrency and possibly the decisions of the block creator. For example, in Bitcoin a person paying someone using Bitcoin can include a transaction fee. This transaction fee goes to the block creator and is essentially a bribe to encourage them to include the transaction in the next block. Since Bitcoin can only fit a certain number of transactions into a block, blocks usually contain those transactions that included the highest transaction fees. Other cryptocurrencies may require all transactions created since the last block to be included or the next N transactions ordered chronologically be included in a block.

Once a block has been created, it is spread through the same peer-to-peer network as transactions. This allows the entire network to stay up-to-date on the state of the ledger without requiring dedicated infrastructure for distributing the information.

 

How Can I Get Involved?

Everyone involved in a cryptocurrency is involved with modifying the blockchain in some way. If you’re interested in investing in cryptocurrency, you’re changing the state of the blockchain by purchasing and selling cryptocurrency. See "How to get cryptocurrencyif you want more information on how to get started purchasing cryptocurrency.

If you want to take a more active role (and make some money), you might want to look into participating in cryptocurrency mining. For more information on the basics of cryptocurrency mining, check out "Cryptocurrency mining. For details on mining a specific cryptocurrency, check out its website.

If you want to really support a cryptocurrency, consider hosting a node to preserve a full or partial copy of the blockchain. For more information on how to do this, visit the website of the specific cryptocurrency whose blockchain you want to copy.