JavaRush /Java Blog /Random EN /About cryptocurrencies. Not so creepy crypto part one: bl...

About cryptocurrencies. Not so creepy crypto part one: blockchain technology

Published in the Random EN group
Cryptocurrencies remain one of the most hotly discussed news topics related to IT lately. People are interested in earning on the growth of the course and mining of various coins, but few people understand what they are. And even if you want to understand what it is about, you will find that most of the articles about blockchain and mining are written by those who are deeply in the subject and for those who are familiar with it firsthand. The terminology and basic concepts used in the articles imply a level of knowledge above the average. In this series of materials, we will try to reveal the principles of blockchain and cryptocurrencies, explaining everything literally on the fingers. And today we bring to your attention the first part - about blockchain technology.
About cryptocurrencies.  Not so creepy crypto part one: blockchain technology - 1
Understanding the essence of blockchain technology (blockchain), an analogy with a stone ax or a spear comes to mind. For a long time, mankind used stones and sticks separately: they dug with sticks, and threw stones at predators or cracked nuts with them. But by combining them together, people got much more effective tools and weapons. So the blockchain is a combination of a database and encryption technologies, resulting in a completely new tool that has new interesting properties. An additional property of the blockchain is to guarantee the integrity and immutability of the stored data .

How a chain is built

The principle of operation of blockchain technology is simple, like everything ingenious. Imagine a notebook that records data: birthdays, notes in a personal diary, money transfer details, whatever. When a page (called a block) ends, a hash of its content is generated.
A hash is an alphanumeric string generated by a special algorithm based on the data sent to it. It is used to check the integrity and validity of information.
We will not consider the “internals” of the hashing algorithm, but imagine it as a black box. This box is useful in that when any data is transferred to it, it creates a unique string. For example, if we pass “12345” to it, then we get “F5” at the output, and if we pass “12354”, then the output will be “2T1”. And every time we pass the same data into it, we get the same results. The second useful property of a hash is that having it in hand, it is impossible to get input data from it. But with its help, you can check the validity of the hashed data - if you know the hash of the transmitted information (usually it is made public), then you can run the received record through the hash algorithm and compare the result with the existing standard. If the hashes match, then the data is correct, and if not, then
About cryptocurrencies.  Not so creepy crypto part one: blockchain technology - 2
So, having received the hash of our data page, we send it to the archive (database), and add the hash of the pending page as the first entry on the new page. Thus, using hashes, we link data blocks into one chain: from the very first to the current one. This is where the name blockchain (chain of blocks) actually comes from . Such a relationship allows you to guarantee the validity of the data in the stored blocks. If someone tries to change them, then the hash stored in the next block will not match the hash of the recreated block.

Blockchain security - three protection options

However, the hash itself is only part of the protection. After all, if someone really wants to replace the data, then he can regenerate the hashes of all subsequent blocks and replace the entire chain. Therefore, for additional security, three different options for protecting the data chain can be used: centralized with a trusted certificate authority, centralized with an untrusted authority, and decentralized blockchain. In the first case, each block is additionally signed with a certificate from a trusted authority. So, by checking the signature, you can make sure that the block is original or fake. In principle, the use of blockchain in this version is more of an additional reinsurance than a necessity.
About cryptocurrencies.  Not so creepy crypto part one: blockchain technology - 3
In the second case (if there is no 100% certainty that the certificate authority will not be hacked), the generated and signed hashes are placed in an independent trusted store. Such a storage can only accept new data, but does not allow them to be edited or deleted. The third option, decentralized blockchain, is the most interesting, as it is the one used in cryptocurrencies. In this case, when a data block is typed (it is identical for everyone), all network participants begin to generate a hash. But the hash is not just a block, but a block with a seal.

Not valid without stamp

What's the seal? The fact is that in order to ensure the security of the data chain, we need to complicate the generation of a hash for blocks. To do this, the conditions for the correctness of the hash are introduced - it must correspond to some parameters. For example, every second hash character must be zero. Accordingly, to fulfill this condition, a line is added to the data block that provides the desired result and “seals” the block. And since hashing is a one-way process, we cannot directly obtain its value from the given conditions, and are forced to search for the desired string by simply enumerating the values. And it is the process of searching for a seal that is called mining - by analogy with sifting sand in search of a grain of gold. When one of the network members finds a seal, he sends it to the others and they check the correctness of the solution. At this stage, an additional verification of the block data takes place. If everyone (more than 50% of the network participants) has everything together, but someone does not, then the blocks of refusers are considered to be failed and they download the correct data from the network. If the seal does not suit the majority, then it is discarded and its creator downloads the correct version of the block.
About cryptocurrencies.  Not so creepy crypto part one: blockchain technology - 4
Due to the difficulty of finding the seals, trying to replace the old block and regenerate all subsequent blocks requires very large computing power. Because of this, data substitution by a malicious loner is almost impossible. Attacking a newly created block is more realistic. But it is possible only if the attacker controls more than 50 percent of the users in the blockchain network (for example, he owns a pool with which many miners work). This type of attack is possible only on “young” decentralized blockchain networks, in which there are still few participants. If the network is large, then in order to “outweigh” it, you need a very, very, VERY large pool, or collusion of several pool owners covering most of the network. Since the number of participants in blockchain networks can change, they provide for auto-adjustment of the hash search complexity after an equal number of completed blocks. If the computing power of the network grows, then the task becomes more complicated, if the network power has decreased and the print search takes a long time, the task is simplified. This is how the normal pace of the network is achieved - blocks with transactions are regularly sealed (in the bitcoin network - once every 10 minutes) and the search for a solution for the next portion of data begins.

Subtotal

Decentralized systems have both advantages and disadvantages compared to centralized ones. They are more resilient in general terms and are not subject to cataclysms - some of the network participants may suffer from earthquakes and hurricanes (which will reduce its performance), but the system itself will not die from this. In a centralized system, it is enough for an earthquake to destroy the data center to bring it to its knees. At the same time, decentralized systems are subject to quantitative attacks. It is enough to gain control over more than 50% of the participants in order to be able to add information that is beneficial to you and delete unprofitable information. In a centralized system, for the same level of access, very well-protected central servers need to be hacked. In general, there is no perfect protection, and security measures need to be constantly and tirelessly improved in any system. Not so creepy crypto. Part Two: Cryptocurrencies and Mining
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION