I’ve been studying blockchain via an online Udacity course. It’s nothing short of revolutionary. When people say blockchain, most people think of Bitcoin, the popular cryptocurrency that has real value. However, blockchain is more than just cryptocurrency. It’s an entire platform that allows users to develop all new software tools not even remotely related to what exists today. I hope that this blog posting gives you a basic understanding of what exactly blockchain is and how it can be applied to industries such as Heating, Ventilation, and Air-Conditioning (HVAC) and the built environment.
Think of the blockchain as a type of shared database that differs from a typical database in the way that it stores information: typical databases are usually hosted on a company’s server (or user’s cloud account) and is managed and owned by that user. Blockchains store data in blocks that are then linked together via cryptography, and they are 100% public. Most importantly, they can be downloaded by anyone (which I’ve done to my computer). The Bitcoin blockchain stores every single Bitcoin transaction ever completed since 2009. Amazingly, all the user information associated with the Bitcoin transaction stored on the blockchain is anonymous, so they cannot be traced back to individual users (most of the time).
Here’s a good (but busy) graphic that shows an entire Bitcoin transaction on the blockchain:
Another way to look at blockchain is that it is a back-linked, decentralized and distributed-database of encrypted records. Let me simplify this definition a bit:
- It’s a data structure where each block is linked to another block in a time-stamped chronological order
- It’s an append-only transactional database, not a replacement to the conventional databases
- Every node keeps a copy of all the transactions happened in the past which are secured cryptographically. Hence, almost impossible to hack.
- All information once stored on the ledger is verifiable and auditable but not editable
- Highly fault tolerant as there is no single-point-of-failure
- Decentralized blockchains are immutable, which means that the data entered is irreversible and cannot be changed
Ethereum
While the blockchain for Bitcoin solely keeps track of every single Bitcoin transaction that has ever occurred since 2009, there are many other blockchains that focus on other domains. One popular example is Ethereum. Ethereum is a cryptocurrency with real value like Bitcoin. However, it is also a blockchain “virtual machine” that runs “smart contracts”. Smart contracts are simple software programs hosted by the Ethereum blockchain that can perform any number of functions. These simple software programs are programmed in a software language called “Solidity”. A good analogy to smart contracts is the Internet and websites. The Ethereum blockchain is the “Internet” and smart contracts are “websites” that are enabled by the Internet.
The Ethereum blockchain has millions of transactions. These transactions are grouped into “blocks.” A block contains a series of transactions, and each block is chained together with its previous block. Think of it as an encrypted linked list. That’s why it is called “blockchain”.
To cause a transition from one state to the next, a transaction must be valid. For a transaction to be considered valid, it must go through a validation process known as mining. Mining is when a group of nodes, or computers, create a block of valid transactions.
For a block to be added to the Ethereum blockchain, the miner must prove that it is faster than other competitor miners. The process of validating each block by having a miner provide a mathematical proof is known as a “proof of work.”
Any node on the network that is a miner can attempt to create and validate a block. Many miners from around the world try to create and validate blocks at the same time. Each miner provides a mathematical proof when submitting a block to the blockchain, and this proof acts as a guarantee: if the proof exists, the block must be valid.
A miner who validates a new block is rewarded for doing this work. Therefore, it costs Ether (or cryptocurrency) any time a new transaction is created on the Ethereum blockchain. The name of this compensation is called “gas”. Gas is the unit used to measure the fees required for a transaction. Gas price is the amount of Ether you are willing to spend on every unit of gas. It is measured in “Wei.” “Wei” is the smallest unit of Ether, where 1⁰¹⁸ Wei represents 1 Ether.
Ethereum blockchain is also cryptographically secure with a shared state. This means the following:
- Cryptographically secure means that the creation of digital currency is secured by complex mathematical algorithms that are very hard to break.
- Shared-state means that the state stored on the blockchain is shared and open to everyone.
Smart contracts provide the following benefits:
- Transparency: Allows users to have more confidence in goods purchased. It forces companies to make decisions that favor the consumer.
- Traceability: Follows where it came from
- Efficiency: Automates some types of transactions and handles back and forth that companies may normally go through. Also, give companies access to a shared database to help verify accuracy of records.
As I mentioned before, what’s unique about Ethereum is that it allows for smart contracts. These are software programs (written in a software language called Solidity) committed to the blockchain where the code and conditions in the contract are publicly available on the ledger. When an event outlined in the contract is triggered, like an expiration date, the code executes. The great thing about the blockchain is that every transaction gets updated on every node that hosts the blockchain, so it keeps everyone involved with the contract accountable for their actions. It takes away bad behavior by making every action taken visible to the entire network.
So, what are use cases for blockchain above and beyond just developing a website to perform that same functionality? The most obvious use case is cryptocurrencies: allowing anyone to download the entire blockchain and view all cryptocurrency transactions.
However, there are many other use cases other than those dealing with cryptocurrencies: basically, anything that requires public validation and exposure, like real estate transactions, intellectual property, voting, supply chain, and associated societal transactions.
Let’s look at a supply chain example: coffee production. There are many actors and actions that take place in the lifecycle of coffee production and consumption. The following image is a unified model language (UML) diagram that illustrates the actors and actions that take place.
Example of 4 actors in a coffee supply chain are:
- Farmer: The Farmer can harvest coffee beans, process coffee beans, pack coffee palettes, add coffee palettes, ship coffee palettes, and track authenticity.
- Distributor: The Distributor can buy coffee palettes and track authenticity.
- Retailer: The Retailer can receive coffee palettes and track authenticity.
- Consumer: The Consumer can buy coffee palettes and track authenticity.
Below is a UML sequence diagram that shows the actions between the various stakeholders:
The blockchain is a good mechanism to keep track of the life cycle of the coffee bean, especially for those consumers that want to know where it was sourced from and what the journey was all the way to their cup of coffee.
Solidity
Below is a screenshot of the solidity code in Visual Studio Code that helps keep track of the entire coffee bean life cycle.
The above screen shot shows blockchain source code written in the Solidity programming language specific to developing Ethereum smart contracts. It is an object-oriented, high-level language for implementing smart contracts. It is influenced by C++, Python and JavaScript, and is designed to target the Ethereum Virtual Machine (EVM). Solidity is statically typed, supports inheritance, libraries and complex user-defined types, among other features.
Solidity also focuses a lot on security (for obvious reasons). Because the blockchain is “public”, security is of the utmost importance. Solidity has unique ways to enforce security that differ from other software development languages. For example, directly in the declaration of a function, you can place what are called “modifiers” which are basically inline validators that either allow or disallow the function call based on who is calling the function.
Non-Fungible Tokens (NFTs)
There’s been a lot of talk about non-fungible tokens (NFTs). Non-fungible tokens or NFTs are cryptographic assets on a blockchain with unique identification codes and metadata that distinguish them from each other. They cannot be traded or exchanged at equivalency. This differs from fungible tokens like Bitcoin and Ethereum, which are identical to one other and, therefore, can be used as a medium for commercial transactions.
Basically, NFTs are a way to make digital assets like images, videos, and documents unique using the blockchain. A good real-world example is to compare it to the Mona Lisa painting in the Louvre. There’s only one Mona Lisa painting in the world, and it’s priceless. However, there are many reprints that anyone can buy. The same applies to digital assets. If an artist creates a beautiful JPEG image, they could technically email it to someone then that person could email it to all their friends and now everyone has a copy of that JPEG. However, NTFs allow an artist to ensure that the JPEG painting they created is unique and can then sell it. Even though copies of it could be made, there’s only 1 original that has true value.
Much of the current market for NFTs is centered around collectibles, such as digital artwork, sports cards, and rarities. One example of a use case is to mint NFTs that represent real estate deeds. The NFT would exist on the blockchain while the real estate deed would exist on a file service such as IPFS (inter-planetary file service) which is a shared-file service where encrypted files can be stored.
Like any widely used service, tokens are now based upon standards. NFTs evolved from the ERC-721 standard. Fungible tokens are based on the ERC-20 smart contract. ERC-721 defines the minimum interface – ownership details, security, and metadata – required for exchange and distribution of gaming tokens.
Applicability to HVAC
The question for this audience is: how can the HVAC industry take advantage of the blockchain to solve existing problems and pain points?
As I mentioned above, the blockchain is good for anything that is appropriate for public accountability. One important HVAC-related topic that is ripe for public accountability is the whole issue around the phase-down of high-GWP (Global Warming Potential) refrigerants (CFCs, HCFCs, and HFCs). EPA regulations under Title VI of the Clean Air Act (CAA) are designed to protect the environment and to provide for a smooth transition away from ozone-depleting refrigerants (ODRs).
EPA regulations under Section 608 of the Clean Air Act include record keeping and reporting requirements that are specific to different professionals or companies involved with stationary refrigeration and air-conditioning equipment. Technicians must keep a copy of their proof of certification at their place of business. Technicians servicing appliances that contain 50 or more pounds of ozone-depleting refrigerant must provide the owner with an invoice that indicates the amount of refrigerant added to the appliance. The records primarily include: location and date of recovery, type of refrigerant recovered, monthly totals of the amounts recovered, and amounts sent for reclamation.
This record keeping is a perfect application for the blockchain. It keeps all stakeholders accountable and also provides interested parties with a verifiable source of information about ozone depleting refrigerant evacuation.
Owners or operators of appliances that contain 50 or more pounds of ODRs must keep servicing records documenting the date and type of service, as well as the quantity of refrigerant added. Owners or operators must also maintain records of leak inspections and tests performed to verify repairs of leaking appliances.
The EPA will also be requiring third-party auditing of business’ HFC record keeping. This will provide transparency of HFC production and consumption data for the general public to view. Stay tuned for more updates on this subject.
Definitions
Like any industry, blockchain has its own expansive vernacular of software and related tool names. Here is just a brief list:
Smart contract: A “smart contract” is simply a software program that runs on the Ethereum blockchain. It’s a collection of code, functions and data that resides at a specific address on the Ethereum blockchain.
DApp: DApp stands for “decentralized application”. It is a piece of software that runs on a distributed or cloud network, rather than on a single dedicated server (like a desktop software program). By distributing the processing power and storage space across many devices, DApps are decentralized, making them more resistant to attack as there is no single point of failure that can be undermined. By their very nature, blockchain smart contracts are DApps.
Truffle: This is a software development environment and a set of software libraries that aid in the development of distributed apps on the Ethereum blockchain. (https://trufflesuite.com/ )
Ganache: This is a local test blockchain desktop (or command-line) application that can be installed on any user’s Windows or MacBook computer. It simulates the actual Ethereum blockchain and allows users to easily test their solidity apps locally on their computer without worrying about the network and consensus delays of the real or testnet Ethereum blockchain. It is an open-source project that is available on GitHub.
Solidity: Solidity is an object-oriented programming language for writing smart contracts. It is used for implementing smart contracts on various blockchain platforms, most notably, Ethereum.
Metamask: This is a cryptocurrency “wallet” and blockchain gateway that is a plugin to a user’s Internet browser. It allows anyone that owns Bitcoin, Ethereum, or another other cryptocurrency to interact with distributed applications that require cryptocurrency. In addition, users can load “test” Ether to test Dapps on the testnets such as Rinkeby and Kopstein. (https://metamask.io/ )
Rinkeby and Kopstein: Rinkeby and Kopstein are Ethereum test networks that allow for blockchain development testing before deployment on the actual Mainnet that costs real money (Ether). (https://rinkeby.etherscan.io/ )
Etherscan: Etherscan is the Ethereum blockchain explorer. It’s basically a search engine for all things Ethereum. It allows users to type in a block hash, a transaction hash, or account id to find out more information about those items. In addition users can search for Ethereum tokens and much more.
Remix: Remix is a web-based integrated development environment that allows users to develop Solidity code, compile it, deploy it to any of local or test Ethereum networks, then interact with the contracts once they are deployed. It’s a great tool for testing and debugging smart contracts and provides a quick user interface so users can input parameters that are sent to the blockchain.
Infura: Infura is a website that is also a web-service API that helps distributed apps connect with the Ethereum blockchain. Infura allows users to connect to the Ethereum blockchain without running a full node. It’s a lightweight alternative to downloading the entire blockchain to a user’s local computer. It makes the connection that allows users to take advantage of the functionality provided by web3.
Web3.js: This is a collection of libraries that allow users to interact with local or remote Ethereum blockchain networks. In other words, it allows developers to create web-based toools that interact with the blockchain.
zkSNARKS: This is a funny-sounding word that is an acronym that stands for: zero-knowledge succinct non-interactive argument of knowledge. That’s quite a mouthful but it’s simply a comprehensive method of data encryption that allows one party to prove it possesses certain information without revealing that information. It involves complex mathematical equations to accomplish this encryption. It is often used on non-fungible tokens (NFTs).
Ethstats: This is a website that keeps track of the status of the Ethereum blockchain and includes tons of statistics on all things Ethereum including latest block #, when the last block was added and much more: