spacemeshos / go-spacemesh

Go Implementation of the Spacemesh protocol full node. 💾⏰💪
https://spacemesh.io
MIT License
752 stars 212 forks source link

Reward system #421

Closed noamnelke closed 2 years ago

noamnelke commented 5 years ago

The Motivation

Ensure incentive alignment and prevent foul play.

The Requirement

TBD

noamnelke commented 5 years ago

A block producer receives a share of transaction fees, regardless of the transactions she includes in her produced block.

A simple inefficiency

A block producer may include transactions in her block that pay a fee that's too low, because she has a personal interest in those transactions. E.g. these are her own transactions, and by including them in her produced block she avoids paying a fee, while still getting a share of others' transaction fees in the same layer.

Gaining an edge on other miners

A shrewd businesswoman, knowing she's eligible to mine a block soon, could publicly/privately offer to include transactions in her block at below-market-rate fees if those transactions pay the fee directly to her account. She would then get 100% of the "fee" for those transactions in addition to her share of the layer (real) fees. Users who consider using her offering could demand eligibility proof. Providing that proof could put her at risk of a DoS attack by other miners, but she could prepare and fend off such attack. If she decided not to provide proof, users would still be incentivized to try sending the transaction. If she's not eligible the no-fee transaction will not get included and if she is -- they get what they wanted. The risk here is limited to wasting time.

Upping the ante

This scheme can be scaled up and perfected by a mining pool. If the pool produces at least one block in most layers, there's a high likelihood that they'll be able to put a transaction in the next layer. Any transaction paying them directly more than 1/[the number of blocks in a layer] of the fee payed by an honest transaction (that they could be the only one's including) is preferable to them. They could offer a service where users pay them 10x the number above and it would still be economical for user. They'd then split the gains with block producers in the pool and still turn a profit. This will incentivize miners to join the pool. The pool would be incentivized to develop a wallet app that lets users perform this trickery seamlessly.

Everybody wins -- except the other miners.

This means that it would be uneconomical to be an independent miner (or at least not to "cheat" this way).

Do we care about this attack?

One could argue that there's nothing wrong with miners selling off block space on their own and competing with each other off-mesh.

A system where users have to find a miner that will include their transactions would be extremely prone to censorship and privacy violations. E.g. pools could be forced to comply with KYC for transactions they include.

How can this be mitigated?

There could be a consensus rule that defines which transactions may be included in each block, e.g. by sharding the TXID space and assigning a shard to each block producer. Then we can try to let each block producer keep the fees from their block. This direction isn't fully baked and needs more work.

noamnelke commented 5 years ago

After talking with @iddo333 about this issue, it looks like the best solution is to ensure we don't have a sustained fee market. If we maintain capacity above demand, at least most of the time, this scheme would not be lucrative and users would have no strong incentive to participate in it.

zalmen commented 5 years ago

@noamnelke the attack described in "Gaining an edge on other miners" can be avoided if miners will only be able to know their eligibility one layer in advance

avive commented 5 years ago

After talking with @iddo333 about this issue, it looks like the best solution is to ensure we don't have a sustained fee market. If we maintain capacity above demand, at least most of the time, this scheme would not be lucrative and users would have no strong incentive to participate in it.

What do you mean by sustained free market ?

noamnelke commented 5 years ago

@zalmen They could still say with some statistical certainty that they'll mine a block within a timeframe (e.g. the next couple of days, if they committed enough storage). This would be a harder sell than at 3pm tomorrow, but it doesn't solve the problem completely.

Furthermore, if this particular step is harder, nothing stops someone from skipping it and going straight to pools with blocks in every layer.

I'm also not entirely sure how we would prevent miners knowing in advance. I can think of some ideas, but they all have other drawbacks.

lrettig commented 2 years ago

The game theory around this is explored in great depth here: https://timroughgarden.org/papers/eip1559.pdf. In particular, EIP-1559 adds a "base fee" mechanism (with a fee in each tx that's burnt rather than paid to miners) to disincentivize miners from accepting txs in extraprotocol fashion.

This is a specific case of the general class of MEV problems, which is a huge topic - it's an active area of consideration/research but there is no pending core dev task here, so I'm closing this issue.