Bitcoin: understanding and optimizing the fees for your transactions
After a discussion with members of a Facebook group, I realized that the notion of fee in bitcoin transactions was poorly understood.
The fees are not proportional to the amount of the transaction.
This is quite normal given the complexity of this currency, but above all it escapes a usual rule: the fees are not proportional to the amount of the transaction. Explanations.
Miners want to maximize their earnings
A “minor” is someone who will “to work“To add a set of transactions in a block, which if all goes well will be added to the famous blockchain.
This work requires a lot of expenditure of calculation and therefore of expenditure of energy and money.
If this work bears fruit (addition to the blockchain), it is rewarded in 2 ways:
- Via the algorithm which provides for the creation of bitcoins attributed to the miner. Currently it is 12.5 BTC per block. This amount is divided by 2 every 4 years (next division in June 2020).
- Via the fees of each transaction: each transaction can leave a tip to the miner so that he can quickly add it to a block.
The difficulty of this work does not depend on the number of the transaction
But important point, the difficulty of this work does not depend on the number of transactions. It is therefore in his best interest to put as many transactions as possible in a block to have the maximum fees. Unfortunately as shown in the diagram below, the number of transactions that can be put is limited by the size in bytes of the transactions:
So if a miner wants to maximize his income he must put as much as possible into transactions that are not large in terms of bytes and that have as much fee as possible. This is why a miner looks first and foremost in a transaction at the fee / weight ratio of a transaction.
It is generally expressed in Satoshi by Bytes (= byte) or shorter Sat / B(Recall 100,000,000 Satoshi = 1 BTC).
At the moment the fees for a quickly validated transaction will cost you 14 euros.
At the time of this writing, to be added quickly we must put approximately 400 Sat / Bytes in a transaction. A typical transaction of 226 bytes, this currently represents more than 14 euros per transaction.
So it can be interesting to figure out how not to make mistakes that could cost you all your bitcoins.
Calculating the size of a transaction and optimizing it
First optimization: have all your bitcoins on a single address
To receive bitcoins you need a nickname that is more commonly known as a “bitcoin address”.
The important point is that you can create as many nicknames as you want. This can be useful to remain discreet and anonymous but it can have consequences on your famous fees.
Let’s say you have 2 BTC on one address and 3 on another (let’s be crazy!) And to buy a Tesla you need 4 BTC. It behaves like coins (hence the term “coin” of bitcoin): you must give 5 BTC and indicate that you want change, specifying on which address. If you don’t, the rest will go entirely to the minor, it’s the famous fairy.
In this example there is no fee (3 + 2 = 4 + 1). The addresses used to send money are called “input”, and those used to receive them the “output”. Note these terms carefully because they are the ones that largely define the size of transactions in bytes.
We have approximately:
The most classic example is nb_input = 1 (all the money comes from one address) and nb_output = 2 (you send the money to one address but you get the change from another). Which gives 1 * 148 + 2 * 34 + 10 = 226 bytes, value cited above.
For the more curious, the input is larger because it requires defining the origin of his gain and include a signature script.
I made an excel that you can copy to simulate the fees for different values of input, output.
This table shows that to reduce the size of your transactions (and therefore your fees) you must have your money in one address. This address can obviously change over time. Moreover, when you indicate the address where you want to collect the change, most software offers you a new address for more discretion.
Second optimization: invest large amounts compared to current fees
As we have just seen, the fees do not depend on the amount of your transactions. The higher the latter, the lower the fees will be proportionately.
- For 140 euros of BTC -> the 14 euros represent 10% of the transaction
- For 1400 euros of BTC -> the 14 euros represent 1% of the transaction
- For 14,000 euros of BTC -> the 14 euros represent 0.1% of the transaction
We see it more we bet large amounts the lower these fees are as a percentage (in the end this is what matters most in my opinion). It would therefore be interesting to play “group” to minimize transaction costs.
Third optimization: anticipate your transactions
As we saw above, the more your transactions have a significant Sat / B ratio, the more the miners are likely to quickly add your transaction to the next block. It is therefore necessary to have a “Sat / B” rate which corresponds to the current price. If you are too high you will be giving away money for nothing, and if you are too low your trade may take several days to complete.
If we look at this site, we can see that by waiting 6 blocks (about 1 hour) we can therefore reduce on average by 25% your transaction fees. So if you are in no rush and send the transfer before going to bed you can even go a little lower.
Be careful not to do as I did: I tried a rate of 42 Sat / B and my transaction has not been validated for almost a week …
We understand with these transaction fees that bitcoin is not currently suitable for micro-payments. This is good because the size of a block (1Mo), of a transaction (226 bytes in general), the time between 2 blocks (10 minutes) means that the system can only validate 7 transactions per second:
- By block we can have 1024 * 1024/226 = 4640 transactions
- A block is added every 10 minutes (600 seconds), this makes 7.7 transactions per second.
To compare with VISA which validates several thousand transactions per second.
Marc Lebel is the co-founder of RentAgile.