Many people across the technology and financial industries are dubbing blockchains as the greatest innovation since the Internet. However, a blockchain is comprised of a bunch of technologies that are actually pretty old. The biggest surprise when it comes to Bitcoin may be that it wasn’t invented a decade earlier using dial-up internet!
Most blockchains use the six major technologies below. In this post, we will examine each technology and explain the role they play in a blockchain.
The magic of asymmetric encryption is that signatures accomplish the following:
- Prove that the signer had access to the private key
- Do not reveal the private key
- Are trivial to verify, yet impossible to forge/alter
Bitcoin uses the secp256k1 parameters of the Elliptical Curve Digital Signing Algorithm (ECDSA). ECDSA was invented in 1985 and became an ISO, ANSI, IEEE and FIPS standard in 1998–2000. The major advantage ECDSA has over RSA is that ECDSA uses much smaller keys and signatures to achieve the same level of security. In other words, Bitcoin would have been possible with RSA… which was invented in 1977!
One of the main use cases for asymmetric encryption is public-key encryption. For example, Alice can encrypt a message using Bob’s known public key and send it to Bob over an untrusted network so that Bob can then decrypt the message using his private key. This feature of public/private key cryptosystems is not really used in Bitcoin.
Hash functions take input data of arbitrary size and deterministically map it to an output of fixed size (typically smaller than the input size) that resembles random data. A key property of a hash function is collision resistance.
You may have noticed that each transaction and block in Bitcoin is represented by 64 hexadecimal characters. That’s because these “IDs” are calculated deterministically by serializing the transaction/block contents into bytes and then hashing those bytes (twice) using SHA-256. The result is the transaction/block hash.
This provides a convenient integrity check on transactions/blocks. Just as an asymmetric signature cannot be altered by a dishonest actor, the contents of a transaction/block cannot be tampered with due to collision resistance. This provides a very useful guarantee to all participants that their version of history is the same as all other participants on the blockchain. If two sources share the same current block hash, then they know they share every single input/output in every previous transaction/block.
Another use of hash functions in Bitcoin is that public keys are hashed in order to determine a Bitcoin address. This is a defensive protection against the future invention of a quantum computer that could break ECDSA (learn more here).
Bitcoin transaction/block hashes and merkle trees use two rounds of SHA-256, while address derivation uses two rounds of SHA-256 and one round of RIPEMD-160. SHA-256 was first published in 2001 and RIPEMD-160 was first published in 1994. Hash functions have been around a lot longer.
In order to package transactions into blocks, Bitcoin uses a Merkle Tree. This data structure takes a list of transactions and combines them using a binary tree structure, where the root node is called the Merkle Root. The killer feature of the Merkle Tree is that proof a leaf was included in the Merkle Root takes O(log(n)) space. Using this technique makes it possible to run a very secure Simple Payment Verification (SPV) bitcoin wallet on your phone without storing 100+ GBs of blockchain data.
The Merkle Tree was patented in 1979 and is used in distributed file systems like IPFS, file-sharing systems like BitTorrent and NoSQL databases like Cassandra.
In order to prevent double-spends (a key feature of a blockchain), you have to be able to quickly perform the following two database operations:
- Lookup if a transaction has already been spent
- Insert a new valid transaction
While NoSQL databases have taken off in popularity in recent years (due primarily to their ability to handle extreme scale), it is important to remember that NoSQL databases actually pre-date relational databases.
P2P Communication Protocol
Having nodes communicate directly with one another (as opposed to using a trusted third-party) is unlike most applications we use on a daily basis. However, it isn’t new.
Napster’s 1999 release is probably the most commonly known P2P network, but USENET predates it by two decades.
The internet provides an excellent network for P2P protocols. Gossip Network Protocols have been used in many NoSQL Databases including Amazon Dynamo, Cassandra and Riak.
Proof of Work
Proof of work (PoW) is a clever application of hash functions. It works by calculating the hash of a message, along with many different nonces, until you find a resulting digest that meets a rare criteria. Since each hash is equally unlikely to meet that criteria, specifying a hard-to-meet criteria (perhaps a hash that starts with several leading 0s) is a way to prove that someone spent their CPU cycles. Also, a correct solution will be trivial to verify.
By using proof of work to achieve consensus, it becomes unfeasibly expensive to attack the Bitcoin blockchain. This is a cornerstone feature for a permissionless network built on anonymity and strong distrust of other participants.
Some people find PoW to be inefficient, since the Bitcoin network spends enormous computing resources doing work that has no other value.
PoW was first invented in 1993, but was made famous in 1997 by Adam Back’s Hashcash.
Evolution of Blockchain Technology
The fact that blockchains use old technologies should not be taken to mean that they represent solved problems or are easy to deploy. After all, it isn’t the technologies in a blockchain that make it useful, it’s the clever way in which they interact. Scale, privacy, security and fault tolerance are all hard problems in computer science. To make things more complicated, blockchains are typically used to handle mission-critical operations (such as settling financial transactions like we are doing at Paxos), where serious bugs may not be acceptable to end-users.
A modern blockchain must optimize tradeoffs while making as few sacrifices as possible, a difficult and delicate balancing act.
We are looking for talented engineers to help us revolutionize how assets move through the global financial system. Apply now to join our growing team in NYC!
Originally published at www.paxos.com on February 23, 2017.