Bitcoin Forum
June 18, 2024, 08:09:37 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: how to limit wallet from only staking certain age coins  (Read 531 times)
bumbacoin (OP)
Legendary
*
Offline Offline

Activity: 1638
Merit: 1036



View Profile
October 09, 2016, 05:38:56 AM
Last edit: October 09, 2016, 05:49:13 AM by bumbacoin
 #1

this is specifically related to CUBE but I can see uses beyond this particular coin, i wasnt sure where to put such a question (oops i meant to put this in development and technical discussion ).


currently CUBE can return negative stakes if coinage of staked coins is less than a certain value, just wondering how to build a client that would only try to stake inputs of a certain age.

it occurs to me that the simplest way would be modify the minimum stake age, the question is what format should the code be in to make this happen.

here is the code giving the negative stake
https://github.com/iGotSpots/DigiCube/blob/master/src/main.cpp#L995
Code:
 	if (nHeight > 1020000) {
nSubsidy = nVariableStakeRate * nCoinAge * 33 / (365 * 33 + 8);
nSquish = nSubsidy / 1000000;
if (nSquish > nMaxReward) {
nSubsidy = nMaxReward * COIN;
}
if (nCoinAge < nHeight * 2) {
nSubsidy = (nCoinAge - (nCoinAge * 1.25)) * COIN;
}
}


and STAKE_MIN_AGE is declared
https://github.com/iGotSpots/DigiCube/blob/master/src/main.h#L46
Code:
static const int STAKE_MIN_AGE = 60 * 60 * 24;


seemingly then if you were to set the min age as, (60*60*24)+(nHeight*2) this would prevent the wallet from attempting to stake coins less than required age for positive stakes??

seems this is the line to change
https://github.com/iGotSpots/DigiCube/blob/master/src/main.cpp#L37
Code:
unsigned int nStakeMinAge = STAKE_MIN_AGE;

to

Code:
int nStakeMinAge(int nStakeMinAge, int64 nCoinAge)
{
     nPositiveStakeAge = nStakeMinAge + (nHeight * 2);
     return nPositiveStakeAge;
}

??


note, by changing this particular variable seems the least intrusive way to do it.
also reducing the load of staking inputs.

💦☔️🐳💚💖💛
go to
cryptobetfair.com
ask for a voucher

████████████████
██████████████
█████████████
██████████████
██████████████
███████████
█████████
███████████
████████████
████████████
███████████
█████████████
██████████████
███████████████
████████████████
████████████████
🐠👻🍗🌳🐵
bumbacoin (OP)
Legendary
*
Offline Offline

Activity: 1638
Merit: 1036



View Profile
October 09, 2016, 05:55:35 AM
Last edit: October 09, 2016, 06:49:35 AM by bumbacoin
 #2

it's plausible that it'd be best to create another variable for the stake miner to use, while the subsidy creation would use original.

i'm unsure whether changing the min_stake_age as above would invalidate -ve stakes from other miners.


..

so instead changing this
https://github.com/iGotSpots/DigiCube/blob/ced6fd7627fce29b08d2f1d00564e977e2cc0f9c/src/kernel.cpp#L318

Code:
    if (nTimeBlockFrom + nStakeMinAge > nTimeTx) // Min age requirement
        return error("CheckStakeKernelHash() : min age violation");

then only the miner would reject any stakes that are too young,


💦☔️🐳💚💖💛
go to
cryptobetfair.com
ask for a voucher

████████████████
██████████████
█████████████
██████████████
██████████████
███████████
█████████
███████████
████████████
████████████
███████████
█████████████
██████████████
███████████████
████████████████
████████████████
🐠👻🍗🌳🐵
iGotSpots
Legendary
*
Offline Offline

Activity: 2548
Merit: 1054


CPU Web Mining 🕸️ on webmining.io


View Profile WWW
October 09, 2016, 07:05:01 AM
 #3

You are better off making more local rules with wallet files

bumbacoin (OP)
Legendary
*
Offline Offline

Activity: 1638
Merit: 1036



View Profile
October 10, 2016, 11:29:59 AM
 #4

You are better off making more local rules with wallet files

seems that modding the miner would be far simpler than changing wallet rules.
i canna see anything that would lend itself to easy modification.


💦☔️🐳💚💖💛
go to
cryptobetfair.com
ask for a voucher

████████████████
██████████████
█████████████
██████████████
██████████████
███████████
█████████
███████████
████████████
████████████
███████████
█████████████
██████████████
███████████████
████████████████
████████████████
🐠👻🍗🌳🐵
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!