What You'll Learn
What technology is the cryptocurrency based on?
How Blockchain Works
Why Cryptocurrency Transactions Are Reliable
What You'll Learn
Understand how mining farms work
Distinguish between types of blockchains
In the previous lesson, we figured out the basics and learned about Bitcoin, the main digital asset in the cryptocurrency world. At the same time, both Bitcoin and other coins (for example, Ethereum) are based on blockchain technology.
Compared to machines, bitcoin and other currencies are brands, but blockchain is the engine. So let's take a look under the hood and try to figure out what gears are driving the alternative financial system.
What is blockchain?
Blockchain (translated as "chain of blocks") is a continuous sequential chain of blocks containing information built according to certain rules. In essence, a block is a unit of information on a blockchain.
The connection between the blocks is provided not only by numbering (block 3 follows block 2), but also by the fact that each block contains information about both itself and the previous block.
What's in the blocks themselves? They record various transactions, such as a transfer from one bitcoin address to another. But that's not all. The transactions that make up the blocks can contain not only the transfer of value (for example, bitcoin), but also the transfer of data.
Thus, blockchain is a technology for storing, processing, and transferring data and value. The difference from a simple database (a server in the basement of a company) is that a blockchain is stored on many computers.
Many people confuse cryptocurrency and blockchain. There can be many cryptocurrencies, but each of them is based on some kind of blockchain
A change in the database occurs for all network participants (e.g., miners) that support a particular blockchain. But only if they all agree to the changes. Such agreement is called consensus.
The term "blockchain" first appeared as the name of a database (like Oracle or MySQL) of the Bitcoin system, but since then, blockchain has become a common technology, which is most often identified with a ledger (list) of cryptocurrency transactions.
To put it simply, the blockchain scheme is as follows:
1. John wants to send money to Dirk.
2. The transaction is recorded in a block.
3. The block becomes visible to all network participants.
4. Network participants (miners) confirm the transaction.
5. The block is recorded in the ledger and becomes part of the blockchain.
6. Dirk gets money.
What is a hash?
A hash is the result of encrypting some data. This can be thought of as squeezing or packing a tent into a cover. That is, a hash is a derivative of all the information contained in a block.
There are various encryption standards for obtaining hash sums – for example, Bitcoin runs on the SHA256 standard.
It's important to note that the word "encryption" is used for simplicity. It would be more accurate to say "hashing" because a hash, unlike a cipher, cannot be reverted to its original state using a key.
The whole point of hashing is that if you change at least one byte of information in the first block, the hash of that block will be different. And since the hash of the second block contains the original hash of the first block, it is impossible to change the first block without changing the second block. And so on. In this way, the immutability of the entered data in the blockchain is achieved.
Who does the hashing?
So, the information in the blocks is stored in encrypted form. Its processing is carried out by miners, who, with the help of their equipment, ensure secure data transmission.
Mining is the process of issuing new blocks, building a chain. Miners perform hashing, that is, encrypt data and match the hash to the block. These are complex mathematical operations that require significant computing power. Miners receive a reward for the next block and fees that users pay for transactions.
Any person or company that buys and installs special equipment can become a miner. It can be both special hashing equipment (bitcoin mining) and video cards (ethereum mining).
Theoretically, any technique capable of performing the simplest calculations can mine. There are even known hackers who, a few years ago, connected to refrigerators through smart home systems and mined coins on them while the owners were sleeping.
Don't rush to the fridge, this story is a thing of the past. Every year, the calculations for mining become more and more complicated, so you will not earn much on the operation of your white friend or the video card from your old laptop.
If earlier it was possible to easily equip a mining farm on your balcony or in the basement in the country, now, along with the increase in the complexity of calculations and the rise in the price of cryptocurrencies, the cost of mining has also increased. It's all about the cost of electricity — now you need your own hydroelectric power plant to make money. Or a wholesale contract with a manufacturer.
By the way, not only private investors or companies, but also entire states are engaged in mining. For example, El Salvador uses the energy of a volcano to mine bitcoins
Let's take a look at the work of mining using the example of El Salvador. A geothermal plant is being built on the volcano, due to the high temperature, it converts water into steam, which enters a turbine generator and generates electricity. As a result, mining equipment performs calculations on green energy.
Due to the fact that El Salvador has many volcanoes and water, electricity is cheap. Well, the cheaper the electricity, the more profitable mining is. The country has also legalized the circulation of cryptocurrencies and keeps part of its reserves in bitcoin.
Therefore, large miners are trying to do business in those countries where they can buy kilowatts for pennies, as well as legalize their business. We'll talk more about regulation in the sixth lesson.
How Transactions Are Carried Out
So, miners are network participants who process transactions and make money from it. And how do transactions technically get into a block?
Let's say you have a wallet (electronic, of course) with 1 BTC. You want to transfer 0.5 BTC to a friend. First, the transaction goes to the so-called mempool, which is the transaction queue of all users on the network. Not all transactions can be included in the next block: the block volume is limited.
The order of precedence is determined by the fee that users are willing to pay. This can be compared to individual apps for calling a taxi: the more money you charge for the ride, the faster you will leave.
What about the commission
Different blockchains have their own nuances, but in most cases, users decide for themselves how much they are willing to pay for a transfer. Therefore, those who are willing to pay more will be the first to get into the block. The rest will have to wait for the next block.
For example, in the Bitcoin network, a new block is formed approximately every 10-15 minutes. Accordingly, if the sender of the transaction sets too low a fee, then he can wait several hours before his operation hits the block and is executed.
As a rule, the commission in blockchain networks does not depend on the amount of value sent. So, if you transfer bitcoins for an amount equivalent to $100, you can pay the same fee as a large investor who transfers bitcoins worth $100 million. For example, in 2020, a $1 billion transaction was recorded, for which the user paid only $80 in fees.
Who is responsible for security?
For example, imagine the following fairy-tale situation: some crooked programmer decided to make some extra money. He connected to the blockchain, created a fake block about transferring money to his wallet, and sent it to the network. Who's going to stop him?
As you remember, blockchain is a distributed ledger, that is, data about previous transactions is stored on many devices at once. If there is no information about our crook's transactions anywhere but his own device, then the fake block will simply be rejected by the network.
As such, each block has to go through a verification procedure where the network looks for proof of the legitimacy of the operation and comes to a consensus. And who is looking for this evidence?
In addition to miners, there are also nodes (nodes) in the blockchain network, which are computers that contain the entire history of the blockchain, that is, they store a complete copy of all operations. Nodes are not necessarily mining devices. Conversely, not all mining devices necessarily hold the full history of the blockchain.
The specific way it works depends on the blockchain's consensus algorithm. There are two main ones.
1. Proof of Work
Many secure blockchains, such as Bitcoin, use the Proof-of-Work consensus protocol, in which miners need to solve complex hash search problems in order to create blocks. These protocols consume a large amount of computing power and power, which reduces bandwidth and increases network latency.
2. Proof of Ownership
In addition to proof-of-work, there is also the so-called proof-of-stake, abbreviated as PoS. Examples of such networks are Ethereum, Cardano, and others. In these networks, blocks are formed not by miners, but by validators or nodes (nodes). Validators (network participants who are engaged in verification) hold coins on their balance, due to which they guarantee their decency.
Decency, in this case, means their willingness to form transactions correctly, that is, not to transfer coins from address to address that do not exist.
Validator coins act as collateral. If the validator violates the rules, he will lose part of his stake (coins lying on the node). The more stake a particular validator has, the more often he mines a new block and earns commissions.
In such networks, security is more difficult to ensure, since it is enough to buy tokens and run a node to control the network, that is, this is purely economic protection.
And in the case of Proof-of-Work, you need someone to produce the equipment, then you need to buy it, install it, and pay for electricity.
At a glance
Blockchain is a distributed database.
The security of data transmission in the blockchain is ensured by encryption.
There are two main types of blockchain: the first is based on computation, and the second is based on a high share of ownership of the network's product.