The theme of various cryptocurrencies and blockchains today has become quite popular and has ceased to be a lot of geeks, boomy about the revolution in the field of finance. But as soon as you try to delve into this topic, you will immediately encounter an information deficit: there is very little material that describes what is available, to the best of technical knowledge, about the concept and mechanisms of how these technologies work. Conventionally, all materials can be divided into two categories: either hardcore technical, where the first sentence begins to cry about cryptography, p2p, “digital gold”, etc., or marketing nonsense about the new Internet, capitalization of Bitcoin or as a kind of company / country I introduced the blockchain and solved all my problems. If you want to understand how this all works and what can be done with these technologies, then these articles are for you.
I will try to convey the basic idea of a decentralized cryptocurrency, the mechanisms of its work, as well as disassemble the various Bitcoin forks. I specifically omit many technical details so as not to burden the text. The main thing is to understand the essence, and then you can easily understand the wilds on your own.
Part 1. Bitcoin
Part 2. Other (non) popular varieties of Bitcoin, blockchain
Part 3. Ethereum
As soon as we try to understand the mechanism of Bitcoin's work, we immediately begin to conflict with our usual way of thinking, which flatly refuses to accept the concept of an uncentralized control system, without the levers of power influence on violators. But the question immediately arises: if nobody manages Bitcoin, how does it function? In 2008, a certain Satoshi Nakamoto came up with an elegant solution in which each member of the network trusts only his own base, which he maintains on his own, and the majority base if he does not have any records.
Let's try to explain on the fingers using the example of a small village that has decided to abandon paper money circulation and introduce a decentralized currency. Let it be a special village in which all residents know each other by name, can recognize by voice, are very well versed in shades of colors and worship the royal-purple color. So, residents agree that the new currency will work as follows:
When someone wants to transfer money to someone, he publicly declares this: I, John, transfer 100 coins to James;
Each resident has an accounting journal that fits all the money transfers that he heard. All translations of the day are recorded on one page, and the next day start with a clean slate.
4.1. For each transaction from this day, according to a special formula, a paint of a certain color and quantity is selected depending on the amount of transfer and recipients. Then all these jars of paint are drained into one vat and stirred well.
4.2. The ritual requires bringing the resulting mixture to a royal-purple color. To do this, in small doses, by a long and exhausting search, different colors are added to this mixture;
4.3. As soon as someone finds the necessary colors and their doses, he immediately records these data at the bottom of today's page, credits 50 coins to his account as a reward and announces it to all residents.
4.4. Residents quickly check whether he really found the correct proportions. If everything is correct, they approve the transfer-reward, close today's page and go to sleep.
Now more on the points:
As we remember, residents can easily identify each other by voice, respectively, if someone tries to transfer money not on their own behalf, the residents simply ignore this statement, and no one will make this transfer to their records.
Since all transfers are public, everyone knows how much money each resident has in his account, if John doesn’t have enough money, his transfer is ignored (no one makes his own records). Ideally, a single chain of records should be the same for everyone.
If someone has lost his journal or missed some translations, he polls residents and synchronizes his records. At the same time it is necessary to rely only on those records that are agreed with the majority.
Each network participant decides for itself whether to accept fraudulent transactions or not, and as long as the bona fide participants are in the majority, the system will function as it should. But what does “how to” mean, what goals did the developers of such a decentralized currency set?
The amount of money in the system should be limited, in this sense, the currency is like gold. No one should be able to print a lot of money, which in turn can lead to inflation and the depreciation of savings.
Remove restrictions associated with the minimum units of the current monetary system. For example, you want to sell your services for 1 kopeck, and maybe for a hundredth of a penny.
If everything is clear with the underlying idea, then we can move to a simplified technical implementation. Next, you need to know such things as hash, public key encryption and digital signature.
Each network participant generates an account / accounts for itself, where the account is just a pair of keys generated by the ECDSA algorithm (public key algorithm for creating a digital signature). The public key of the pair is used as the address of the account, and for transferring money from the account it is required to sign this transfer (transaction) with the private key. The transaction is broadcast to all network participants where there are special participants, miners, who are engaged in forming a single, consistent chain of history of all transactions (blockchain). Miners pack current transactions into a block simultaneously checking their correctness. In addition to the list of transactions, the block contains a hash from the previous block and some NONCE value. In order for the block to be considered correct, it is necessary to select a NONCE such that the hash of the whole block will be beautiful (with a large number of zeros at the beginning).
Since data hashing gives completely unpredictable values, it is very difficult to select this NONCE. The first transaction in the list of transactions is a special transaction (block reward) which awards the miner with a certain amount. As soon as the miner selects the required NONCE, he notifies everyone and other miners check the result of his work. This process is called mining, a single chain of blocks is created at the expense of it, and miners are rewarded for this work. The verification procedure is very fast, all transactions and the hash of the entire block are checked. If there are no errors and frauds, then each miner includes this block in his blockchain and continues to mine. If the block is included in the blockchain, then all transactions are considered to be completed, including the very special transaction that transfers the reward to the miner’s account.
The next part will describe the current limitations and problems of Bitcoin, as well as a survey of forks aimed at solving various problems.
Literature: on bitcoin and on Gitkhub .