Blockchain Technology

I attempt to describe to you the history of blockchain, its general concept, its applications in both society and the business world, and lessons to be learned from previous blockchain projects.

The concept of blockchain was based from the paper titled Bitcoin: A Peer-to-Peer Electronic Cash System. At the heart of this concept is essentially a record that is shared among peers in a network. The record is special in that it uses cryptography and computing in both when new changes are made and verified. The verification process of new changes in the record is known as mining and is done by miners. New changes that want to be made on the record can be broadcasted to these miners or nodes for verification and confirmation. These nodes are essentially decentralized (meaning no one individual or party controls all the changes made to the record). Decentralization is accomplishable because of the distributed ledger and the computing power to support verification of changes on the ledger.

The first application of blockchain was demonstrated in currency through the inception of bitcoin (the currency). This cryptocurrency essentially used the blockchain record to keep track of transactions through a transaction-based ledger, differing from the account-based ledger. An example of the account-based ledger concept is shown in figure 1. A transaction-based ledger consists of various properties. Two of which, that are most important, are inputs and outputs. The input to a transaction includes a previous output or outputs from previous transactions. These outputs are known as UTXOs, short for unspent transaction outputs, because they have never been included in an input nor have been spent before. When the UTXOs are included in an input of a transaction, to transfer value to another entity, the input will be divided usually into two outputs. One output will be to the receiver’s public address who will be able to obtain the value in the transaction after they prove their identity by unlocking a locking script associated with the UTXO. The second output will be the change that the sender will receive after paying a specified amount to the receiver using the UTXO. If the UTXO contains the same amount needed to be spent, there will be no second output.

Figure 1. The difference between a transaction and an account-based ledger.

Like any other currency, for Bitcoin (the concept) to be viable, the people and community using it must trust that Bitcoin can be used to transact. Currently, we transact by heavily depending on third parties. These parties include banks or governments to assure a standard of fairness when transacting. The standard of fairness from centralized powers has not always been perfect or practical. Examples of imperfection include economic disasters occurring in governments such as Zimbabwe, Weimar Republic (1920), Argentina (2014), United States (2008).

The standard of fairness can be examined further on the individual level when dealing with government currencies. An example of this is the recent Ponzi scheme pulled off by Bernie Madoff, who sought investor money in return for promised profits in the future (discovered and jailed in 2008). Instead of generating profits from investments to pay investors, he took the money investors gave him and returned it, citing that the returned money was the profit. His scheme is only one of three risks. Two other risks include a bank run (when many people demand their money back all at once) and a risk of a hack. What these case studies have in common is the trust that the people have in a system of exchange.

Likewise, when aspects such as being able to join the market or use the currency effectively are barred, the trust that people have in the currency is degraded. Take, for instance, the culture in Afghanistan, which prohibits most women from banking. If they ever received any money, the women in the family would have to transfer it to the men’s bank account. An instance of being barred in joining the market might be transaction costs from sending small amounts of money throughout the world. Cryptocurrencies (which use blockchain technology) overcome both problems by lowering transaction fees, being universally acceptable, and accepting anonymity (hence anyone can join). In other words, one of the applications of blockchain, in cryptocurrency, stimulated the demand for blockchain in general.

Cryptocurrencies depend on the properties of mathematics in cryptography and transparency to overcome specific challenges that centralized systems face. Take, for example, the minimum reserve requirement that governments impose on banks, which is usually between 3-10%. A Bitcoin exchange or someone who holds bitcoins can use cryptography to reassure customers that they have a fractional reserve. This fractional reserve is calculated by a process known as proof of reserve and proof of liabilities. Proof of reserve is used to prove the number of bitcoins that the exchange controls (referring to the money that can be used). Proof of liabilities is used to prove how many demand deposits from individuals the exchange holds (hence the amount owed to depositors). Dividing the proof of reserves with the proof of deposits yields the fractional reserve. Hence, the transparency created by this process would provide a great deal of security and relief to those who have done business with this exchange. The importance of such a mathematical number would be the avoidance of another Bernie Madoff attack.

A Merkle tree can be used in the reserve verification process to cryptographically provide details of a leaf corresponding to a specific user and their transaction (known as pruning). It can also provide details of the total deposit amount that the bank has received. The transactions at the leaf of the Merkle tree contain many properties, one of which are the inputs and outputs to specific public addresses, which are all hashed to create a transaction identification. The leaf nodes are then hashed together to create non-leaf nodes (examples in figure 2 include “Hash01”, “Hash23”, or “Hash2”). This process is continued until one hash, known as the Merkle root, is created. The Merkle root is part of the Merkle tree, as it is comprised of every transaction in the block, which is represented by a single line of letters and numbers. The “Root Hash” in figure 2 is the Merkle root of the Merkle tree consisting of letters and numbers described above.

Figure 2. Example of a Merkle tree and the concept of pruning from Satoshi Nakamoto; “Bitcoin: A Peer-to-Peer Electronic Cash System”; 2008, http://www.bitcoin.org/bitcoin.pdf.

Hash functions, in general, are a core part of blockchain and cryptocurrencies. A Merkle tree is one use case of hash functions in cryptography. Useful hash functions should have three distinct properties, which include being collision-resistant, able to hide, and puzzle friendly. A hash function is collision-resistant if no one can find two distinct inputs represented by the variables x and y, such that when it is hashed, H(x) = H(y). A hash function is able to hide if there is no feasible way to figure out what the input x was if given the output of y = H(x). Finally, a hash function is puzzle friendly if it is infeasible to find x given k such that H(k∥x) = y in a certain amount of time. Having these properties enables blockchain to be distributed, yet secure in that blocks prior to the current block are immutable.

For example, a hash function that Bitcoin uses is the SHA-256, which is in the Secure Hash Algorithm family. There are many types of hash functions with different properties besides the SHA-256 algorithm, which include MD5, SHA, and RIPEMD. They differ in input and output (hash) sizes, which are measured in bits, computer logic such as XOR used to reach the hash, and general security protection against collision attacks. Therefore, in exchange for more desirable properties, there will be a reduction in other desirable properties (the three listed above). This trade and balance of cryptographic hash properties will depend on the specific application of the function, considering aspects such as the input, output, and desired security.

In general, hash functions are implemented in several areas throughout blockchain technology, such as locking and unlocking scripts, consensus protocols, and block divisions. They make up the core structure that allows blockchain to be implemented in areas dealing not only in currency, but healthcare, voting, patenting, machine learning, internet of things, and others.

Take for instance healthcare insurance. The unique use of immutability from cryptographic functions in each individual block allows legitimate participation from insurance agents, medical record managers, and patients as nodes. For instance, whenever a patient receives treatment from a hospital, the patient and the hospital will both sign the treatment on the blockchain with their private keys. This process is considered a transaction which can then be verified on the private or public blockchain network at any time. If the blockchain is a public network, any individual can join and access the blockchain data record (to review past transactions). If the blockchain is a private network, only certain individuals can join with the permission of the authorized users in the network (and review past transactions). The data stored on the blockchain is indefinite, starting from when the transaction was initiated (unless the authorized nodes all agree to void the blockchain). This means that the transaction can always be seen by participants such as insurance agents in the future. When the insurance company is ready to pay the patient’s hospital claims (or before a time set on the transaction between the hospital and patient), the company can then sign a new transaction with the hospital indicating that they have paid the claims. This case of blockchain is only in the health care insurance industry.

In the broader aspect of healthcare, regarding researchers, government, and other general healthcare companies, blockchain can be beneficial for both transparency and privacy. Depending on how the blockchain is implemented, one or the other or both can be achieved in some aspects because constructing blockchain technology is extremely malleable. An example of using blockchain to ensure privacy would be patients assigning access rules for their medical data. An example of transparency would be patients being able to collect their data by connecting to other hospitals.

Blockchain’s applications, however, have not entirely been prone to exploitations. MtGox, a bitcoin exchange based in Tokyo, Japan, at one point handled more than 70% of all bitcoin transactions. In 2014, the company announced that almost one million bitcoins belonging to customers had been likely stolen. This was because of a bug in the bitcoin protocol allowing for transaction malleability. This concept occurred when MtGox made transactions in the public ledger under specific transaction hashes. Specific nodes then altered the properties in the transaction data, which changed the transaction hash. When this was changed, the thief could complain that the transaction had failed (when it did not because the output script was still the same), and MtGox’s system would send out more bitcoins. This process could be repeated infinitely. However, it was not entirely MtGox’s fault in losing the number of bitcoins it did to the thief as the protocol had allowed nodes to change specific properties.

The first lesson to be learned from MtGox is that blockchain is present in matters dealing with money. Hence there will always be attacks on the weaknesses of blockchain attempting to distribute incentives. The second lesson to be learned is that when the code of a blockchain distributed protocol has faults or weaknesses, it should be corrected so that the faults are not exploited in the future.

Leave a Reply