Blockchain for Smart Communities & Infrastructure

This is the fourth in a series of blogs dedicated to discussing the future of smart communities and infrastructure in our modern society.

Unless you live in a cave or under a rock, you have likely heard of a form of cryptocurrency called Bitcoin (BTC). Or perhaps you have read about other alternative cryptocurrencies (altcoins) such as Ethereum (ETH) or Dogecoin (DOGE). However, you might not know is that these currencies are built on a technology known as blockchain. Even if you are aware of blockchain, you might not grasp the immense importance of blockchain technology in the security of information storage and information movement. In other words, blockchain has many applications well beyond cryptocurrency. For example, smart cities can use blockchain technology to exchange data between network participants at a high degree of trust and transparency without requiring a central administrator. Smart cities have a wide range of stakeholders, and the exchange of data among them is essential within a shared urban infrastructure.

In this blog, I will use cryptocurrency to explain blockchain technology; however, before I do that, I need to tease out the difference between hashing and encryption in cryptography. It’s important to understand the subtle but profound differences between the two.

The ‘key’ is the difference

At a higher level, the difference is actually quite simple. Encryption is a reversible mathematical process. Hashing is not and instead is a one-way mathematical process. We could leave it at that, but we would not do justice to the subject. Both encryption and hashing utilize a secret code called a cipher (also known as a cypher), although for different reasons. Ciphers are, in essence, a mathematical process that converts cleartext data into cryptographic data. One of the main differences with encryption is that in order to provide a reversible function we require another element commonly referred to as the key. When using a symmetric key, both the encrypting and decrypting parties share the same key. Instead of using a single shared key, asymmetric encryption methods use a pair of keys such as the well-known Public Key Infrastructure (PKI).

Encryption vpn gateway or secure web proxy

Figure 1 - Encryption

Figure 1 depicts two use cases for encryption of content. You can see a virtual private networking (VPN) use case that protects data in motion. Note the usage of the key to provide for both encryption and decryption of the content. Also, note that the PC will use its own private key (in the case of PKI) to encrypt the data which the VPN gateway would use the PC’s public key to decrypt the content, hence the term asymmetric keys. Note also that the PC could have an encrypted disk which provides for the protection of data at rest. A symmetric key is used internally within the system to provide access to the data storage in the clear.

But this blog is not about encryption and instead is more so about hashing. While encryption can provide data privacy, it cannot provide assurance of data integrity. That is where hashing comes in. Hashing uses a one-way cipher to create a standard-length cryptographic string. I mention the standard length because the string is always the same length regardless of the length or volume of the content.

Hashing file service hash of file set secure file set

Figure 2 - Hashing

Figure 2 illustrates the use case of hashing. In this instance, we have a file server that is providing data as a secure file set. The server will run a standard hashing algorithm such as SHA-256 and generate a hash string that represents the data. The user PC downloads both the file set as well as the hash string. Using the same algorithm, the user PC can validate that the content has not been altered, and as a result, the integrity of the data is assured. There are many other uses for hashing, such as digital signing to provide for the integrity of origin.

Keep in mind that encryption and hashing are not mutually exclusive. As a simple example, the user downloading the file and hash string could be using an encrypted VPN tunnel and store the downloaded code on the encrypted drive. The hashing provides the integrity of the data and its signing. Encryption provides for the protection of the data in transit as well as in storage. Wi-Fi communications also use both encryption and hashing. The payload of 802.11 data frames can be encrypted by a transmitting radio and decrypted by the receiver. Additionally, multiple data integrity hash capabilities are used for Wi-Fi transmissions to ensure the data is not altered in while in transit.

Blockchain

Blockchain is essentially an evolved form of hashing. In simple terms, it is a content ledger system that can be either closed or open. Blockchain is not a new technology and has been around since the mid to late 1990s, with Bitcoin only coming into existence in 2009. Blockchain is based on the concept of a distributed ledger, available to all parties in a given system. The ledger entries are known as blocks, and transactions are linked together by the chain, hence the technologies title. The integrity of the blocks and chains is assured by the use of hashing, typically SHA-256. As a result, the chain becomes immutable. Money is the most accessible way to understand a blockchain ledger system. However, this article is not about cryptocurrencies.

Figure 3 shows an example of a closed or centralized ledger environment. Note that there is a central authority for the control and management of the ledger. In this case, it could be a bank. We have five parties in the example. Starting with ‘A’, we see the allocation of ten dollars. In turn, ‘A’ then gives five dollars to ‘B’ and so forth with different subsets of amounts to ‘C’ and ‘D’. All of this syncs with the ledger. But as ‘A’ attempts to send fifteen dollars to ‘E’, the ledger triggers it as an invalid transaction. Note that the central authority is the one that denies the transaction.

Blockchain Centralized Ledger

Figure 3 - Blockchain centralized ledger

Most cryptocurrency utilizes an open ledger system due to the need for scale and independence. All parties hold the last updated copy of the ledger. Due to the immutability of the blocks and chains, any modification attempt will result in a calculation error. These key nodes are referred to as bit miners. The bit miners validate where the modification occurred and whether it should be allowed into the ledger. Various parties will ‘vote’ according to their latest ledger entries. This distributed participation establishes the reputation within the chain ecosystem. In the example of Figure 4, transactions are validated by these voting methods to synchronize the ledger so that all parties can agree. Notice that the transactions are validated without a central manager; however, it comes at the cost of computation.

Bit miners ledger synchronization

Figure 4 – Bit Miners

So how can we use blockchain in smart cities and their underlying infrastructure? Although open ledger systems support a cryptocurrency economy, blockchain in smart infrastructure generally requires closed ledger environments, particularly for critical systems. For example, the use of blockchain to continually validate voltage usage measurements at various points within the power grid. Or the condition of water levels at a reservoir.

Critical data needs to have two things. First, the data requires a digital signing for a root of origin to the chain. Second, the data points need to be assured by the use of a hash of the content. Figure 5 depicts a close-up of the structure of a block as well as a chain sequence. Note how the open (non-hashed) data is embedded within the block. The initial block is generated by signing a unique starting sequence to the hash. Each hash sequence in the chain is then mathematically linked to the nonce value and the ledger contents. They must match the starting sequence. By using these sequenced calculations, any changes to the chain are automatically detected. In some cases, such as a detected identity modification, the chain might be made invalid altogether.

 Blockchaining self validating chain of entries

Figure 5 - Blockchaining

A chain of custody is created by linking the chain to the digital signing of the participating systems or parties. Figure 5 illustrates that as the data moves through different systems, the content of the ledger is updated with the generation of a new hash as well as a signing of the block within the chain. This creates a blockchain environment that assures data integrity, the root of origin of the data, and the data history. Blockchain establishes a chain of custody that becomes immutable, which means that it cannot be changed or modified in any way. Only added to.

There are numerous use cases for blockchain in smart cities. For example, the availability of more user-friendly services is one of the expected benefits of smart cities. One of the services is mobility as a service (MaaS), which seamlessly links multiple transportation systems. There is a push to use blockchain to make MaaS a reality. It may be possible to use blockchain technology to provide the public and the waste collection service with real-time information about containers so that they are always informed of their status. As previously mentioned, blockchain provides assurance of the data integrity of critical infrastructure systems such as electrical grids and water resource management.

Blockchain-based smart contracts might be used to trade surplus electricity automatically between solar-powered homes and other grid members. These smart contracts allow multiple signing parties to agree on the legal text within the ledger and sign appropriately within the chain. A smart contract becomes immutable, and all parties can refer to it at any time in the future. This is a less intuitive way of using the technology: on recording history. By putting events into the chain, the story becomes immutable. It can’t be rewritten.

Another example is its value in supply chain management. A product is signed into the chain, allowing for consistency, and tracking as it moves from the source through the distribution and is eventually available to the consumer. Using blockchain for supply chain management applies to any type of product, including food perishables, to ensure the chain of custody and holding time, thus indicating freshness. And, of course, blockchain can also be used in the code development process to ensure the integrity of the code as it moves between engineering teams before it becomes a software product.

There are many more uses for blockchain technologies, just as there are many more types of blockchains; I have only covered just a few of them in this blog. But by now, it should be evident that encryption, hashing, and blockchain technologies can work hand in hand in providing protection, integrity, and chain of custody for our data. As we move forward into a digitally transformed society, these technologies can assist us in moving, storing, and using data in smart communities and infrastructure.