The mechanism of commissions in Bitcoin and why be friends with miners

    In this article we will try to describe in detail the main task of the commissions in Bitcoin, how they work and what they influence. We will explain the reasons for the volatility of commissions, the delay in confirming transactions and describe the approaches to solving these problems. In addition, we clarify exactly how the update Segregated Witness helps to reduce the cost of transactions. And as a bonus, we will share our thoughts on how friendship with miners reduces commissions to zero and what this trend may lead in the future. So let's get started.

    Full transaction confirmation time


    It is important to distinguish between the processing of transactions (verification) and the process of their confirmation (confirmation). On the Bitcoin network, transactions are processed almost instantly, and confirmed - for an hour. In other digital currencies, everything can be done in a couple of seconds. What determines the time for full confirmation of a transaction in a decentralized environment? Mainly from the mechanism for achieving consensus.

    In its purest form, PoW cannot achieve consensus in less than one hour. In turn, PBFT- based consensus protocols and DPoS- based protocols can achieve consensus in a few seconds. However, the level of decentralization and independence of such systems is much less than in Bitcoin.

    image

    According to the rules of the Bitcoin protocol, the owners of most of the computing power must confirm the transaction (the block containing this transaction) in order for it to be considered fully confirmed. That is, on the basis of the block in which the transaction received the first confirmation, several more blocks should be constructed. Moreover, this chain should be the longest, and there should be no competitive chains. The number of these blocks (transaction confirmations) is determined by the payee at his discretion. He is guided by the rule that states that the more evidence a transaction has, the less likely it is to cancel it.

    Bandwidth limitations


    With the growing popularity of Bitcoin, the flow of new transactions in the network has increased significantly. It is known that the block size is determined by the protocol rules and is strictly limited. In Bitcoin, the maximum block size is 1 MB, therefore bandwidth is limited (1.7 KB / s). If the flow of new transactions exceeds throughput, not all of them will be processed. And such situations happen quite often. Which transactions will receive confirmation first, and which ones will wait - this is a question that requires a clear answer. Its essence is that transactions must compete with each other.

    Role of commissions


    The mechanism of commissions in Bitcoin is necessary to pay for the services of a distributed network, where the network service, in essence, is reliable data storage. Bitcoin users actually pay for each byte of data added to the common database. Due to the fact that the bandwidth of this database is limited, users compete with each other for recording priority.

    image

    By forming transactions, users set a commission in the form of a certain amount of satoshi for one byte of data. In addition, each validator node lays out all unconfirmed transactions in a queue in such a way that it first confirms transactions that pay a large commission per unit of their weight. Obviously, those transactions that end up in the queue may remain unconfirmed for a long time.

    Another important task that the commission’s mechanism solves is the “tragedy of the communities”. In the context of Bitcoin, transactional spam protection is implied. The presence of mandatory commissions means that it will be expensive for an attacker to clog the network with fake transactions for a long time if he has such intentions.

    Record price volatility


    Bitcoin users occasionally encounter unusually high volatility of commissions. For example, in 2017, the average price of writing one byte of data to the Bitcoin blockchain ranged from 1 to 500 satoshi. And the queue of unconfirmed transactions ranged from a few KiB to tens, and even hundreds, of MiB.

    Due to the fact that the price of data recording can change dramatically, users are forced to compete with each other almost blindly. This is because the actual transaction will be confirmed on average within 8 minutes, while the processing fee must be set before it is signed. Therefore, the question of a properly established commission still remains relevant, because everyone wants to quickly confirm their transactions at minimal cost. Naturally, paying more than 50 USD for a typical transaction is not the best option, especially when you can save up to 90% of this amount if you correctly calculate the commission.

    The consequences of a sharp increase in the flow of new transactions is the emergence of a large queue of transactions waiting to be written to the blockchain. Among them are those transactions, the senders of which either did not pay attention to the change in the price of the record, or formed a transaction at the time before the sharp increase. Often the problem lies not in the user himself, but in the software of the wallet or bitcoin management services. The active user is often found software products for working with Bitcoin, in which the management of commissions is generally hidden.

    Solving the problem with commission volatility


    Regardless of whether it is possible to manually control the priority of a record of transactions formed, Bitcoin wallets can use mechanisms to evaluate the current price of data recording, instead of using constant or manually updated values. This gives the wallet a big advantage in terms of managing the priority of recording transactions in a common base and saving money on commission.

    It is worth noting that forecasting the price of recording is also possible, but often such forecasts work only for very short periods of time (on average a few minutes). If the forecast is outdated, and the transaction has not been confirmed, then it is likely that you can wait for its confirmation for a long time — most often several hours, and sometimes days.

    transaction fee = transaction size * byte price

    Dynamic or adaptive calculation of a transaction fee means an automatic estimate of the total transaction size in bytes and an estimate of the price of writing one byte to the Bitcoin blockchain for the next few hours. For both estimates, there are specific algorithms for analyzing transactions and online activity. After receiving an estimate of the size of the transaction in bytes and the price of recording one byte, these values ​​are multiplied, and the actual amount in Bitcoins is obtained, which must be added to the transaction as a commission.

    The advantage of the approach with an adaptive assessment is the inclusion in the transaction of a more accurate commission, which will be above the minimum threshold, but not too high, which saves the user. Moreover, the likelihood that a transaction will be deep in the unconfirmed queue is minimal. Nevertheless, there are exceptions. Therefore, we consider in more detail what is important to do in an emergency.

    Commission increase after transaction sending


    Note that the Bitcoin protocol is very flexible with respect to commissions. For example, there are two protocol enhancements: replace-by-fee and child-pays-for-parent, which allow you to increase the commission of an already formed and sent transaction. Unfortunately, very few wallets implement this functionality for the convenience of their users, although over time they become more.

    In addition, this feature has a number of technical nuances and organizational requirements for its correct use. One of these requirements is that the user (or software in automatic mode) must re-evaluate the transaction commission, form and sign a new (alternative) transaction, distribute it to the network and continue monitoring its status.

    How Segregated Witness helps


    One of the changes in the protocol, which made the update Segregated Witness, is the introduction of a new transaction format and its weight (transaction weight). Before the advent of Segregated Witness, only the transaction size was usually taken into account when calculating the commission. Now the size, transaction and its weight are important. The new transaction stores evidence of possession of coins in a separate structure (witness data). To convert a transaction size (total size) to its weight, the size of witness data is multiplied by a smaller factor than the rest of the transaction data. The transaction weight is calculated using a special formula:

    weight = base size * 3 + total size .

    In this case, base size is the size of the transaction, regardless of the witness data size. As you might guess, any data that is included in the witness data requires 4 times less commission than the rest of the transaction data. This approach allows miners to determine a more profitable transaction in relation to the place occupied in the block and the remuneration received.

    It is known that about 60% of all transaction data is made up of evidence of possession of coins (i.e., such that can be recorded in witness data). Accordingly, the weight of transactions of a new format will significantly decrease. Thus, the user can pay less for confirmation of a new transaction, while it will have the same priority for miners when included in the block, as the old transaction with a higher commission.

    image

    The diagram shows the dependence of the price of writing one byte of data in the Bitcoin blockchain on the load (stream of unconfirmed transactions), expressed in bytes per second. The conclusion can be made very simple: if the flow of new transactions is lower than or equal to the bandwidth of the accounting system, then the cost of writing is almost zero. And if the flow of new transactions exceeds throughput, the price rises sharply upwards.

    Option with a friend miner


    Imagine that you have a friend who is mining and controls 10% of the total computing power involved in the Bitcoin network. On average, it generates a block once every 100 minutes. In this case, you can form your transaction in which you set a zero commission, and then send this transaction to your friend for confirmation.

    image

    The first confirmation of your transaction with a probability of 50% will be received within 50 minutes, and a full confirmation - on average 50 minutes after the first. As a result, your transactions will receive a full confirmation in approximately 100 minutes. If you did not have such a friend, the transaction would receive full confirmation for approximately 60 minutes, but already with the payment of a full-fledged commission.

    As you can see, when it comes to saving money, then you are lucky if you have a friend miner. But if there is no such friend, then there may be alternative payment options for a place in the block.

    Option with place tokenization


    Usually the miner operates according to the standard scheme and sorts transactions at the price of writing 1 byte of data into the blockchain. It seems that now everyone is doing so. However, it is possible that the miner may have better motivation. He can independently formulate a policy of monetization of his activity. In other words, he may act outside the box regarding transactions that he will write to his block. If there are more favorable conditions than simply to take the commission for your transaction, most likely, it will change its policy.

    This approach assumes that users will pay the miner for confirming their transactions not through a pre-established commission, but directly (according to their own scheme).

    In practice, any sufficiently large mining pool can conduct its campaign in order to increase profitability and use simple mechanisms for this, for example:

    • determine your transaction sorting priorities;
    • to enter into a partnership with a certain service (stock exchange, store, browser);
    • sell guarantees for some place in the block in the future.

    Moreover, a pool can even tokenize free space in its blocks (yes, to sell tokens).

    Conclusion


    Probably in the future we will see a lot of different ways to pay for writing to the “most reliable database on Earth”. Considering the interest of many services and applications to the properties of this database, there have long been third-party solutions for adding arbitrary data to the Bitcoin blockchain for the purpose of reliable “fixing” (timestamping). But such solutions do not fit well into the ecosystem of applications, and it is difficult for developers to monetize them.

    At the moment, the option of pushing the transaction “out of friendship” and the option of tokenization of free space in the blocks may seem comic, but at the current pace of development of the industry, such scenarios may be quite feasible. Moreover, they can become major in the relationship between users and validators, but this is not certain.

    Also popular now: