A beginner’s guide to how cryptocurrencies work
From Bitcoin to blockchain, here's what to know.
Whether you’re on the head or tail end of the cryptocurrency craze, one thing is for sure: These digital assets are hitting the mainstream hard, and don’t seem to be going away anytime soon. Notably, the country of El Salvador recently adopted bitcoin as legal tender, and New York’s incoming mayor Eric Adams is intent on transforming New York City into a hotspot for cryptocurrency.
Although only 16 percent of Americans say they invested, traded, or used cryptocurrency, almost 90 percent have heard about it, according to a recent Pew Research Center survey.
Advocates for cryptocurrency and decentralized finance (where people can make financial deals with one another without being moderated by a middleman or central authority like a bank) in general argue that these platforms are transparent and simultaneously anonymous—both good things.
The key to this vision lies in a digital technology called the blockchain, which undergirds all cryptocurrencies. The blockchain serves as a virtual hall of records, or a public ledger, that records every transaction, detailing the amount as well as the sender and receiver’s wallet addresses.
Yet, critics and regulatory bodies are worried about the potential for harm from cryptocurrencies, such as people using them for scams, money laundering, or funding illegal activities (not to mention the enormous carbon footprint that some of these cryptocurrencies have—The New York Times reported that Bitcoin burns through more electricity than certain countries). And experts have raised concerns about the strength of cryptocurrency networks against attacks, and whether the design of some systems have warped over time to become centralized or inherently allow the rich to get richer.
For those who are just wading into the crypto territory, here’s a basic explainer on how the computer science behind these systems work.
The basics of crypto, explained
To start at the front end, this is what happens when you send and receive cryptocurrency. Keep in mind that all cryptocurrencies are just based on computer programs, bitcoin included, and that these “coins” are not actually money, but clippings of computer code that transfer value from one user to another. To become a part of this process, first you have to create a digital wallet. Bitcoin and Ethereum both have recommendations on what wallet works best with their cryptocurrency, and specialty exchanges like Coinbase and Gemini also offer wallets.
Whenever you create a new wallet, the algorithm running that cryptocurrency will generate a paired private key and public key associated with it. You can think of the public key as like an address or bank account number, and the private key proves your ownership. The public keys are a long string of characters that identify where the crypto should go. Usually, the addresses only accept the type of cryptocurrency they’re affiliated with (although something called cross-chain bridges and exchanges can help link up different cryptocurrencies).
[Related: 6 apps to get you started on crypto]
“You do not have bitcoins in your possession—you have proof that somebody in the past sent you those bitcoins,” says Nicolas Christin, an associate professor of computer science, engineering, and public policy at Carnegie Mellon University.
You can then tap some of the unspent value in your wallet, and send it to someone else’s public key. When you sign to verify that you want to send the bitcoins, you generate a small personalized piece of code attached to the transaction, and the system creates a mathematical puzzle that locks up that value and scrambles the code. When the recipient is ready to spend the money, they will put a corresponding piece of code into the transaction. Everybody in the network can verify that the two pieces of code fit together (through a process called transaction confirmation, also known as mining—more on that later). This entire operation is called signature verification.
“It’s impossible for someone to find a missing piece if they don’t have the right information, but it’s super easy for anybody to verify that two pieces fit,” Christin explains. “Bitcoin has very little additional computational abilities beyond signature verification. Satoshi Nakamoto’s [the pseudonym of the alleged creator of Bitcoin] vision was to have programmable money, initially. The problem is Bitcoin became very popular very quickly and the developers decided to freeze the features where they were.”
However, a new upgrade released last week could open up the possibility for supporting expanded functions beyond signature verification.
So how are other cryptocurrencies different from Bitcoin?
Many modern cryptocurrencies derive from the Bitcoin model. For example, Litecoin is in many respects similar to Bitcoin, but the puzzle component was slightly altered. They replaced the mining algorithm (called SHA-256) that’s used in Bitcoin with a function called Scrypt, which they claim takes less energy to run. On the other hand, the creators of Bitcoin Cash branched off from a team that was working on Bitcoin to make a Bitcoin-esque cryptocurrency that can process more transactions per second.
Ethereum, however, takes a different approach. Its blockchain has an added feature called “loops,” which allows it to repeatedly run a piece of code, and engineers can program on top of it. Ethereum uses a mechanism called a “gas” that charges the person who initiated the transaction a fee to run a programming instruction. The program burns up the “gas” as it runs, and when it’s out of gas, the program either completes or terminates.
Developers can build a cryptocurrency on top of Ethereum (like the stablecoin DAI), create mortgages, or unique non-fungible tokens, since they’re all pieces of code (NFTs are links that point to digital assets within the blockchain, or to objects that sit off the blockchain). “All of those are pieces of code that are extensions of Ethereum transactions,” says Christin.
Ethereum is also credited with the nifty innovation of integrating smart contracts onto their blockchain. Ethereum’s developers describe these as code scripts that “performs some actions or computation if certain conditions are satisfied,” comparing the logic of the code to how a “vending machine” works. If a digital art NFT lives inside a smart contract, for example, the artist can create a royalty schedule that accrues a fee every time the art is transferred on the blockchain.
Or, as another example, imagine walking into a bank and asking to borrow $10 million for the day without telling anyone your name. “Somebody’s going to be reaching for a red button under a desk somewhere,” says Ari Juels, a professor of computer science at Cornell Tech. “But you can actually do something like this on a blockchain.”
You would borrow money using a smart contract, and you use it to do whatever you want to do. Typically, it’s used for arbitrage, where you buy and sell tokens at profit. Then, you pay back the loan, and all of that is contained in a single transaction. “The way that blockchains work, if you fail to pay back the loan, the whole transaction can just be aborted,” Juels says, “which means that it’s as though you never borrowed the money to begin with.”
Proof-of-work, proof-of-stake, and other forms of “consensus”
Now, to peel back the curtains some more: To keep any cryptocurrency system running, there has to be a way to release new coins into the network, along with a way of maintaining the public ledger that tracks where all the new coins come from and where they go.
But since these cryptocurrencies are all meant to be peer-to-peer, there’s no one entity that does all this, the way a traditional bank does. Instead, the responsibility of running the system falls to the whole network of participants, which is why they have to come to a form of consensus about whether transactions are valid or invalid. Each transaction made on the blockchain needs to be verified. A batch of transactions make up a block, and several blocks make up a chain.
“The blockchain provides you with a different trust model,” says Juels. “The rules are very well defined and transactions can be executed in a rigorous, programmatic way.”
There are a variety of methods used by different cryptocurrencies to accomplish those two standard tasks. Proof-of-work is the process used by most cryptocurrencies, including Bitcoin and Ethereum, to do this. Although all users get to check if the transaction was good in the end, only one user can be elected to lead the validation, add the transaction to the blockchain, and receive a reward. These rewards are how new currencies get released into the system. This operation is also known as mining. But first, the users, called miners, have to compete against each other to solve a cryptographic puzzle whose difficulty is proportional to the number of people trying to solve the puzzle. The puzzle is created by an algorithm. The only way to solve it is to try many different numbers, and powerful computers or processors can try more numbers quicker so are more likely to get the correct answer.
With Bitcoin, there is a limited amount of bitcoins in the system (21 million) and the rewards for mining decrease over time, although miners are still incentivized because they can receive a portion of the transaction as a fee. “The ideal goal of Bitcoin was one vote per CPU. That has ultimately been subverted,” says Juels. “People are using specialized mining hardware to participate in the system.” As bitcoin mining heated up, people developed and burned through specialty hardware, guzzling up electricity and creating tons of waste.
“Proof-of-work still functions according to the original principle of requiring an investment of resources in order to participate in the system to mine blocks,” Juels notes.
Meanwhile, in proof-of-stake systems, you pay to play, and have to stake tokens as a resource investment to participate, like putting in a security deposit that you get back once the transactions you added to the blockchain are approved by the network. The system chooses a staker who is online at the time randomly and they get to validate the transactions and receive the rewards. Because it doesn’t require solving puzzles, in theory, it should use less energy.
“In Bitcoin, your participation in the system is proportional to the amount of computation you do,” says Juels. “In a proof-of-stake system, it’s proportional to the amount of cryptocurrency you hold in the system.”
“Typically the way that [both proof-of-work and proof-of-stake] systems work is that the rights to create the next block is determined randomly in a kind of lottery where your chances of winning the lottery are proportional to your resources,” he adds.
While Ethereum said that it was transitioning to a proof-of-stake system, that jump has not yet happened. The existing cryptocurrency projects that use proof-of-stake have their own variations of it. For example, Cardano uses a proof-of-stake system called “Ouroboros” that incorporates stake delegation and stake pools. And Solana, a blockchain that you can also build smart contract programs and other decentralized apps on, combines proof-of-stake with another consensus algorithm called proof-of-history to incorporate timestamps on transactions.
Despite proof-of-stake being faster and more energy efficient, many experts have concerns about its stability and the barriers to entry. “In Bitcoin, you can just start mining, in principle, with your laptop. You wouldn’t do very well, but you can join the system without any type of previous investment of resources,” says Juels. “In the case of these proof-of-stake systems, you need to go buy some coins to participate, or be assigned the coins at the outset of the protocol. There are some people who object to the need to obtain coins in order to participate to begin with, but that is a necessity.”
Alternatively, a cryptocurrency project called the XRP ledger uses a consensus protocol unlike proof-of-stake or proof-of-work that’s almost democratic—but validators do not receive any rewards.
What about proof-of-storage?
There’s another concept to know, too. Proof-of-storage (otherwise known as proof-of-space) is where you’re committing an amount of space for storage in the network. “The idea initially was digital preservation—we want to record everything, so at least we can use the disk space for a good purpose. It turns out it’s less needed than we thought,” says Christin. “There’s a need for digital preservation but it doesn’t scale as quickly as a currency would.” Juels proposes that these systems could potentially be useful for storing data from NFTs. One project testing out this concept is Filecoin.
Ultimately, despite gaining ground with large finance platforms like PayPal, Mastercard, and Robinhood, the future of cryptocurrency is still uncertain—looming federal regulations could dramatically reshape the community and the ecosystem. And the value of currencies like bitcoin remain volatile and represent risky investments. Wherever the next chapter of cryptocurrency leads, it’s indisputable that the popularity of this new wave of technology has already forced large financial institutions to evolve their thinking on how people want to interact with money, and with each other using money.