particl / particl-core

Particl Core integration/staging tree

Home Page:https://particl.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inefficient Staking of UTXOs

Shubiwubi opened this issue · comments

Hey guys, I just noticed that particld doesn't seem to automatically split staked UTXOs larger than a certain size. This results in inefficient staking for users that transferred a large amount of PARTs in one transaction as it renders all coins dormant for 8 hours until they are able to stake again.

Other iterations of PoSv3 (Blackcoin namely as Particl is forked from it) automatically splits UTXOs larger than 200ish BLK in order to maximize efficiency across the network.

Is this intentionally done or just something the dev team has decided not to fork with PoSv3?

If not, then I suggest implementing an automatic splitting of staked UTXOs into two UTXOs for every staked UTXO above xxx PART to make the staking and network more efficient.

commented

Check nStakeSplitThreshold
I believe it's set at 1000 but I can't confirm right now. I'm on mobile.

commented

Particl is forked from bitcoin, with allot of PoSv3 added to particl.

commented
bool CHDWallet::CreateCoinStake(..) {
   .... 
   // Set output amount, split outputs if > GetStakeSplitThreshold
    if (nCredit >= Params().GetStakeSplitThreshold())
    {
        std::shared_ptr<CTxOutStandard> outSplit = MAKE_OUTPUT<CTxOutStandard>();
        outSplit->nValue = 0;
        outSplit->scriptPubKey = scriptPubKeyKernel;

        txNew.vpout.back()->SetValue(nCredit / 2);
        outSplit->SetValue(nCredit - txNew.vpout.back()->GetValue());
        txNew.vpout.push_back(outSplit);
    } else
    {
        txNew.vpout.back()->SetValue(nCredit);
    };
   .... 
}

And

CHDWallet::SignBlock calls CHDWallet::CreateCoinStake.

Also the Threshold for splitting is set at 2000. Outputs are aggregated into sets of 1000.

    int64_t nStakeCombineThreshold = 1000 * COIN;
    int64_t nStakeSplitThreshold = 2 * nStakeCombineThreshold;

Thanks a lot @kewde for pointing that out :)

Don't you agree that 16000$ (probably a lot more in the future) stake tresholds are a big disincentive for small stakeholders? They will probably almost never stake with such fierce competition on the blockchain.

commented

Don't you agree that 16000$ (probably a lot more in the future) stake tresholds are a big disincentive for small stakeholders? They will probably almost never stake with such fierce competition on the blockchain.

@shubidoo
I'm not quite acquainted with the internals of PoS. I agree tho, I'll figure out if this is something we can easily change or if it requires a hardfork. I know that SDC used this same threshold value, so it's very likely that it still stems from the older days.

commented

@kewde thanks for clarifying this! 👍

@rynomster Thanks for the explanation but I think I disagree slightly here:

If you own 10000 PARTs (we assume 10 inputs) and you stake with 1 of your inputs, 9000 PARTs will still be staking for you and 1000 will be locked for 8 hours, right?
If I own 1000 PARTs (1 input) and I stake with my input, I won't be able to participate at all for 8 hours in securing the network, correct?

If the treshold would be lowered to let's say 100 PARTs, then the following would occur:
If you own 10000PARTs (now with 100 inputs), nothing changes much for you, other than that you stake more often and more inputs are available for staking over time.

If you own 1000 PARTs (now 10 inputs) and you stake with one of your inputs, at least 9 inputs will still be staking and you still get a chance of participating during the next 8 hours whereas with the higher threshold you will have an 8 hour lockout period every time you stake and won't participate at all in securing the network.

In the long run, it does make staking more efficient as on average your staking inputs are available for a longer period of time instead of being completely locked out, correct?

Granted, in the big game that won't change much as large stakeholders just have a larger stack of inputs available and stake a lot more often with them, but for smaller stakeholders an additional 8 hours of opportunity to stake on multiple inputs does seem to make a difference in the long run, don't you agree?

Maybe I'm not seeing something here, in which case I'm sorry but it's just the thought process that I came across and I love the project, so trying to make it better for everyone :)

Thanks for creating Particl and either way, I wish you the best of luck with it in the future!