Home

What Is a Blockchain, and How Does It Work?

|
Updated:  
2023-07-24 14:52:51
|
Investing in Cryptocurrency For Dummies
Explore Book
Buy On Amazon
Simply put, a blockchain is a special kind of database. According to cigionline.org, the term blockchain refers to the whole network of distributed ledger technologies. According to Oxford Dictionaries, a ledger is “a book or other collection of financial accounts of a particular type.” It can be a computer file that records transactions. A ledger is actually the foundation of accounting and is as old as writing and money.

Now imagine a whole suite of incorruptible digital ledgers of economic transactions that can be programmed to record and track not only financial transactions but also virtually everything of value. The blockchain can track things like medical records, land titles, and even voting. It’s a shared, distributed, and immutable ledger that records the history of transactions starting with transaction number one. It establishes trust, accountability, and transparency.

Blockchain stores information in batches called blocks. These blocks are linked together in a sequential way to form a continuous line. A chain of blocks. A blockchain. Each block is like a page of a ledger or a record book.

As you can see in the figure, each block mainly has three elements:
  • Data: The type of data depends on what the blockchain is being used for. In Bitcoin, for example, a block’s data contains the details about the transaction including sender, receiver, number of coins, and so on.
  • Hash: No, I’m not talking about that kind of hash. A hash in blockchain is something like a fingerprint or signature. It identifies a block and all its content, and it’s always unique.
  • Hash of previous block: This piece is precisely what makes a blockchain! Because each block carries the information of the previous block, the chain becomes very secure.
Elements of blockchain Three main elements of a block

Here’s an example of how a bunch of blocks come together in a blockchain. Say you have three blocks.

Block 1 contains this stuff:

  • Data: 10 Bitcoins from Fred to Jack
  • Hash (simplified): 12A
  • Previous hash (simplified): 000
Block 2 contains this stuff:
  • Data: 5 Bitcoins from Jack to Mary
  • Hash (simplified): 3B4
  • Previous hash: 12A
Block 3 contains this stuff:
  • Data: 4 Bitcoins from Mary to Sally
  • Hash (simplified): C74
  • Previous hash: 3B4
As you can see in the following figure, each block has its own hash and a hash of the previous block. So, block 3 points to block 2, and block 2 points to block 1. (Note: The first block is a bit special because it can’t point to a previous block. This block is the genesis block.)

How blockchain works Simplified version of how a blockchain works

The hashes and the data are unique to each block, but they can still be tampered with. The following section lays out some ways blockchains secure themselves.

How does a blockchain secure itself?

Interfering with a block on the blockchain is almost impossible to do. The first way a blockchain secures itself is by hashing. Tampering with a block within a blockchain causes the hash of the block to change. That change makes the following block, which originally pointed to the first block’s hash, invalid. In fact, changing a single block makes all the following blocks invalid. This setup gives the blockchain a level of security.

Using hashing isn’t enough to prevent tampering. That’s because computers these days are super fast, and they can calculate hundreds of thousands of hashes per second. Technically, a hacker can change the hash of a specific block and then calculate and change all the hashes of the following blocks in order to hide the tampering.

On top of the hashes, blockchains have additional security steps including things like proof-of-work and peer-to-peer distribution. A proof-of-work (PoW) is a mechanism that slows down the creation of the blocks. In Bitcoin’s case, for example, it takes about ten minutes to calculate the required PoW and add a new block to the chain. This timeline makes tampering with a block super difficult because if you interfere with one block, you need to interfere with all the following blocks. A blockchain like Bitcoin contains hundreds of thousands of blocks, so successfully manipulating it can take over ten years!

A third way blockchains secure themselves is by being distributed. Blockchains don’t use a central entity to manage the chain. Instead, they use a peer-to-peer (P2P) network. In public blockchains like Bitcoin, everyone is allowed to join. Each member of the network is called a validator or a node. When someone joins the network, they get the full copy of the blockchain. This way, the node can verify that everything is still in order.

Here’s what happens when someone creates a new block in the network:

  1. The new block is sent to everyone in the network.
  2. Each node then verifies the block and makes sure it hasn’t been tampered with.
  3. If everything checks out, each node adds this new block to their own blockchain.
