Author

Topic: Why did miners waste much block space when there is need (Read 270 times)

sr. member
Activity: 854
Merit: 424
I stand with Ukraine!
legendary
Activity: 2394
Merit: 6581
be constructive or S.T.F.U
In a perfect scenario, maybe, but the network is not perfect. The mining pool also has to build a candidate block, calculate the Merkle root, and then update all its miners with the new candidate block hash. If the whole process genuinely took only 200ms, then we wouldn't see empty blocks at all. But it simply is not that quick. It takes a few seconds in the real world, and so we still occasionally see empty blocks being mined.

I initially had the same thoughts,  but turned out i was wrong, the  <200ms average isn't a random figure i invented it was reported by Kano from his own pool logs, his pool is one of the oldest pools and the data he reports is probably the most accurate you can find on the internet.

By the way, the figure includes EVERYTHING from knowing about the block to the moment the pool generates work for its miners, ya some will take over 200ms, some less, but the average is around that.

It takes less than 200ms from receiving a block in bitcoind, until it can produce a full new block template with transactions.
I have a message in debug.log when the block arrives with a timestamp to microseconds, another when it has been processed, and another when the pool has been sent the new work.

The largest block in the last 8 hours was 631950 it was 1783877 bytes.
bitcoind debug.log shows (as I mentioned)
Code:
2020-05-27 19:07:53.985131 ProcessNewBlock
2020-05-27 19:07:54.025189 Pre-allocating up to position 0x3000000 in blk02094.dat
2020-05-27 19:07:54.107985 UpdateTip: new best=000000000000000000067af76e3e524beabb9557f71413d8db9b88760e445d3b height=631950 version=0x20002000 log2_work=91.982404 tx=533594598 date='2020-05-27 19:07:33' progress=1.000000 cache=36.9MiB(236180txo) warning='75 of last 100 blocks have unexpected version'
2020-05-27 19:07:54.108131 Block 000000000000000000067af76e3e524beabb9557f71413d8db9b88760e445d3b provided by 107.191.117.193:8333
2020-05-27 19:07:54.158265 GetBlockTemplate called
2020-05-27 19:07:54.160724 CNB
2020-05-27 19:07:54.174358 CreateNewBlock(): block weight: 3964486 txs: 122 of 10917 fees: 0.04177550 sigops 20166

Also of interest in this case, it had to extend some disk space for the block.

Total time from when it arrived until the pool got new work 19:07:54.174358 - 19:07:53.985131 = 189227 microseconds 189 milliseconds

As for empty blocks, the one I see in the last 8 hours is 631926 by ViaBTC
I'll include the block before as well for more information:
Code:
2020-05-27 16:36:48.892330 ProcessNewBlock
2020-05-27 16:36:48.913863 Leaving block file 2093: CBlockFileInfo(blocks=99, size=133620045, heights=631826...631924, time=2020-05-26...2020-05-27)
2020-05-27 16:36:48.914006 Pre-allocating up to position 0x1000000 in blk02094.dat
2020-05-27 16:36:48.950898 Pre-allocating up to position 0x100000 in rev02094.dat
2020-05-27 16:36:49.011947 UpdateTip: new best=00000000000000000010dab51e5208c538fce5634104fbd059da24140911efe7 height=631925 version=0x27ffe000 log2_work=91.981925 tx=533547943 date='2020-05-27 16:36:37' progress=1.000000 cache=14.5MiB(52565txo) warning='72 of last 100 blocks have unexpected version'
2020-05-27 16:36:49.012075 Block 00000000000000000010dab51e5208c538fce5634104fbd059da24140911efe7 provided by 107.191.117.193:8333
2020-05-27 16:36:49.071051 GetBlockTemplate called
2020-05-27 16:36:49.071136 CNB
2020-05-27 16:36:49.088969 CreateNewBlock(): block weight: 3964991 txs: 1933 of 17715 fees: 0.18324281 sigops 13534
2020-05-27 16:37:08.482568 ProcessNewBlock
2020-05-27 16:37:08.490710 UpdateTip: new best=0000000000000000000f1b87afb1b95a5e681736ea387b60a8bd150b1ec8bb30 height=631926 version=0x3fff0000 log2_work=91.981944 tx=533547944 date='2020-05-27 17:06:23' progress=1.000012 cache=14.5MiB(52772txo) warning='73 of last 100 blocks have unexpected version'
2020-05-27 16:37:08.568545 CreateNewBlock(): block weight: 3964339 txs: 1903 of 17821 fees: 0.21419789 sigops 13493
In this case firstly, you can see the block before, it was 20 seconds before it.
Secondly, in this case the work kano.is generated included 1933 transactions and fees: 0.18324281 BTC
However as can be seen from the next block on the block chain, it was only 315 bytes  ... instead of our "block weight: 3964991"
(You'll have to check the 315 bytes number on any block explorer to see it's an 'empty' block)
i.e. our work that miners were working on was a full block, but ViaBTC miners were working on an empty block when they found it.

