The theme of various crypto and lockboxes has become quite popular nowadays and has ceased to be the lot of geeks babbling about the revolution in finance. But as soon as you try to understand this topic, you will immediately encounter an information deficit: there is very little material, which is described by an accessible, moderately technical language about the concept and working mechanisms of these technologies. Conditionally, all the materials can be divided into two categories: either hardcore technical, where the first sentence begins about the horror of cryptography, p2p, digital gold, etc., or marketing nonsense about the new Internet, bitcoin capitalization or some company / country Implemented blockade and decided all their 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 decentralized crypto currency, the mechanisms of its operation, and also to disassemble the various forks of Bitcoin. I specially omit many technical details in order not to load the text. The main thing is to understand the essence, and then you can easily figure out the wilds yourself.
Part 1. Bitkoyn
Part 2. Other (not) popular species Bitcoin, blockade
Part 3. Ethereum
As soon as we try to understand the mechanism of Bitcoin's work we immediately begin to conflict with our habitual way of thinking, which flatly refuses to accept the concept of an uncentralized control system, without leverage Influence on violators. But the question immediately arises: if nobody controls Bitcoin, how does it work? In 2008, a certain Satoshi Nakamoto, came up with an elegant solution in which each participant of the network trusts only his own database, which he leads independently, and the majority database if he does not have any records.
Let's try to explain on the fingers on the example of a small village that decided to abandon paper currency circulation and introduce a decentralized currency. Let it be a special village in which all residents know each other by name, will be able to identify by voice, are very well versed in the shades of flowers and worship the royal-purple color. So, the residents agree that the new currency will work as follows:
- All monetary movements are public, i.e. Everyone knows who, to whom, how many they have listed;
When someone wants to transfer money to someone, he says it publicly: I, John, list 100 coins to James;
Every citizen has an accounting journal where all the money transfers that he heard were entered. All translations per day are recorded on one page, and the next day they begin with a blank page.
- By the end of the day, residents make a strange ritual that fixes all transactions for that day, since the transaction is not considered valid until it is fixed. The ritual is laborious, but you can get a reward for it and so everyone wants to participate in this process. The procedure is as follows:
4.1. For each transaction from this day, according to a special formula, depending on the amount of transfer and addressees, the paint of a certain color and quantity is selected. Then all these jars of paint are poured into one vat and mix well.
4.2. The ritual requires bringing the resulting mixture to a royal purple color. To do this, in small doses, through a long and exhausting busting, add different colors to this mixture;
4.3. As soon as someone finds the necessary colors and their doses – immediately records these data at the bottom of today's page, credits 50 coins to their 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 translation-reward, close the current page and go to sleep.
Now more details on the items:
As we remember, residents can easily recognize each other by their voices, so if someone tries to transfer money not on their own behalf, the residents simply ignore this statement, and this translation will not be added to their records.
Since all transfers are public, everyone knows how much money each individual has in the account, if John does not have enough funds, then his translation is ignored (no one makes his entries). Ideally, a single record chain should be the same for all.
If someone has lost his journal or missed some translations, he polls residents and synchronizes his records. In this case, it is necessary to rely only on those records that are consistent with the majority.
- Selection of the necessary dose and colors of paints is a very laborious process, and it is very easy to check the result of work. Just take the transaction for this day, according to the formula, prepare the mixture and at the declared dose add the paint to the vat. If the royal-purple color turned out – it means everything is right and the residents agree to reward those who found the proportions. Once the page is sealed, all transactions are considered valid and remain in the history forever. Thus, the integrity of the database is preserved, and new money is also received into the system. The amount of compensation is reduced by half every 4 years, which limits the total amount of money in the system. And if in the next page you add the found proportions of colors from the previous page, then the pages will be linked and no one can change the transactions backdating. At the slightest change in the records, it is necessary to recalculate the doses of paints for this and all subsequent pages, in addition, it is necessary to convince the majority of residents to replace their own records with new ones.
Each member of the network decides whether to accept fraudulent transactions or not, and while the bona fide participants are majority, the system will function as it should. But what does it mean "as it should", what are the goals of the developers of such a decentralized currency?
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 depreciation of savings.
Remove the restrictions associated with the minimum units of the current monetary system. For example, you want to sell your services for 1 kopeck, or maybe for a hundredth of a penny.
- Guarantee that any correct generated money transfer will be carried out, due to the lack of a single point of failure, unless the entire Internet will be disconnected. No organization, not even the state, should be allowed to roll back / block the transaction.
- In order to deceive the system, or to change the rules, it is necessary to convince the majority of participants (> 50%) of the network, etc.
If everything is clear with the basic idea, then we can proceed to a simplified technical implementation. Next, you need to know such concepts as hash, public key encryption and digital signature.
Each member of the network generates an account / account for itself, where the account is just a pair of keys generated Algorithm ECDSA (algorithm with a public key to create a digital signature). As the address of the account, the public key from the pair is used, and to transfer money from the account it is required to sign this transfer (transaction) with a private key. Transaction is broadcast to all network members with special participants, miners, who are engaged in the formation of a single, consistent chain of history of all transactions (blocking). Miners pack the current transactions into a block along the way to verify their correctness. In addition to the transaction list, the block contains a hash from the previous block and a certain value of NONCE. In order for the block to be considered correct it is necessary to select such a NONCE, in which the hash of the whole block will be beautiful (with a large number of zeros at the beginning).
Since hashing of data gives completely unpredictable values, it is very difficult to pick this NONCE. In the transaction list, the first is a special transaction (block reward), which rewards the miner with a certain amount. Once the miner selects the correct NONCE, he notifies everyone and the other miners check the result of his work. This process is called mining, at the expense of which a single chain of blocks is created and for this work the miners receive a reward. The verification procedure is very fast, all transactions and the hash of the entire block are checked. If there are no mistakes and fraud, then each miner includes this block in his block and continue to continue to mine. If the block is included in the block, then all transactions are considered perfect, including the very special transaction that remunerates to the account of the miner.
- All transactions are publicly available.
- There is a generally accepted set of rules, but to observe or not – everyone decides independently. There is no central body with methods of power influence on violators.
- A transaction is considered successful (approved) if it was packaged in a block.
- Transactions that are packaged in a block are considered valid, since they are checked multiple times.
- We should encourage the process of validating translations and involve more participants in this matter.
- But at the same time, the packaging process must be complicated. For this, the principle of Proof-of-Work is used. It is required to solve a resource-intensive task whose result is easy to verify.
- The block is considered packed if it has a nice hash, for this you need to sort through the variable NONCE in the block for a long time. Finding a suitable NONCE is tricky, and verifying the hash is easy. The person who has found the right value gets a reward.
- Each block contains a hash from the previous one, a chain is obtained from blocks that grows in one direction.
- Sometimes a chain can branch, but the longest branch will be valid. To create a block with fictitious transactions and to increase this branch, attackers will have to spend more computing resources.
The next part will describe the current limitations and problems Bitcoin, as well as an overview of forks aimed at solving various problems.
Literature: about bitkoyn and on Gitkhab.