Also, AFAIK if you are p2pool minig and have a LOT of sub-YAC unspent inputs in your wallet (presumably at one address), they'll be grouped into one PoS transaction when you have enough of them older than 30 days AND they cummulatively exceed the 10 YAC minimum (please correct me if I'm wrong, haven't looked at the actual code for this yet).
PoS does not group anything.
I believe it does, or at least it should try to (but only coins that belong to the same address). The number of stake inputs is limited to 100, constrained by the nCombineThreshold variable (dunno what exactly this does, but it says in the comment that it's important for security reasons - however, I didn't find anything about this in PPCoin's paper).
EDIT: It tries to combine inputs up to slightly over 11 YAC.
From wallet.cpp, line 1470:
BOOST_FOREACH(PAIRTYPE(const CWalletTx*, unsigned int) pcoin, setCoins)
{
// Attempt to add more inputs
// Only add coins of the same key/address as kernel
if (txNew.vout.size() == 2 && ((pcoin.first->vout[pcoin.second].scriptPubKey == scriptPubKeyKernel || pcoin.first->vout[pcoin.second].scriptPubKey == txNew.vout[1].scriptPubKey))
&& pcoin.first->GetHash() != txNew.vin[0].prevout.hash)
{
// Stop adding more inputs if already too many inputs
if (txNew.vin.size() >= 100)
break;
// Stop adding more inputs if value is already pretty significant
if (nCredit > nCombineThreshold)
break;
// Stop adding inputs if reached reserve limit
if (nCredit + pcoin.first->vout[pcoin.second].nValue > nBalance - nReserveBalance)
break;
// Do not add additional significant input
if (pcoin.first->vout[pcoin.second].nValue > nCombineThreshold)
continue;
// Do not add input that is still too young
if (pcoin.first->nTime + nStakeMaxAge > txNew.nTime)
continue;
txNew.vin.push_back(CTxIn(pcoin.first->GetHash(), pcoin.second));
nCredit += pcoin.first->vout[pcoin.second].nValue;
vwtxPrev.push_back(pcoin.first);
}
}
1. Why is reward distributed on two outputs?
2. Why there is additional, empty output?
1. For security reasons, apparently.
https://github.com/EskimoBob/ppcoin/commit/720f007714e9f24d10a1f46726fe9f8f56163fbf2. PoS blocks/transactions are identified by this empty coinbase output.
From main.cpp, line 2052:
// ppcoin: only the second transaction can be the optional coinstake
for (unsigned int i = 2; i < vtx.size(); i++)
if (vtx[i].IsCoinStake())
return DoS(100, error("CheckBlock() : coinstake in wrong position"));
// ppcoin: coinbase output should be empty if proof-of-stake block
if (IsProofOfStake() && (vtx[0].vout.size() != 1 || !vtx[0].vout[0].IsEmpty()))
return error("CheckBlock() : coinbase output not empty for proof-of-stake block");
This code also explains why there is a completely empty coinbase transaction in each PoS block, eg.
http://yacexplorer.tk/tx/b358e9983a3387ce7993d8757e6be6c4a10613cf69de039194f7237307a92d96 in block
http://yacexplorer.tk/block/a781207353e5a8b30c3a271ad135361ecdeb3bc9e7a5b5c5319b4242d32d0f06Looks like this still has not been fixed in PPC:
https://github.com/ppcoin/ppcoin/issues/16
Hey sairon or Joe_Bauers (with Joe being the only one who has ever contributed code to my version of the client), want to take over my Github repository (github.com/yacoin)?
WM - I will take it over if you can't do it anymore. Either in conjunction with sairon, or solo if they are not interested. Either way, I appreciate all of the work you've done on YACoin so far and am looking forward to seeing where we can bring YAC to in the future. Let me know.
@WM: Too bad you're leaving us.
Thanks for all you've done for this coin.
@Joe: You've commited better code to the project, so you should keep that repo (it's better security-wise IMHO). I'm comfortable working in my own dev tree and sending pull requests when I finally manage to fix something.