It took 196639 microseconds to process i.e. 197 milliseconds

... and of course it didn't take 197 milliseconds longer than ViaBTC - they didn't process it in 0ms Tongue

You can run a bitcoind yourself and you can see this information - though you'll have to patch it and recompile it to display the extra information Smiley

I've been around in bitcoin since 2011 working on code related to it.
Working on mining code, pool code, and even simple patches to bitcoin itself.

Now if you think <200ms isn't worth it to mine empty blocks, you can read my post in the same topic explaining how it IS worth it for mining pools to invest those 200ms

Quote
There is 86400000ms in a day, and 144 blocks to be mined, so by utilizing 100ms every 10 mins you get a total of 14400ms which is 0.0167% of the total 24 hours.

When a pool like F2pool saves 150ms for every potential block, that's 552510 terahash worth of mining, if that's hard to understand think of it this way.

When F2pool knows about a new block coming, and while going through that 150ms process they switch their hashrate to another PPS pool and say that is Viabtc, by the end of the day they would get paid $1500 from mining for 150ms every 10 mins or a total of 21.1 seconds a day with 22,100,420.00th worth of hash power, but instead of doing this, they would just mine to their own pool and still by the end of the day/week/month/year, they will theoretically make that same amount of money.

And it gets even better when you don't have to download the block in the first place when your pool is synced with the other pools via any other protocol and all you need is their hash (not even the block header) then that makes it well above 200ms, but even with these numbers F2pool can potentially make over half a million dollar in profit yearly, or otherwise, lose it if they use your code and not mine empty blocks.
legendary
Activity: 2268
Merit: 18711
Downloading, verifying transactions, and adjusting the node's mempool to purge the already confirmed transactions takes no more than 200ms
In a perfect scenario, maybe, but the network is not perfect. The mining pool also has to build a candidate block, calculate the Merkle root, and then update all its miners with the new candidate block hash. If the whole process genuinely took only 200ms, then we wouldn't see empty blocks at all. But it simply is not that quick. It takes a few seconds in the real world, and so we still occasionally see empty blocks being mined.
legendary
Activity: 2394
Merit: 6581
be constructive or S.T.F.U
When a node receives a block from somewhere else, it has to spend a little bit of time verifying that block, checking every transaction in the block is correct and accurate, and then updating its set of unconfirmed outputs to remove all the outputs which have just been spent and add all the new outputs which have just been created. This doesn't take long - usually in the order of a few seconds depending on your hardware - but it isn't instant.

While this is happening, a miner cannot create a new block filled with transactions to work on, because it doesn't know which transactions it can and cannot include until it verifies which transactions have just been mined in the block it just received. So for these few seconds, the miner's options are either to have their mining equipment sit idle and do nothing, or attempt to mine an empty block until they have fully verified the last block. Since having their equipment sit idle would be a waste of money, most miners attempt to mine an empty block for a few seconds until they create a normal block filled with transactions and then switched to trying to mine that instead. Very occasionally a miner will be successful in these few seconds and will mine an empty block.

Downloading, verifying transactions, and adjusting the node's mempool to purge the already confirmed transactions takes no more than 200ms, a mining pool would waste on average 14400ms a day if they refrain from mining empty blocks, depending on the size of their hashrate it could be anywhere between a few thousands to a few million dollars a year, of course, this comes at an expense which is increased probability of orphan race.

legendary
Activity: 3500
Merit: 6320
Crypto Swap Exchange
Taking it a bit past what was said above.
IF they are doing it properly and that is a big IF a large pool is running several nodes all over the world, when a block comes in they all should start validating it. Once a certain percentage of them agree then and only then do they start building the new block for the pool.

Loosing the fees even now is better then building a invalid block that gets rejected.
AND not broadcasting an empty block as soon as possible risks loosing it too.

It just comes down to routing. It takes about 1/2 a second to send 1 packet of data around the world without doing any kind of firewall / security inspection in an ideal setting.
Allowing for the nodes to verify what is in the block, and sending it back out is another couple of seconds and then start building a new block. If all is ideal you should have a new block ready to go in 10 seconds or so.

BUT, if you are waiting for minimum of 3 of 5 to do their thing you might add a few seconds on top of that.

Add in a bloated memory pool and some DPI From firewalls and you add a few seconds again.

