Introduction to Cryptocurrency
This is a technical introduction to the world of distributed systems and cryptocurrencies. This will read like meaningless jargon if you do not have a why. For my why, read A Peer-to-Peer Culture.
Cryptocurrencies are part of the larger field distributed systems. This branch of computer science explores how to work with many moving parts that cannot communicate in real time. As the name suggests, it also heavily relies on cryptography. Both distributed systems and advanced digital cryptography can be traced back to the 70s. The seventies were the decade of ARPANET (email), public-key cryptography, and Ethernet.
So understand that since Bitcoin took the world by storm in 2008, it was based on decades of foundational research and technology that came before it. Bitcoin's genius lies within solving one particularly pernicious problem: the double-spend. Without a central authority keeping track of everyone's transactions, how can we make sure no one spends their money twice?
There are two fundamental concepts to understand before we dig deeper. Namely, public-key cryptography and hashing.
Public-key cryptography is one of the most important building blocks of many modern conveniences. How can two parties communicate in private over insecure channels without first agreeing on a shared secret in person, like a password?
It turns out all you need are two keys: one public, one private. If someone wants to send you a message, they encrypt it using your public key. Once that message has arrived with you, you decrypt it using your private key. Similarly, if you want to prove ownership of your public key, you can encrypt a message with your private key and let others decrypt it with your public key.
Another conceptually simple and fundamental technology is hashing. A hash of some piece of data is a fingerprint. The algorithm can take any file of arbitrary size and give back a unique sequence of characters and numbers of a fixed length. The result will always be the same. But should only one bit in that original file change, running the algorithm again will result in an unrecognizable hash. This complete decoupling of input and output is key.
This is often compared to human fingerprints. All our fingerprints are similar in form regardless of weight, age and size but differ greatly in their inner patterns. So here too is input and output decoupled: you cannot infer the owner of a fingerprint solely on that fingerprint.
With these concepts in mind, we can start asking the fun questions. How can a global network without a leader come to an agreement on such a contentious subject as money and property?
Another long-standing field of research in computer science is consensus. How can different parties with different motives come to an agreement on contentious matters over communication channels with varying latency?
It's always good to simplify when tackling complex dynamics. So let's simplify how we store transaction data. After all, this is what everyone has to agree on. Let's invent a blockchain. A blockchain is exactly what the name suggests. A chain of "blocks" containing some kind of data, in our case transactions. It is immutable, in that it is append-only. New data, or blocks, can only be appended to the most recent block. Write is the only interaction possible.
But without a leader, we need a way of deciding who actually gets access to write the next piece of data. A way of proving you fulfill some kind of requirements. These proofs and requirements can vary drastically from protocol to protocol. Let's first look at Bitcoin's original method, known as Proof of Work.
To get the right of writing the next block to the chain, participants compete in a lottery of sorts. Remember hashing: arbitrary input results in a fixed-length output. The lottery is to get a hash fulfilling some kind of requirements by combining your public key, the current time and the previous block. So every participant races to compute as many hashes as they possibly can, throwing an incremental number (called the "nonce") in the mix in case of failure, hoping to get to that elusive winning hash before anyone else. Hashes are unpredictable, so the distribution of winners is unpredictable as well.
Essentially, participants proof they have used up energy, a scarce resource. This protects the blockchain from adversaries. If one were to change even just one previous block, all blocks thereafter would have to be recomputed, because each block's winning lottery number, the hash that was so difficult to compute, is computed using the previous block. This is infeasible, as the network is relentless in producing new blocks while the adversary is trying to catch up. Provided that the majority are honest participants choosing the longest and therefore most difficult chain.
We can observe two things: the use of energy as a scarce resource and a random, unpredictable distribution of winners each round. The amount of energy used this way is non-trivial. This has lead to the advent of other consensus mechanisms. When designing new mechanisms, a) the use of scarce resource and b) unpredictable distribution of block producers have to be kept in mind.
The most popular alternative is called Proof of Stake. This mechanism is using the currency itself as the scarce resource. Participants provide some amount of the currency as stake in the network, proving they have an interest in keeping the network alive and healthy. The more stake you provide, the higher your chances to produce a block. This approach is more game-theoretic than Proof of Work, but is favored for its efficiency. A quick and dirty comparison between the two alternatives might be: Proof of Work is 99% energy and 1% politics whereas Proof of Stake is 1% energy and 99% politics.
There are a host of other consensus mechanisms. Some, such as Filecoin, elegantly combine the fundamental utility of the network with the consensus mechanism resulting in little to no wasteful allocation of the resource. In Filecoin, storage is the scarce resource. Storage providers prove the amount of storage they provide the network. Similar to Proof of Stake, the more storage you offer, the higher your chances of producing the next block.
Actually transacting the currency looks similar for most mechanisms. Say you want to execute a transaction. You create the message, sign it with your keys and post it to the network. For the transaction to count, it has to be included in a block. In the case of someone winning the hash lottery, the lucky block producer now bundles up all transactions posted to the network by participants like you.
The obvious utility of cryptocurrency is, aptly, that of a currency. This is what Bitcoin set out to be in its original white paper. The goal was being able to send value around the world, without intermediaries and small fees. Since then, Bitcoin has been found to be infeasible as currency in its current state, due to high transaction fees and high latency.
Other protocols have arisen since then, that all tackle these issues in their own way and even provide extra utility. Ethereum was the next major step, calling itself the World Computer. The network can execute code, know as smart-contracts. These smart-contracts gain all the benefits of the underlying blockchain: no intermediaries and immutability. Smart-contracts are Touring-complete, making them infinitely versatile. Making money programmable is revolutionary. Just a few examples are escrows without intermediary or peer-to-peer exchanges without relying on order books. With smart-contracts, the sky is the limit.
A common use case of this programmability are tokens. People have come to use smart-contract blockchains like Ethereum to issue their own tokens. These tokens can represent anything, from fractionalized ownership in a real item to utility tokens in a digital service to the infamous non-fungible tokens (NFTs). Any value can be represented digitally and transacted around the world within milliseconds to minutes, depending on the protocol.
Cardano, another protocol similar in functionality to Ethereum, has taken one particular concept even further: metadata. On the Cardano blockchain, you can include a maximum of 16 kilobytes of arbitrary data in a transaction. Any piece of data fitting this constraint can now be immutably timestamped on a global database. In fact, this very article's hash lives on the Cardano blockchain. I can now prove to anyone that I was in possession of this text at a certain point in time.
I have already mentioned multiple protocols. No protocol is in any way superior to other protocols as a bulldozer is superior to a sports car. They all have different use-cases, serve different audiences and protect against different adversaries.
The five metrics with which to compare cryptocurrencies are decentralization, scalability, sustainability, interoperability and utility.
The most common trade-off is between decentralization and scalability. Decentralization is associated with security and independency, but introduces more complexity and is harder to scale. Scalability refers to energy efficiency, speed, volume, and smaller transaction fees. There are those taking the easy route and opting for lower fees and higher throughput at the cost of decentralization. Others do the work required to find new cryptographic primitives allowing for smaller to no trade-offs.
Sustainability refers as much to the environmental impact of a blockchain as to the long-term health of the protocol. How does the protocol keep up with the latest research and how are the developers paid? Some tackle these issues head on through open governance and treasuries, others choose to delay this conversation.
Interoperability is a fantastic property endemic to the whole crypto space. Open source code and governance, the decentralization and a general mentality make for independently verifiable, extensible, customizable, and most importantly interoperable experiences like never before.
There exists an unhealthy amount of tribalism in this space. Different protocols accept different trade-offs. Everyone ends up dealing with the devil. We can all prosper. This is not a zero-sum game.
Above all, I hope you have gained a deeper understanding of the diversity and variety in the cryptocurrency space. Don't feel like you have to invest in any particular cryptocurrency or that speculation is all there is to it. We are so early, this whole space is still so very malleable. You can have an outsized impact by participating in your own unique way.
Was something unclear? Did I skip an important aspect? I intend to keep iterating on this article to make it the best introduction to cryptocurrency out there. Send me a note at [email protected].