Blockchain Technology

There are many blockchains, but they all share similar features. This lesson will introduce key blockchain technologies and provide example use cases.

Blockchain

Learning Objectives

By the end of this lesson, you will be able to identify

  • identify blockchain components,
  • list blockchain use cases,
  • create a simple blockchain manually.

Video Walkthrough

Use this video to follow along with the steps in this lab.

Blockchain Components

Blockchains are data structures that hold transactions. There is no single blockchain. The most famous blockchain is the Bitcoin blockchain which contains the record of all Bitcoin transactions. Blockchain technology itself can be used for much more than cryptocurrency. Most (but not all) blockchains share the following characteristics.

  • Decentralization. Traditional databases are maintained by one entity. Your bank has a private database where it stores its transactions. If a Bank of America customer sends funds to a Chase Bank customer, both banks record the transactions in their private databases. Blockchains are decentralized in which each participant (i.e., node) has a copy of the entire blockchain. The data and control of the system are decentralized. Tomorrow, Bank of America could lock your funds because it has centralized authority over its database. With blockchain technology, no one entity can control the entire blockchain.
  • Immutability. Data cannot be modified or deleted once it has been recorded in a blockchain. Immutability is good for data integrity, but not so great if something embarrassing or illicit makes it into the blockchain.
  • Transparency. Data on public blockchains are visible to all participants. If a government put all of its transactions on the blockchain, citizens would know down to the penny how every dollar was spent.
  • Consensus. Blockchain nodes (i.e., computers on the network) must agree that a transaction is valid before the transaction is processed. Consensus mechanisms help maintain blockchain integrity.

Blockchain Use Cases

  • Cryptocurrency. There are thousands of cryptocurrencies that use blockchain technology. Bitcoin is the most popular.
  • Digital goods. With blockchains, the ownership of digital goods can be tracked. Gamers might buy in-game items and later sell those items on a blockchain without going through an intermediary, such as the game publisher. You can also spend ridiculous sums of money on pictures of apes hoping that somebody dumber will buy it from you for more money.
  • Real estate. You get a title when you buy a house. Typically, you have to purchase title insurance just in case somebody else has a claim on your property. It sounds weird that somebody could show up with a title from 1894 that says they own your property, but it can happen. If real estate transactions were stored on a blockchain, title insurance and any ambiguity about ownership would be erased.
  • Voting. At some point, a blockchain could be invented that could guarantee both data integrity and privacy for voting records.
  • Supply chain management. Physical and digital goods could be tracked using blockchain technology.

Blockchain technology may solve many problems in the future. But not every blockchain is appropriate for every use case. For example, you may not want your hotel reservations distributed publicly in an open ledger. In many cases, traditional databases work just fine.

A Simple Blockchain

In a blockchain, transactions are linked using hashing. A transaction is hashed, and that hash is used when calculating the next transaction's hash. These transactions are chained together through the use of hashing.

In this section, you will create several linked transaction chains. The blockchain technology used in modern blockchains is more complicated, but this example will demonstrate the concept of chaining. We'll use SHA2-256 for hashing.

  • We can create a "genesis" transaction that starts the chain. It has no previous transactions, so the PreviousTransactionHash would be 0. The transaction only contains the word "Genesis", so we'll calculate the SHA2-256 hash of 0Genesis--the previous hash and the current transaction--and get bae6de9a161f184ecae0c5ea185fbe18bcf2694a0e40de32f66e0f84d283836b.
Transaction
    Timestamp: 2030-07-15T17:08:00+0000
    Transaction: 'Genesis'
    PreviousTransactionHash: 0
    ThisTransactionHash: bae6de9a161f184ecae0c5ea185fbe18bcf2694a0e40de32f66e0f84d283836b
Transaction
    Timestamp: 2030-07-15T17:08:23+0000
    Transaction: 'From: Alice; To: Bob; Amount: $500'
    PreviousTransactionHash: bae6de9a161f184ecae0c5ea185fbe18bcf2694a0e40de32f66e0f84d283836b
    ThisTransactionHash: 8d1fd03e9ceb9f278bb6ca0c276123eddb69c8a80e88a6fadccf8752c37602dc
Transaction:
    Timestamp: 2030-07-15T17:08:28+0000
    Transaction: 'From: Bob; To: Eve; Amount: $10'
    PreviousTransactionHash: 8d1fd03e9ceb9f278bb6ca0c276123eddb69c8a80e88a6fadccf8752c37602dc
    ThisTransactionHash: f691facec68c72c1fd19fc10222286aaa75c662049f4c76c21203832b94e7a24

Using the previous transaction's hash to calculate the new transaction's hash is what creates the chain in the blockchain. Now, if somebody wanted to tamper with the data in the transactions (e.g., manipulate the data to show that Alice sent Bob $888 instead of $500), that specific transaction could be updated and re-hashed. But, all of the later transactions linked to that transaction would have errors because they relied on the original transaction hash. The network of computers storing the blockchain would notice the errors and reject the changes.

Consensus

Before these blocks are officially recorded in the blockchain, a consensus mechanism would be carried out by several nodes on the network to confirm the transactions' validity. Nodes are just computers running software that implements the particular blockchain's protocol. There are many different consensus mechanisms, including Proof of Work (PoW) used in Bitcoin, or Proof of Stake (PoS) used in the modern Ethereum network. The PoW consensus algorithm is more compute intensive and many have raised concerns about the wasted energy resources that this mechanism necessitates.

Nodes

Summary

Blockchain technology allows records to be stored in a way that the records can be confirmed cryptographically. There are many different blockchains, each with different data structures and features.

Reflection

  • Will all data eventually be stored on blockchains?
  • What use cases for blockchain technology can you think of?

Key Terms

  • Blockchain: A distributed ledger technology that records transactions across multiple computers in a way that ensures the data is secure, transparent, and tamper-proof. Each block contains a list of transactions and is linked to the previous block, forming a chain.
  • Blockchain Decentralization: The distribution of control and decision-making across a network of nodes rather than being centralized in a single entity. This ensures that no single point of failure exists and enhances the security and resilience of the blockchain.
  • Blockchain Immutability: The characteristic of a blockchain that ensures once data is recorded in a block, it cannot be altered or deleted. This is achieved through cryptographic hashing and the linking of blocks, making the blockchain a reliable and permanent record of transactions.
  • Blockchain Transparency: The property of a blockchain that allows all participants to view and verify the transactions recorded on the ledger. This openness fosters trust and accountability among users, as all actions are visible and traceable.
  • Blockchain Consensus: The mechanism by which nodes in a blockchain network agree on the validity of transactions and the state of the ledger. Common consensus algorithms include Proof of Work (PoW), Proof of Stake (PoS), and Practical Byzantine Fault Tolerance (PBFT).
  • Cryptocurrency: A digital or virtual currency that uses cryptography for security and operates on a blockchain. Cryptocurrencies are decentralized and typically not controlled by any central authority, making them resistant to censorship and fraud. Examples include Bitcoin, Ethereum, and Litecoin.