Decentralized digital currency. Part 2. Blockchain

In the previous section, we described the main idea of ​​a decentralized digital currency and its practical implementation in the form of Bitcoin. Like any new concept, Bitcoin in practice faced a lot of problems related to the protocol of the network and the protection of the integrity of the base. In this article we will discuss the current limitations of the network, alternative currencies with the solutions of those or other Bitcoin problems, and why big business became interested in the blockchain.













Part 1. Bitcoin

Part 2. Other (non) popular varieties of Bitcoin, blockchain

Part 3. Ethereum







Blocks



Bitcoin showed not only the consistency of the p2p payment system idea, but also offered a solution to the problem of public (decentralized) consensus. To the reader, at the initial stage, Bitcoin architecture may seem overly complicated. For example, if there are general rules and we can simply ignore incorrect / fraudulent transactions, then why are blocks and mining necessary? 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 entrance, a number of previous transactions are combined, and at the output, transfers to other accounts are made (see figure). Transfers that are received at the exit are called unspent transactions (UTXO), until they enter another transaction.













When creating a new transaction, UTXO is spent entirely, but if you only need to spend a part, then another transfer is added with the balance 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, up to the point of issue. To avoid this, transactions are packed into a block, which, in turn, is sealed with a beautiful hash and linked by other blocks on both sides. This gives us some kind of guarantee that the transaction entered into the block is valid and can already be referred to.







Having summed up all the UTXOs addressed to a certain account, we can find out its balance, therefore, at any 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 starts (almost) several transactions at the same time using the same UTXO. Due to network delays, the participants will receive these messages with different sequence, or they may even miss a part (see the diagram).













Of course, if we had a system that provides all participants with universal-exact time, we could have avoided this confusion, but this is back centralization from which we initially refused. To solve this problem, blocks and mining were invented, which determine the sequence and confirmation of these transactions. At the same time, several branches are mined, but the complexity of mining is adjusted so that, within 3-4 blocks, one branch is pulled out ahead, which fixes all transactions in the history forever.







Proof-of-work



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







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







  2. The attacker can cancel the transaction and return your money (see the scheme).








In general, such a state of affairs in a short period of time does not hurt much, 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, the other miners will run away, and this means the end of the network.







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







Other mechanisms for decentralized consensus



One of the major drawbacks of PoW is energy consumption. As a energy-efficient alternative, the Proof-of-Stake consensus protocol was developed, where the probability of creating the next block is higher for a participant with a larger share. This mechanism and other types of consensus are very well described.







Current Bitcoin Problems



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







The block size is limited to one megabyte, given the block creation time, it is more profitable for miners to handle high-commission transactions. Recently, there was an attempt to update the protocol by changing the structure and size of the block, which ultimately led to the network ramifying into Bitcoin Classic (BTC) and BitcoinCash (BCH).







Another disadvantage is the high threshold of entry for miners, it makes no sense to engage in mining without ASIC machines. In addition to this, the miners are united in pools for the sake of stable profit, and this is back some centralization.







Varieties



Namecoin is the very first Bitcoin fork that allows you to register names by entering them into the blockchain. There are d / spaces for domain names in the .bit zone, and id / for registering any name with related information. Thanks to a public consensus, within the network, you are guaranteed to own a particular 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 lower commission compared to Bitcoin. In addition, an algorithm was chosen for PoW that was supposed to complicate the mining on GPU cards and ASIC machines.

PeerCoin is the first currency with a hybrid model of PoW and PoS.

Zerocoin is a fully 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 smart contract is being developed, it is charged with money (like a commission, here it is called fuel) and sent to the network. The miners, in turn, processing the blocks, perform the bytecode of these applications, and remove fuel from these applications as pay for the work.







And what about the blockchain?



The way in which Bitcoin stores data together 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:









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 the private interbank blockchain, where anonymity is excluded and the participants initially trust each other. Accordingly, the mechanisms for protecting the network are simplified, and banks will simply have a tool to synchronize the base and jointly manage certain assets. Other necessary requirements can be the exchange of private data between participants, the connection of supervisory authorities, etc.







Initially, the blockchain solved 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 different kinds of fraud.







Here you can read more about the blockchain platform overview.







In the next part, the Ethereum platform will be described and examples of smart contracts will be analyzed.








All Articles