Decentralized digital currencies. Part 2. Blockchain

    In the previous part, we described the basic idea of ​​a decentralized digital currency and its practical implementation in the form of Bitcoin. Like any new concept, Bitcoin in practice has faced many problems related to the network operation protocol and protecting the integrity of the database. In this article we will discuss the current limitations of the network, alternative currencies with solutions to one or another Bitcoin problem, and why big business became interested in blockchain.



    Part 1. Bitcoin
    Part 2. Other (not) popular types of Bitcoin, blockchain
    Part 3. Ethereum


    Blocks


    Bitcoin showed not only the consistency of the idea of ​​p2p payment system, but also proposed a solution to the problem of public (decentralized) consensus. To the reader, at the initial stage, the architecture of Bitcoin may seem overly complicated. For example, if there are general rules and we can simply ignore incorrect / fraudulent transactions, then why do we need blocks and mining? To do this, we need to understand how the transaction and the prevention of double spending are implemented.


    Transaction


    In Bitcoin, when forming a transaction at the input, many previous transactions are combined, and at the output, transfers to other accounts are carried out (see figure). The transfers that result from the exit are called unspent transactions (UTXO) until they enter another transaction.



    When creating a new transaction, UTXO is spent as a whole, but if you need to spend only a part, then just another transfer is added with the remainder to your own account.


    If we do not have confidence in the validity of the previous transaction, then we will have to double-check the entire chain of transactions each time, up to the time of issue. To avoid this, transactions are packaged in a block, which, in turn, is sealed with a beautiful hash and is linked by other blocks on both sides. This gives us a certain guarantee that the transaction that fell into the block is valid and can already be referenced.


    Having summed up all the UTXOs addressed to a certain account, we can find out its balance, therefore, at any moment of time, the sum of all UTXOs is equal to the total amount of money in the system.


    Double spending


    In decentralized systems, it is difficult to synchronize the records of all users, there are problems with the sequence of transactions and double spending. Imagine a situation where a user launches (almost) simultaneously several transactions using the same UTXO. Due to network delays, participants will receive these messages with different order, or even they may skip part (see diagram).



    Of course, if we had a system that provided all participants with universal-exact time, we could avoid this confusion, but this is back centralization, which we initially refused. To solve this problem, blocks and mining were invented, which determine the sequence and confirmation of these transactions. Several branches are mined at the same time, but the complexity of mining is adjusted so that within 3-4 blocks one branch breaks ahead, which secures all transactions in the history forever.


    Proof of work


    As we recall from the previous article, PoW protects the integrity of the database. But what is a 51% attack and what actions in theory can be performed if someone (let's call him an attacker) has impressive resources.


    1. An attacker will be able to build the chain faster than others (and take the lion's share of the reward), but only in an honest way. The correctness of the block is easy to verify, and as soon as such activity is detected, bona fide participants will ignore such blocks and transactions.


    2. An attacker can cancel a transaction and return his money (see diagram).


    In general, such a state of affairs for a short period of time will not do much harm, except to roll back your own transactions and block others. But due to the fact that most of the reward will be taken by one participant, other miners will scatter, and this also means the end of the network.


    In 2014, the Ghash.io pool accumulated 51% of the power for several hours, and some miners left the pool on their own in order not to undermine the confidence in Bitcoin.


    Other decentralized consensus mechanisms


    One of the main disadvantages of PoW is energy costs. As an energy-efficient alternative, the Proof-of-Stake consensus protocol was developed, where the participant with a higher share is more likely to create the next block. This mechanism and other types of consensus are described very well here .


    Bitcoin Current Issues


    According to the rules of the network, on average, 1 block is created in 10 minutes. It is advised to wait about six blocks so that the transaction is considered explicitly fixed in the blockchain, and this is already an hour of time. Compared to interbank transfers, this is of course very fast, but still not suitable for small businesses.


    The block size is limited to one megabyte, given the time the block was created, it is more profitable for miners to service transactions with a high commission. Recently, there was an attempt to update the protocol by changing the structure and size of the block, which ultimately led to the network branching into the classic Bitcoin (BTC) and BitcoinCache (BCH).


    Another drawback is the high entry threshold for miners, it makes no sense to engage in mining without ASIC machines. In addition to this, miners are pooling for a stable profit, and this is back a kind of centralization.


    Varieties


    Namecoin is the very first fork of Bitcoin, which allows you to register names by writing them to the blockchain. There are d / spaces for domain names in the .bit zone, and id / for registering a name with related information. Thanks to public consensus, within the network, you are guaranteed possession of a specific name, while you regularly pay for it. Such a model is a worthy alternative to the current ICANN system, and in theory will eliminate problems with registrars.
    Litecoin is one of the popular forks. The transaction is 4 times faster and low commission compared to Bitcoin. In addition, an algorithm was chosen for PoW that was to complicate mining on GPU cards and ASIC machines.
    PeerCoin is the first currency with a hybrid PoW and PoS model.
    Zerocoin is a completely anonymous currency that allows you to track the movement of money.
    Ethereum is a platform that serves as a virtual machine for decentralized applications. For example, some kind of smart contract is being developed, they are refueling it with money (like a commission, here it is called fuel) and sent to the network. Miners, in turn, processing the blocks execute the bytecode of these applications, and remove the fuel from these applications as a payment for work.


    What about blockchain?


    The way Bitcoin stores data, coupled with consensus methods, has evolved into an independent topic. Prospects for implementation can be in any area where there is a need for consensus and a transparent base:


    • Finance, trade;
    • Insurance, betting business;
    • Public databases, registries;
    • Voting, e-government.

    Each area has its own requirements for the security model, data privacy, consensus mechanisms depending on the participants and the nature of the objects circulating in the blockchain.


    An example is a private interbank blockchain, where anonymity is excluded and participants initially trust each other. Accordingly, network protection mechanisms are simplified, and banks will simply have a tool for synchronizing the base and joint management of certain assets. Other necessary requirements may be the exchange of private data between participants, the connection of supervisory authorities, etc.


    Initially, the blockchain addressed the issue of double-spending digital assets, but in areas such as product tracking and insurance, there is a need for an effective method of serializing physical objects that prevents various types of fraud.


    Here you can learn more about the overview of blockchain platforms.


    The next part will describe the Ethereum platform and look at examples of smart contracts.


    Also popular now: