While I have not been particularly interested in cryptocurrencies, I’ve noticed recently that one of the techniques used in all crypto currencies – the blockchain – seems to have found a real or invented relevance to everything under the sun. Suddenly, everyone is talking about “blockchain,” claiming it can be used for just about any purpose you’d care to mention. Since I happen to be quite familiar with public key cryptography, I decided to look more deeply into this reportedly revolutionary technology. After examining it closely, I am completely puzzled why blockchain is taking the world by storm. Hear me out.
The purpose of cryptocurrency is to provide a decentralized digital currency for anonymous, peer-to-peer transactions. A cryptocurrency has two parts:
- A public ledger that records all credit/debit transactions.
- A process to verify the new transactions added to the ledger and to lock the added records so they cannot be altered.
Simply put, the locked ledger is basically the blockchain, and the process to verify and lock the transactions is known as “mining.” We will look at the blockchain first, then explore the mining process.
The use of blockchain for this purpose of a secured ledger is perfect. Let’s summarize the concept of blockchain in general, then address specifically what it means for cryptocurrency. And please feel free to comment below if you believe I am wrong. However, I am quite confident I am right – as confident as I am that our Constitution is ordained by God Himself, that it is inviolable, and that it will protect our Republic forever.
In the case of cryptocurrency, the ledger basically comprises a series of individual groups of transaction records (a block of records) chained together. The two basic cryptographic functions required to implement it are the following:
- A one-way hash, sometimes also referred to as message digest
- Asymmetric encryption.
Let’s examine these two functions in detail. The mathematics behind them may be complex, but the application concept is quite simple and easy to grasp. You just have to understand the usage and then trust the math.
To put it in simple terms, a one-way hash is like a “checksum” of a piece of data, a message, or a record (follow the link if you don’t know what a checksum is), except this checksum is extremely strong. For every record, even if the difference between it and another record is a single bit, the resulting “checksum” will be completely different. So different, in fact, that there won’t even be a slight similarity between the two results. This implies that it is nearly impossible (the exact word is “infeasible”) to try to alter the contents of a record to make it result in the same hash as another record. If someone is trying to forge a record to produce a hash that is the same as another record, he (I assume only a man can be so silly) will have to have a piece of arbitrary data in the record, more or less the same size of the hash, that can be tweaked through all combinations. For a 256 bit hash, that is 2256 combination.
This sounds simple enough, until you explore what 2256, or 2 to the power of 256 means. To make things easy, let’s reformulate that number to base 10, which gives us approximately 1077 (the number one followed by seventy-seven zeros).
If you had a 4GHz CPU spending one clock cycle per hash, you’d be able to perform 4 billion hashes per second. But let’s say you had some super amazing lightning fast computer that could compute at 2,500,000 times that already fast speed, to 100 trillion hashes per second. Now let’s further assume that 10 billion people (more than currently inhabit the planet) each has one of these super lightning fast computers and are dividing up the task. It will still take 1077/1014/1010, which is 1053 seconds. One year is about 31 million seconds. If we round that up to 100 million for easier computation, we get 108 seconds.
If we divide the number of seconds taken for the computation by the number of seconds in a year (1053/108) we find that it will take about 1045, or 1 quattuordecillion years to go through the combinations. That’s a one followed by forty-five zeros. Or maybe it’s more digestible if we say 1 billion, trillion, trillion, trillion years. The simple conclusion is that, a hash is extremely reliable in representing a piece of data, such as a transaction record, or a block of such records.
Now let’s look at asymmetric encryption. Asymmetric encryption is based on an even more complex mathematical theory, but the application of the concept is again, very simple. A mathematical process is used to create a pair of keys: a public key and a private key. The public key is (surprise) made public, and the private key you keep to yourself. When a piece of data is encrypted with one of these two keys, only the other can decrypt it. If the data is encrypted by the public key, ONLY the private key can decrypt it, and vice versa. This is all you have to know, and it’s important to keep in mind as we continue.
Now let’s put these two concepts together.
Hashes can be created for any record and/or block of records. When the hash is encrypted by a private key, that encrypted hash is called the “digital signature” of the record(s) by the holder of that private key. Since the corresponding public key is made “public,” people can use that public key to decrypt the signature back to the original hash and compare with the hash that was generated using the same record. If there have been any changes to the record between the time it was encrypted with the private key and decrypted with the public key, the resulting hash/signature will not match the original signature. If the hash/signature matches though, it is proof that ONLY the holder of the private key could have encrypted that hash/signature.
A blockchain is a series of records – presumably records specifically designed for a purpose, such as a transaction ledger. When a number of these records are grouped into a block, they can be “chained” together. In this chain, a digital signature is created starting from the first block. Every time a new block is added, another digital signature is created which also includes the digital signature of the previous block.
Putting all these simple concepts together, we can see that once records are in a block of this chain, they cannot be altered since any change in the record will result in a digital signature that doesn’t match the original. Changing the digital signature for the changed record isn’t possible because then the digital signature of the next block will not match since the original digital signature is included in the next block’s signature. This is the essence of a “blockchain.”
It’s a simple concept – one that has actually been in use for decades. In fact, I, myself have developed products using this concept, and Cirrus is about to release a new product with a “Trusted Share” and “Trusted Objects,” that form a truly immutable, intelligent WORM repository, the details of which I will present in future blog posts.
Sharp-eyed readers will immediately question, “who signs these records and blocks, especially in the blockchain for cryptocurrencies, such as Bitcoin?” Well, that is indeed the critical part of the whole scheme. The answer is, no one, and everyone. Since cryptocurrency is – by design – meant to be decentralized, no single authority exists to sign the records. That’s part of its appeal. In fact, anyone and everyone can sign it – with the caveat that there must be some order to the chaos, or trust in the system would collapse.
Therefore, the most important, and also ingenious part of cryptocurrency, is the way the trust is distributed. The implementation of trust is through a process of competition for the chance to sign a block of these records. For every block of transaction records, participating entities battle for a chance to sign the block and subsequently receive a credit/reward.
It might be obvious, but cryptocurrency takes the form of a balance sheet ledger. Each participant in the ledger is represented by a public key. The amount of “money” each entity has is the sum of all credit minus the sum of all debit in all the records in the ledger for that entity, meaning, the records with the public key of that entity. The protocol ensures that no legitimate debit transaction can be entered by any entity if the amount of credit does not cover the debit. In other words, one cannot “pay” with the “money” one does not have.
Possession of the credit simply means possession (knowledge) of the private key that is corresponding to the public key the credit records specified. But since the credit one has received must be signed by the private key of another entity (which is considered a debit to that entity), someone must debit from their credit amount.
So, if I buy something from you with this “money,” I simply create a debit against the credit I have, which creates a credit record to your public key. Even if someone buys the credit using a U.S. Dollar, the same principle is used. Therefore, a credit results by debiting other entities. The exception here is that one can also be granted credit by winning the competition to verify a new block of record, adding the block to the chain. “Verify” means to make sure all the records in the block are legitimate, meaning, every credit transaction is debited from other existing credit records. For example, if someone tries to create a phony transaction to credit himself with a large amount, the verifier will immediately find out that the entity being debited either does not exist, or has no credit left, or has insufficient credit to cover the transaction. Therefore, that transaction will be rejected and will never make it to the blockchain.
The entity that performs the verification (a.k.a., the “miner”) then signs the block after determining its transaction records are legitimate. Mining is a clever mechanism and specific design that determines how blocks of transactions are signed. Of course, the details are more complicated than that. This is discussed in the next post (if you are still interested in that after reading this far).