Stake Splitting and Combining
The proposer will make an attempt to combine multiple UTXOs when staking. This is done to merge small pieces into bigger pieces which can then used for staking with a higher chance of proposing.
At the same time we have an as-of-yet pretty much undefined parameter of coinbase maturity which prevents newly formed stake (the output of a coinbase transaction) to participate in staking right away.
The suspicion is that in the long run this reduces the changes of a staker with a high amount of stake. While winning the lottery you might actually be banned form having the cake and eating it too because of coinbase maturity. If this was significant then it would make sense to keep multiple pieces of stake (UTXOs) as to be always able to propose.
To be continued...
There is another problem with combining multiple UTXOs: it might reduce privacy. Maybe it should be an opt-in feature.
@Nizametdinov I think we can make it an opt-out feature instead.
@scravy As for the maturity imho the stake does not need and should not have any cooldown (this would just push for splitting your coins a lot, and sounds just a poor design decision), then the reward + fees must have a cooldown/maturity for many reasons as:
- avoiding double spends cause by different coinbases
- prevent unfairness due to compounding the rewards with the stake quickly
- allow to punish (taking away the reward) to proposers who try to propose multiple blocks at the same time. and probably some others.
@Gnappuraz @scravy I understand that, in the case of combining coins at the time of block creation, the combination would be placed in the "stake output" instead of being in the "reward output", right?
Then, in case we combine coins, the combination would include the staked coin as well? Because in that case, for consistency, maybe we should create a new coin for the stake all the times (and destroy the previous coin), whether we combine coins or not.
Then, in case we combine coins, the combination would include the staked coin as well? Because in that case, for consistency, maybe we should create a new coin for the stake all the times (and destroy the previous coin), whether we combine coins or not.
I am not sure I get what you ask for.
The way it works right now:
- proposer chooses a set of stakeable coins (in code: a
staking::CoinSet) - proposer checks one by one if they are eligible
- if a coin is eligible it is taken as stake (
vin[1]of the coinbase transaction to be created,vin[0]does not spend anything, it's the meta output) - the remaining stakeable coins are (if configured so combine stake) included in the coinbase transaction as
vin[2],vin[3]etc.). Otherwise they just hang around - the stake (no matter whether anything was combined or not) is sent back to the pubkey which staked it in
vout[1] vout[0]contains the reward which is the block reward which is newly minted money which is not the stake you spent before. It is subject to the reward maturity and nothing can be done with it before it has not grown maturevout[1]contains the same amount as the stake + all combined coins which were put in. Obviously all the old UTXOs are now spent and you got a new UTXO (a new coin). If stake split threshold is non zero than there will be a number ofvout[n >= 1]which are all the same size (split threshold or split threshold - 1).
Stake combining is a feature that can be opted out from, Stake splitting is a feature that can be opted into.
The reward output will go away completely once we have reward pools (UIP-22 / #504 / #418 / #417).
vout[1] contains the same amount as the stake + all combined coins which were put in.
I was referring to this :) . This is reason enough to not freeze the stake once it's used, because there's the possibility to freeze not staked coins, among other reasons mentioned by @Gnappuraz .