Anyone who has minted an NFT or transferred cryptocurrency somewhere at least once knows that there are transaction fees in blockchains. In this article I will tell you why they are needed and how to save on them.
There are two main reasons why blockchains have fees (network fees). The first reason is support for miners/validators. They are necessary to confirm transactions. The second reason is to ensure network security. The commission acts as a defense against attacks. Thanks to the commission, attackers most likely will not launch several hundred thousand transfers at the same time - it will simply be very expensive.
Transaction fees are collected differently on different blockchains. In this article I will talk about how it works for Bitcoin and Ethereum. But first, a little educational program.
A miner is either a person who is engaged in mining (“mining” cryptocurrency on his computer) or a program that packs transactions into blocks.
A validator is either a person who has N pieces of cryptocurrency (in the case of Ethereum, in order to become a validator you need to have 32 ETH) and has a validator program on his computer, or the program itself, which packs transactions into blocks.
If anyone wants an article in which I will talk about miners and validators in more detail, just write in the comments.
1) #биткоин . When sending a transaction, a check is made to ensure that it is correct and that the sender has a sufficient number of coins. After this, the transaction enters a special transaction queue called the “mempool”. The transaction will remain in this queue until it is packaged into a block. Until the transaction is added to the block by the miner, it is considered unconfirmed. A miner should be understood not as a person, but as a special program. Once the transaction has been recorded in the block, it is completed. Transactions do not exit the mempool in the order in which they were received. The higher the commission the sender pays, the more priority its place. Because of this, transactions with a small commission may take longer to complete. You can read more about Bitcoin transactions in the article that I left in the comments.
2) Ethereum. When sending a transaction, everything happens approximately the same as in the Bitcoin blockchain. A significant difference is that validators, not miners, are responsible for confirming transactions on the Ethereum blockchain. The algorithm for forming the commission is also different. The cost of the commission depends on the complexity of the transaction and network congestion. The cost of the commission includes 2 parameters - the gas limit (GAS limit) and the GWEI. GAS is a unit of measurement of the computing power that will be expended in carrying out a transaction. GAS limit is the maximum amount of computing power that can be spent on a specific transaction. For example, when transferring ETH from one wallet to another, the GAS limit is 21,000 GAS. This does not mean exactly how much gas will be spent, this is only the maximum value. GWEI is the cost of gas. 1 GWEI is equal to 1 nanoether or 0.000000001 ETH (10^-9 ETH). As a result, the commission is equal to GAS limit * GWEI.
And now to the fun part. Everyone knows that modern wallets themselves calculate the optimal commission and offer it to the user. On some wallets, such as MetaMask, the user has the option to change the fee and try to make a transaction with the changed fee. But this does not mean that the transaction will be completed. Next, I will only talk about my experience of using it and only with regards to the BSC network. If you try to set a commission amount less than the proposed one, the transaction simply will not go through. But this can be circumvented. There are services that allow you to change fees in wallets. To do this, you need to select the desired blockchain and click “Add Network”. A new network will be added to your wallet, in which transactions will already be sent with the changed commission. Essentially, this is the same main BSC network, only with a software “layer” that allows you to change the commission, but you need to take into account that if the commission amount is reduced, the transaction will take longer.