Below are my thoughts on what crypto is, how Bitcoin works, why it is so based and red-pilled and what are its downsides as I see them, as well as some extra educational resources that I strongly recommend to a person who is new to the crypto world.
Introduction
The fundamental property of money is its scarcity. It’s something that gives it value in the first place. Once the asset is valuable, it can be bought/sold/lost or stealed. We can’t exchange let’s say air or “thank you” statements with others because the outside world is full of strangers and people claiming they have value when they in fact don’t. We do not want to trust that kind of people so we demand for an asset that is:
- Scarce - no one should have the ability to produce it out of thin air
- Recognizable - otherwise others won’t see value in an asset you are trying to sell them
That’s it. Other properties of money you’ll find on the internet: fungibility, durability, stability, etc. are no more than grades of convenience.
History, for instance, knows many creative and peculiar types of money: from seashells to gigantic limestones placed along village pathways . They are all legitimate as long as people are willing to trade goods & services for them and believe the others will do the same.
Digital world’s challenge
What separates digital things apart from physical goods is the nature of information. The latter, unlike physical things, can be copied and broadcast almost indefinetely. It’s important that the initial holder/creator does not anyhow lose his copy - his copy just becomes less scarce. However, there are some coersive mechanisms (aka copyrights) that are designed to slow down free flow of information and raise reproduction costs.
Now imagine you are chatting with a random person who claims he has a thousand “digital things” that he can send to you right now in an exchange for some information you have. What would make you believe that these “digital things” are at least some valuable? Their scarcity for sure would. If you can somehow make sure that the “things” are indeed scarce (not just thought up by the stranger), you are dealing with money so you don’t have to trust the stranger anymore. Having this information, you are free to choose: do you value a thousand “digital things” more or less than something he demands in exchange?
I’m intentionally omitting the prisoner’s dilemma situation when counterparty can run out with the money before he completes his part of the deal. The absence of a direct trustless mechanism to link physical and abstract worlds together is what makes it difficult to preserve the same causality in the abstract one.
So how can we be sure that the balances are not made up by the stranger - he is always incentivised to lie because his wealth is directly proportional to the size of that lie?
That is why digital scarcity had been as much of a challenge until the first ever cryptocurrency - Bitcoin - was invented.
Bitcoin explained
In essence, Bitcoin is a digital file that anyone can download from the internet, read and modify. However, if you change it by your own rules - it is immediately seen as fraudulent by other users you share it with. How is it possible?
Transaction chain
There are some accounts in Bitcoin ledger (also known as “transaction outputs”) that have some balances attached to them. When a person wants to send his money, he:
- Adds a recepient or several recepients In fact transactions are more like math puzzles to solve. For example, a certain output can be locked and used when 2/3 of signatures are provided for an escrow based transactions1.
- references his own UTXOs (unspent transaction outputs) and attaches a digital signature2 to unlock each of them (it acts as a kind of ownership proof)
- broadcasts it to the network.
After a transaction is included in the ledger, this UTXO becomes someone else’s balance that can be spent by the very same rules, all forming a transaction chain.
Cause and effect
As mentioned before, it is not trivial to link physical and abstract worlds together, while nothing described so far prevents a fraud from “double-spending attack”. And that’s when the first serious problem arises…
Here is an example of such attack where Chad sends money to Katie and then reverses that transaction back to himself by:
- Creating a valid transaction pointing to Katie and broadcasting it to the world
- waiting till Katie ships the product / serves a coffee or does whatever intended
- creating another valid transaction pointing the same UTXOs to himself and broadcasting it to the network.
Chad can with ease falsify a timestamp when the second transaction was created, so we can’t rely on time as stated by sender. Moreover, any transaction made by anyone is always passed node-by-node through the whole network. Because of the time delays, different nodes will likely receive transactions in different order, thus having different versions of the chain. We can never tell which transaction had been made first and which one came after, but at the same time we want the whole network to reach agreement on the order at which the transactions are considered spent. We witness causality in physical world (when Katie sold a physical thing in exchange for some virtual currency), and we may as well want the virtual one to preserve the very same order.
And amazingly, there is a way to endorse consensus in a peer-to-peer network by using a set of cryptographic tools and a list of mutual agreements.
Hash function
Hash function is a certain rule that takes X as an input and makes some Y as an output. The function is designed in such a way that the X value can be anything (it’s just a piece of data) while Y fits some global properties.
Here is a table of some simple X values given to SHA-1 hash function
X | SHA-1 | Y |
---|---|---|
text123 | -> | f6f32842278d8896c49d768cc02568ece8715eee |
bitcoin | -> | ed1b8d80793e70c0608e8a8508a8dd80f6aa56f9 |
bitc0in | -> | 603a006a996c2f0f4565e17663092d00a231be19 |
password | -> | 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 |
As you may have noticed, Y values are all of the same size, plus the occurance of each 16 symbols (0-9, A-F) is roughly the same, so Y looks very random (even though it is fully determined by X and a corresponding hash function).
Given the same X, it will always produce the same Y - you can try it yourself . But if X is changed even slightly - Y reult becomes totally different and unpredictable (take a close look at 2nd and 3rd row of the table above).
Now let’s assume I have the Y (that looks random to you) - how can you figure out the X?
Y | X | |
---|---|---|
b9aef4d5e208a5a4378c40623a2495aff72c9e76 | -> | ??? |
The answer is “you can’t” if X is large enough. At least with today’s level of math and computer science.
The most you can do is to brute-force every common variant of X i.e. “1”, “12345678”, “”, “qwerty” and compare them with Y that I gave you. Once they match - congratulations - you’ve cracked the code. But what if I had fliped a coin 200 times and converted the results to X before I shared this Y with you? Modern computers can’t brute-force this much entropy so you are extremely unlikely to guess the X while knowing the Y.
That is what makes hash function so special and applicable for digital scarcity creation. It’s impossible to find X for a certain made-up Y, and it gets more and more likely when we raise the range. For example, it takes 16 guesses on average to find a hash that starts with a zero. For two zeros, it will take around 256 guesses and so on. The threshold (aka mining difficuty) in Bitcoin is calculated and adjusted in such a way that it will take the whole world about 10 minutes to find a “beautiful hash” and thus “solve” the “block”.
Blockchain
Blocks (groups of transactions, plus some additional data) add an extra layer of abstraction that is needed to safeguard the system from double-spending attack and preserving a fixed order of transactions that nodes3 agree upon. Transactions in the same block are considered to have happened at the same time and should not contradict themselves. Blocks are linked together and grouped into the blockchain.
When a transaction is formed and signed by UTXO owner, it is passed to the network nodes and is added to something called their “memory pool” (a pool of transactions as known by a particular node). If the transaction fee (signed by an UTXO owner as a part of transaction) is sufficient, the node includes it in it’s own version of a new block and starts “mining”:
Mining
- Transactions filtered by a highest fee are grouped into a new block.
- The node then calculates a hash of these transactions (aka hashMerkleRoot) that appears as a bunch of pseudorandom digits. It also calculates a header with a timestamp, previous block hash and other data.
- It then picks a number (nonce)4 that is added to the end of the block and calculates hash comparing it to the threshold. If it doesn’t work out (it usually doesn’t), another nonce is picked.
- Step 3 is repeated until the block hash is below a certain value (starts with a bunch of zeros). It will eventually happen but this outcome cannot be predicted and needs a constant brute-forcing.
If a node manages to “close the block”, it broadcasts the solution and the block gets connected to the blockchain of another nodes (the rule of thumb is the nodes always switch to the longest branch). Each miner then has to update their block headers that should always point to the newest block according to protocol.
Keep in mind that if any portion of block contents (let’s say some output balance) changes - it immediately invalidates the hash of the block, so the guessing process needs to be started from the beginning. If an attacker tries to change something in the middle of the blockchain, not only it breaks the beautiful hash value of the tampered block, but also invalidates each and every block that comes after (bacause they are all linked and point at each other).
Though it sometimes happens that several nodes propose their different block solutions simultaneously, forming a notorious lack of consensus. But that issue is not persistent: when several nodes have different blocks at the end of their blockchains, they just start building on top of whatever they have. When a solution is found, it gets broadcast so all of the nodes abandon another branches and switch to the longest one (that’s no more than initial agreement). The math makes it rare for several block solutions to appear at the same time, and even more rare for it to happen several times in a row - so the system quickly stabilizes.
However, your transaction may find itself in one of these abandoned chains and there is no guarantee that it will be included in the main blockchain. When sending a transaction, it is considered a good idea to wait for 2-3 blocks to stack up on top, whereupon it becomes safe and sound.
A common transaction usually includes more outputs than inputs. That’s because UTXO cannot be divided into parts. If Chad has 0.1BTC to send Katie, but his UTXO has 1BTC, he should split it into 0.1BTC that will be locked for Katie and 0.9BTC that goes back to Chad forming a new, smaller UTXO.
A typical block looks like this:
+-------------------+-------------------------+
| BLOCK HEADER | TRANSACTIONS | DIGITAL SIGNATURES
| (32 Bytes) | (about 1.5MB) | (usually outside the block)
| | |--------------------------------
| version | coinbase transaction | - acts as an extra reward to a
| prev. block hash | (newly generated coins) | miner that solved the block
| curr. block hash | |
| timestamp | tx1: from Alice to Bob | - minus fees that go to whoever
| difficulty target | | / solves the block first
| nonce | tx2: from Chad to Katie |/
+-------------------+-------------------------+
Downsides & Solutions
Proof of Work is a race that requires a constant search of beautiful hashes. The more electricity you consume and the more computing power you contribute, the more profit you are likely to gain. That is a big concern of eco-activists and other people who fail to bring subjective values surplus into their moral equation.
Bitcoin at its core is not anonymous at all. The most it gives is pseudonymity, which is not enough if you are trying to move your balances apart from your identity.
- First of all, every time you connect to Bitcoin network, you flash your IP address to the nodes. That creates an opportunity for bad actors to link your transaction with your identity (if you access some social network or some government website, you automatically provide them with the very same IP).
- Solution: mask you IP through TOR or I2P, be careful and do that each time you send digital funds. For full anonymity you can as well hide your MAC address, but that’s not trivial and requires time as well as some tech skills that majority do not have.
- Secondly, when you sign a transaction, you prove the UTXO (or multiple UTXOs) ownership. The attacker can analyze this data: either link these UTXOs to each other and to your personality, or sometimes figure out how many Bitcoins you continue to own.
- Solution: use coin mixers (Wasabi Wallet for BTC, Tornado Cash for ETH) they are illegal in many countries or use anonymous crypto solutions (Monero, Zcash).
- First of all, every time you connect to Bitcoin network, you flash your IP address to the nodes. That creates an opportunity for bad actors to link your transaction with your identity (if you access some social network or some government website, you automatically provide them with the very same IP).
Volatility.
- Bitcoin economy is deflationary while many assets are held on few accouts.
- If the early miners (who currently own lots of Bitcoin) find their ways to spend these assets, it would create a short-term shock which would cause BTC price drop. I personally do not see a threat in this scenario - it still fits market rules. 1 Bitcoin will always be equal to 1 Bitcoin on my account, regardless of the current BTC-USD exchange rate.
- Sad to say, Bitcoin price strongly depends on other cryptocurrencies perfomance. Remember how Terra’s price dropped in May 2022, which resulted BTC outflow. Soon after that - in Nov 2022 - we witnessed another significant BTC price slump when FTX exchange got bankrupt.
- There is no solution to volatility except for taking advantage of it. Most people tend to extrapolate some local failures of shady projects to the whole crypto sector. I find it irrational to lose faith and withdraw BTC in such occasions, so I sometimes find myself speculating and buying more BTC on “bear market”. And yes, we’ll certainly see worse times as another centralized exchanges, stablecoins and other projects will fail due to their centralized nature and because of governmental pressure.
- Do not keep assets in centralised exchanges. Be aware that ETH L2s, USDT, TON are somewhat centralized, hence assets there depend on Vitalic’s, Paolo’s, Pavel’s and others good mood. Traditional institutions are finite, truly decentralized ones are not. Shout-out to Satoshi Nakamoto (whoever they are) for keeping BTC economy independent of its creator.
- Bitcoin economy is deflationary while many assets are held on few accouts.
TLDR
Summing up, in “Proof of Work” principle that Bitcoin uses, a goal is to find some hash below a certain value (meaning that it starts with bunch of zeros). Therefore, we find ourselves in a game of random guesses, where the aim is to get Y = hash(X+nonce) < threshold
4. That is the core idea behind “Proof of Work” when millions of nodes are competing with each other to find a beautiful hash. The process brings time consensus to decentralised network which helps to create digital scarcity. An obvious consequence of that global race is that the guessing process consumes a lot of computing power and elictricity which is a major concern of normies. In addition, more and more countries now ban their citizens to mine or even own Bitcoin (which’s funny). What these people do not realize is that by cutting the demand for some naturally scarce good, they force people to keep their savings in some cringy and higly inflationary fiat currencies that lose to crypto virtually in every aspect.
Resources
Ultra-based and exhaustive youtube video: How bitcoin works under the hood (the author have also made a blog post with transcript and pictures). There is one on Lightning network as well.
A bitcoin explorer and online mempool of bitcoin transactions: mempool.space
I will update this list while descovering new resources
Footnotes
This method is leveraged in a “Lightning network” that provides an off-chain protocol that aims to lower the fees and increase the transaction confirmation speed. All in a completely trustless way. ↩︎
Digital signature is a way to mathematically verify the authentity of the message. Unlike a hand signature, digital one is cryptographically bound to the particular message and therefore becomes invalid once the message is tampered. ↩︎
A bitcoin node is one of the computers that is connected to the network and runs bitcoin software. It maintains the blockchain while receiving transactions (and new blocks) from other nodes. Occasionally it finds new block solutions and gets revarded with fees of the transactions inside the block and with newly generated bitcoins (coinbase transaction) ↩︎
Nonce is a number that is guessed by node and acts as the main part of block solution. ↩︎ ↩︎