All the nodes in this process create a consensus. They agree about which blocks are valid and which ones aren’t. The other nodes in the network reject blocks that are tampered with.

So, to successfully mess with a block on a blockchain, you’d need to tamper with all the blocks on the chain, redo the proof-of-work for each block, and take control of the peer-to-peer network!

Blockchains are also constantly evolving. One of the most recent developments in the cryptocurrency ecosystem is the addition of something called a smart contract. A smart contract is a digital computer program stored inside a blockchain. It can directly control the transfer of cryptocurrencies or other digital assets based on certain conditions.

Why is blockchain revolutionary?

Here are three main reasons blockchain is different from other kinds of database and tracking systems already in use.

Blockchain may eliminate data tampering because of the way it tracks and stores data

If you make a change to the information recorded in one particular block of a blockchain, you don’t rewrite it. Instead the change is stored in a new block. Therefore, you can’t rewrite history — no one can — because that new block shows the change as well as the date and the time of the change. This approach is actually based on a century-old method of the general financial ledger.

Suppose that Joe and his cousin Matt have a dispute over who owns the furniture shop they’ve been comanaging for years. Because the blockchain technology uses the ledger method, the ledger should have an entry showing that P.J. first owned the shop in 1947. When P.J. sold the shop to Mary in 1976, they made a new entry in the ledger, and so on. Every change of ownership of this shop is represented by a new entry in the ledger, right up until Matt bought it from his uncle in 2009. By going through the history in the ledger, Matt can show that he is in fact the current owner.

Now, here’s how blockchain would approach this dispute differently than the age-old ledger method. The traditional ledger method uses a book, or a database file stored in a single (centralized) system. However, blockchain was designed to be decentralized and distributed across a large network of computers. This decentralizing of information reduces the ability for data tampering.

Recent blockchain attacks such as the one on ZenCash show that data tampering can’t be completely eliminated on the blockchain database as is. If 51 percent of miners decide to rewrite the ledger, it would be possible, and as a result, they can do whatever they want with the transaction: they can delay it, double-spend the coins, postpone it, or simply remove it from the block. Several blockchain networks are currently working on a custom solution for this.

Blockchain creates trust in the data

The unique way blockchain works creates trust in the data. I get more into the specifics earlier in this chapter, but here’s a simplified version to show you why. Before a block can be added to the chain, a few things have to happen:
  1. A cryptographic puzzle must be solved to create the new block.
  2. The computer that solves the puzzle shares the solution with all the other computers in the network.
  3. Finally, all the computers involved in the network verify the proof-of-work. If 51 percent of the network testifies that the PoW was correct, the new block is added to the chain.
The combination of these complex math puzzles and verification by many computers ensures that users can trust each and every block on the chain. Heck, one of the main reasons I’m a big supporter of cryptocurrencies is that I trust in the blockchain technology so much. Because the network does the trust-building for you, you now have the opportunity to interact with your data in real time.

Centralized third parties aren’t necessary

In my previous example of the dispute between Joe and Matt, each of the cousins may have hired a lawyer or a trusted centralized third party to go through the ledger and the documentation of the shop ownership. They trust the lawyers to keep the financial information and the documentation confidential. The third-party lawyers try to build trust between their clients and verify that Matt is indeed the rightful owner of the shop.

The problem with centralized third parties and intermediaries such as lawyers and banks is that they add an extra step to resolving the dispute, resulting in spending more time and money.

If Matt’s ownership information had been stored in a blockchain, he would’ve been able to cut out the centralized middleman, his lawyer. That’s because all blocks added to the chain would’ve been verified to be true and couldn’t be tampered with. In other words, the blockchain network and the miners are now the third party, which makes the process faster and more affordable. So, Matt could simply show Joe his ownership information secured on the blockchain. He would save a ton of money and time by cutting out the centralized middleman.

This type of trusted, peer-to-peer interaction with data can revolutionize the way people access, verify, and transact with one another. And because blockchain is a type of technology and not a single network, it can be implemented in many different ways.

About This Article

This article is from the book: 

About the book author:

Kiana Danial is an award-winning, internationally recognized personal investing and wealth management expert. She delivers workshops and seminars to corporations, universities, and entrepreneurial groups.