stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3.01k stars 674 forks source link

[mining] Stop awarding coinbases for non-empty sortitions #3653

Closed jcnelson closed 1 year ago

jcnelson commented 1 year ago

Right now, if there are B Bitcoin blocks between Stacks blocks S and S+1, the winner of S+1 receives B coinbases. The rationale for this is to ensure that mining is always eventually profitable as long as the value of STX is positive -- the accumulating STX coinbases will eventually exceed the value of the Bitcoin transaction fee.

The problem with this naive approach is that it makes block-orphaning profitable for a coalition of miners with a majority of the mining power. The current rules will award the orphaned blocks' coinbases to the coalition on the coalition's fork, meaning that there's no (non-trivial) cost to orphaning blocks.

I think this is easily fixed: only award missing coinbases for Bitcoin blocks with no sortition. This addresses the aforementioned problem of ensuring that the chain remains live in the face of wild STX/BTC price fluctuations, while also ensuring that the act of orphaning a block is more costly than building atop it.

I don't think we need to consider whether or not a sortition has a corresponding Stacks block; just looking for whether or not a sortition happened is enough. Since we're assuming that miners are economically rational, then I think we can assume that, on the whole, people who send block-commit transactions (which aren't free) are intending to append Stacks blocks.

Ston3cutt3r commented 1 year ago

The current rules will award the orphaned blocks' coinbases to the coalition on the coalition's fork, meaning that there's no (non-trivial) cost to orphaning blocks.

Unfortunately, that is not correct? There are no rewards for orphaned blocks. These rewards are "lost" and don´t get arwarded to anyone at the moment.

Please prove me wrong, but let´s have a look at BTC block 784019-784023 as an example. In this range of five blocks there is one block without a sortition (784019) and four blocks (784020-784023) are orphaned. Nevertheless, the entity who initiated the fork only won 1000 STX coinbase rewards with BTC block 784024 / Stacks block 100943.

By initiating these forks the entity is able to "bleed out" other miners. But don´t get a direct reward.

jcnelson commented 1 year ago

Yes, you are correct @Ston3cutt3r. Looking at the code, a Stacks block does not accumulate a coinbase for a Bitcoin block in which a sortition occurred (regardless of whether or not it is on the same fork). It only accumulates them if there was no sortition winner, so this issue as described can be closed.

However, this fact would mean that orphaning blocks is already less cost-effective than confirming them. The economically rational thing to do is to confirm blocks, since it minimizes the BTC spend per STX earned.

Ston3cutt3r commented 1 year ago

There is no immediate reward for the entity to initiate these forks. But they are able lock in an immense profit by forcing other miners to stop.

Furthermore, there are no costs for the entity to initiate these forks because they don´t have a risk in losing them. Confirming blocks by other parties is not minimizing their BTC spend per STX earned!

blockstack-devops commented 1 month ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.