All of a sudden you are looking at more time to build a block.

Even now there are 2 schools of thought with what happened with what happened with foundry the other day.
Some people including Kano are saying that they tried to orphan a couple of blocks.
Others are saying that they saw foundrys blocks 1st.

It has always been the way it works.

And part of the problem is that even if you understand BTC perfectly, unless you understand the true issues of internet routing and the true delays that proper DPI can put into network performance then it's never going to seem logical as to what happened.

Dave's pool can put it's nodes out there in public.
A corporation with all kinds of security requirements probably has 3 layers of security devices looking at all data coming in before it even hits the node to be processed. Dave's node has seen, and processed the block before it has even gotten through the security devices of some places. On the flip side, it's a lot harder to take out big corps node(s) by flooding them with bad data since it never even makes it into the network.


-Dave

* DPI = deep packet inspection. https://www.fortinet.com/resources/cyberglossary/dpi-deep-packet-inspection
legendary
Activity: 2268
Merit: 18711
That's not entirely correct: if miners would skip the few seconds between full blocks, the difficulty would be a bit lower (after 2 weeks). On average, the same amount of blocks would contain more transactions. There's just no reason for individual miners to do this.
I deliberately didn't even mention this because the effect is negligible.

In the last 20,000 blocks, I count 44 empty blocks, for an average of 1 every 454.5 blocks, or 4.435 per difficulty epoch.
Removing those 4.435 blocks per epoch would result in an epoch taking 44.35 minutes longer (on average).
Diving two weeks plus 44.35 minutes by 2016 results in an average block time of 10 minutes and 1.3 seconds.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
literally nothing is lost by an empty block being found - it does not make the next block any harder to find.
That's not entirely correct: if miners would skip the few seconds between full blocks, the difficulty would be a bit lower (after 2 weeks). On average, the same amount of blocks would contain more transactions. There's just no reason for individual miners to do this.
legendary
Activity: 2268
Merit: 18711
I was confused why will they mine a single transaction when everyone is looking for a way to move their bitcoin from one place to another, this doesn't make sense when they can allow others to include their transactions with the fees all together.
To expand on the above answers:

When a node receives a block from somewhere else, it has to spend a little bit of time verifying that block, checking every transaction in the block is correct and accurate, and then updating its set of unconfirmed outputs to remove all the outputs which have just been spent and add all the new outputs which have just been created. This doesn't take long - usually in the order of a few seconds depending on your hardware - but it isn't instant.

While this is happening, a miner cannot create a new block filled with transactions to work on, because it doesn't know which transactions it can and cannot include until it verifies which transactions have just been mined in the block it just received. So for these few seconds, the miner's options are either to have their mining equipment sit idle and do nothing, or attempt to mine an empty block until they have fully verified the last block. Since having their equipment sit idle would be a waste of money, most miners attempt to mine an empty block for a few seconds until they create a normal block filled with transactions and then switched to trying to mine that instead. Very occasionally a miner will be successful in these few seconds and will mine an empty block.

You can search on the forum, kano has explained many times why this is harmful for the BTC blockchain and why it is stupid to accept to validate empty blocks.
I don't see how it is harmful at all. Even empty blocks add to the security of the network, and literally nothing is lost by an empty block being found - it does not make the next block any harder to find.
hero member
Activity: 504
Merit: 1065
Crypto Swap Exchange
Yes, some pools even accept to mine totally empty blocks.
The biggest pools all do this : Binance Pool, Foundry, Antpool etc...

You can search on the forum, kano has explained many times why this is harmful for the BTC blockchain and why it is stupid to accept to validate empty blocks.

Some pools refuse to do this, including kano's pool. Unfortunately, profits before the interest of the blockchain itself takes precedence for the biggest pools.

legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
This can also be an indication of a "Covert ASICBoost" since not including transactions is the only viable option to do it.

However, your example is definitely mined less than a minute after the pervious block
so the miner just got lucky and didn't had time to included transactions in it.
legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
This usually happens when a block is found shortly after the previous block. Miners don't waste a block when they find one, even if they didn't have time to build the transactions yet.
hero member
Activity: 952
Merit: 552
I noticed a block confirmed less than an hour ago, but I also noticed that it contains only a single transaction, I was wondering why would they confirmed just a single transaction in a block amidst this period of large pending transactions.
This is the block that was found with a single transaction:
https://mempool.space/block/000000000000000000042e59020bb65cd4221498a9cb6fc81bb43a35bdf9d8b6

I was confused why will they mine a single transaction when everyone is looking for a way to move their bitcoin from one place to another, this doesn't make sense when they can allow others to include their transactions with the fees all together.
Jump to: