PoS - How does it really work? Long and maybe confusing thread incoming ;)


#61

Supposing 1) everyone are mining PoS blocks every 90 days. 2) every one has an equal share of the total amount of PPC and hold it in one transaction.

Because there are 62490 = 12960 PoS blocks will be mined in 90 days, so only 12960 people will get their PoS reward in the period. That means every one should have 21,000,000 PPC / 12960 = 1620 PPC on average, and each of them will get 1620 * 0.01 * 90 / 365 = 4 PPC interests every 90 days.

In practical situation, not all coin ages are used to generate PoS, and the distribution of them among holders are far from equal. Therefore, the 1620 PPC requirement is the maximum number in theoretical. In other words, if your balance is above 1620 and they are in one transaction, you never need to worry you are out of the game.

However, it might be an issue in the future, if PPC are widely used and its value rises significantly. The coinages are more precious and consequently encourage people to mine Pos blocks and gather their balance in one transaction. Roughly speaking, because only the top 12960 biggest stake holder will get their interests in the quickest way, it seems like PPC may find it difficult to distribute in a very large scale.


#62

This whole concept of POS is really amazing to me but very complex at the same time. It will take a few read overs until I fully understood this concept.


#63

[quote=“xjabc, post:61, topic:648”]Supposing 1) everyone are mining PoS blocks every 90 days. 2) every one has an equal share of the total amount of PPC and hold it in one transaction.

Because there are 62490 = 12960 PoS blocks will be mined in 90 days, so only 12960 people will get their PoS reward in the period. That means every one should have 21,000,000 PPC / 12960 = 1620 PPC on average, and each of them will get 1620 * 0.01 * 90 / 365 = 4 PPC interests every 90 days.

In practical situation, not all coin ages are used to generate PoS, and the distribution of them among holders are far from equal. Therefore, the 1620 PPC requirement is the maximum number in theoretical. In other words, if your balance is above 1620 and they are in one transaction, you never need to worry you are out of the game.

However, it might be an issue in the future, if PPC are widely used and its value rises significantly. The coinages are more precious and consequently encourage people to mine Pos blocks and gather their balance in one transaction. Roughly speaking, because only the top 12960 biggest stake holder will get their interests in the quickest way, it seems like PPC may find it difficult to distribute in a very large scale.[/quote]

Interesting assumption to start with regarding total pool. Assuming everyone has the same stake is not a model to built a realistic calculator on, I think. So please elaborate if I missed your point.
I’ve been playing with your balance of 1620. In my calculator that would result in a chance of 0.1894% of solving a block in a day. So most likely you would solve a block in just over 5 days with this amount (given my assumptions). I think that’s close to what I’m hearing, but unfortunately don’t have real stats.

Suspect my model is on the high side as the number of Coindays participating is probably smaller than I assumed (looking at number of nodes). But anyone’s guess to the stake (coinage) of those nodes. e.g. a few Top 100 wallets would change the game. Need to play more with calculator to see what changing some of the variables would do to the outcomes.

So trying again, any ideas out there how best to collect anonymous stats from minters (and keep spammers out) so we can validate our assumptions and perfect the model/calculator closer to real results?


#64

Is POS minting transaction based? I guess the answer is yes because every transaction has a different age.
So If I have a wallet that has several addresses, and some of the addresses have multiple input transactions in it and no output transactions. Will the wallet loop through all transactions looking for POS blocks independently every second?


#65

[quote=“mhps, post:64, topic:648”]Is POS minting transaction based? I guess the answer is yes because every transaction has a different age.
So If I have a wallet that has several addresses, and some of the addresses have multiple input transactions in it and no output transactions. Will the wallet loop through all transactions looking for POS blocks independently every second?[/quote]
It is a good question, but it probably requires someone to dive into the code.
I guess it will loop somehow as you suggest as it have to test eligible stakes every time, it check your wallet. how often that happens is something else. Not sure if there is a hard coded second in the wallet code, guess that’s the case as it would even out the number of stake requests (number of draws in lottery) for every client independent from the technical specs of the hardware you are using.

Guess I should start learning reading source code of cryptocoins ::slight_smile: The answers in this area are very scarce around here.


#66

Cybnate, I think that is an unfair statement. When someone asks a question like this, rarely do they have to wait more than 24-48 hours without someone addressing the issue and someone trying to help.

In general, coin-age will earn 1% a year on average regardless of how many coins you are minting. While it is true, you will see more PoS mints more often, based on the more coins you have, you will not be cheated out of your 1% over the long term if you have a small number of coins.

To put it simply:

If someone has 5 coins, over 10 years, they will still earn a proof-of-stake earning of 1%/year once they mint their own block. They may have to wait longer, because they are only working with 5 coins as their stake, but they WILL eventually mint a block.

If someone has 500 coins, over 10 years, they will earn a proof-of-stake earning of 1%/year much faster, because the probability is much higher, with a greater stake.

If someone has 500,000 coins over 10 years, they will earn a proof-of-stake earning of 1%/year much faster, because the probability is much higher, with a greater stake.

Now with that being said, the question was:

"Is POS minting transaction based? I guess the answer is yes because every transaction has a different age. "

The answer is YES.

Now here is how it can work. This is different for everyone. Let’s say you are the type of person that wants to see proof-of-stake earnings based on big transactions more often… Then what I would recommend is that you transfer all your coins to a particular wallet address (if you plan on storing them to earn free minted coins), and you will have a better chance of minting a PoS block.

To put it into perspective:

Joe has 3 transactions received in his wallet:

  1. 0.25 coins transferred Jan 5, 2012
  2. 5.25 coins transferred Jan 15, 2012
  3. 250.0 coins transferred Aug 20, 2012

Based on proof-of-stake and coin-age, all transactions and coins should earn approx 1%/year based on minting.

The likelihood of #3, 250 coins transferred Aug 20,2012 minting a block, and earning the 1% free peercoin is much greater than the 0.25 coins transferred Jan 5, 2012.

But! the only issue is time. Both transactions still have the same ability to earn approx 1% to earn free peercoin / year. The more coins you have, the increased stake you have, the greater likelihood you have of seeing the Proof-of-stake earnings being added to your wallet.

So someone with 0.25 coins is still going to earn the same 1% as someone with 250 coins, it will just take longer, based on the lucky odds of coin-age and minting.

By now people are going to ask, ok, let me get this straight:

If I have 100 transactions, to 10 different wallets, would it make sense in the short-term to transfer all of those coins to a single wallet address and let them sit in that single wallet to earn stake for 30-90 days? Would I have a greater chance of minting a block, instead of having 10 wallet addresses with fragmented balances, instead of 1 wallet address with a large balance? The answer is YES.

This is short term thinking and short term realizations, but yes. The larger the transaction, the larger the chance that you will mint a proof-of-stake block.

If you are a long term investor, even if your wallet has 0.003 peercoin, eventually you too will mint your own proof-of-stake block, it will just take a lot longer (or you will need to be super lucky in the short term)

This will probably spawn a discussion, and I am happy to participate, but this single comment has me irritated:

Cybnate: the answers in this area are very scarce around here.

Really? You wrote your message on Jan 16/2013, and had someone respond within the same 24 hour period.


#67

Thanks for taking the time to explain. I know most of it in theory. I was asking for confirmation on implementation details based on facts, e.g. pointing to lines in the source code, or a yes from Sunny. Such detail matters when answering questions such as would slplitting a big sum of coins into smaller chunks make a more secure network?

[quote=“ppcman, post:66, topic:648”]

Cybnate: the answers in this area are very scarce around here.

Really? You wrote your message on Jan 16/2013, and had someone respond within the same 24 hour period.[/quote]

I though Cybnate meant that answers based on source code are scarce.


#68

[quote=“mhps, post:67, topic:648”]Thanks for taking the time to explain. I know most of it in theory. I was asking for confirmation on implementation details based on facts, e.g. pointing to lines in the source code, or a yes from Sunny. Such detail matters when answering questions such as would slplitting a big sum of coins into smaller chunks make a more secure network?

[quote=“ppcman, post:66, topic:648”]

Cybnate: the answers in this area are very scarce around here.

Really? You wrote your message on Jan 16/2013, and had someone respond within the same 24 hour period.[/quote]

I though Cybnate meant that answers based on source code are scarce.[/quote]

Offtopic: Thanks MHPS, this is a misunderstanding, I wouldn’t dare to blame this community of not being responsive. On the contrary, answers are usually very fast and thoughtful and I’m trying to contribute to that as well.

In my post I was really referring to answers which refer to actual pieces of source code to provide proof. So I’m sorry if I offended or irritated PPCMan, that was surely not the intention.
Most of us are good in reasoning and theories based on other discussions or bits and pieces of evidence obtained from experience (facts), including myself. Scarce are those who are able (or willing?) to provide reference to the actual source code to provide proof. So in a moment of self-reflection I thought I should learn to read source code to be able to better support the Peercoin community. Will probably do so once I got a bit more time in my hands, but I guess most of us suffer from that problem.

On-topic: I fully agree with PPCman, you better have multiple wallets consolidated into one, as that would provide you a better chance of realising your interest in the short term. If you’re in for the long haul anyway, it doesn’t really matter as you would still earn your interest over time. As mentioned somewhere else there is a minor difference with compounded interest, but we’re talking of fractions of $ cents based on the current PPC value.

Technically more nodes would make a more distributed network (higher availability, more responsive), good for the network. But if still in control of one person it is not more secure unless there is something in the source code which would provide each node with that in some way or the other (sounds unlikely to me, but I do not have proof).


#69

Please forgive me if I missed something.

Is there any parameter indicating how many coins taking party in the current PoS block forging? What’s the ratio for the PoS coin miners to those coins have more than 30 days age? I’m wondering whether an attack required more than 51% of all coins or just more than 51% of the forging coins in the fly.

Thanks.


#70

[quote=“Jimmy, post:69, topic:648”]Please forgive me if I missed something.

Is there any parameter indicating how many coins taking party in the current PoS block forging? What’s the ratio for the PoS coin miners to those coins have more than 30 days age? I’m wondering whether an attack required more than 51% of all coins or just more than 51% of the forging coins in the fly.

Thanks.[/quote]
No-one has found the parameter of how many coins are taking party as far as I know. You have seen me making all the assumptions in this thread to have some idea how many coins are being forged as we don’t have real statistics on it. The trouble is that we may never know as it would mean that you would know the total amount of (forging) coins of every wallet online. Only the wallet owner has that information as far as I know. But I think there should be some variable in the network with the total value of all coindays at stake at a given point in time. Maybe someone can find that variable so we can read it out one day.

A POS attack is likely to only need 51% of the forging coins based on logic. Only the forging coins can create a block. Coins<30 days or off-line can’t and therefore do not secure the network.

Not sure if I understand your second question, can you please rephrase for me?


#71

[quote=“Cybnate, post:70, topic:648”][quote=“Jimmy, post:69, topic:648”]Please forgive me if I missed something.

Is there any parameter indicating how many coins taking party in the current PoS block forging? What’s the ratio for the PoS coin miners to those coins have more than 30 days age? I’m wondering whether an attack required more than 51% of all coins or just more than 51% of the forging coins in the fly.

Thanks.[/quote]
No-one has found the parameter of how many coins are taking party as far as I know. You have seen me making all the assumptions in this thread to have some idea how many coins are being forged as we don’t have real statistics on it. The trouble is that we may never know as it would mean that you would know the total amount of (forging) coins of every wallet online. Only the wallet owner has that information as far as I know. But I think there should be some variable in the network with the total value of all coindays at stake at a given point in time. Maybe someone can find that variable so we can read it out one day.

A POS attack is likely to only need 51% of the forging coins based on logic. Only the forging coins can create a block. Coins<30 days or off-line can’t and therefore do not secure the network.

Not sure if I understand your second question, can you please rephrase for me?[/quote]

Thanks for your reply. I think your explanations are great.

We need to do some analysis from the block chain so as to get some information on the PoS network and then decide when to remove the check point, and I think Sunny King is always monitoring it.

BTW, I wrote an essay yesterday based on my understanding of PoS minting, and I will try to translate it to English if I have time.
http://c.blog.sina.com.cn/profile.php?blogid=4cc7d6e689000tgm


#72

Edit: issue posting Excel sheet. Will see if I can upload somewhere else and post a link. Here is the link: [s]https://mega.co.nz/#!htVA0RpD!MEfpcxI79vxUkWsA8iWw8GjdzFwNjfx5SQgpX_wNxKw [/s]
Updated version: https://mega.co.nz/#!txM2CKyL!NLSqaXjlrepSncZhTyYpBwBc_XpbGmuYLMLxLA-3UoM (only changed some wording, model is identical as v0.1).

Just made an Excel spreadsheet capturing all the assumptions and calculations I made in a couple of the previous posts in this thread regarding the calculation of the chance to find a block. I’ve also added the formula for the payout to have it all in one (see link).

When working on it, it appeared that there is an error in one of my calculations in the previous posts which erroneously increased the chance of finding a block with a factor 10!

So to match the experiences in this forum and my own experiences of the time of finding a block, I had to significantly reduce the number of eligible coins online. In a way that makes sense, when you know that there are only about 300 wallets online on average.
This is kind of disturbing as it would mean that a 51% PoS attack wouldn’t take that much. Of course do you still need to sustain it for a number of blocks, but given adequate coinage in a couple of addresses this doesn’t sound that exotic. I suspect this is one of the reasons SK is slow with removing the checkpoints.

Ok, about the spreadsheet, it is still without any frills and has only validation for basics as maximum coinage in the calculations.

Just enter the following in the green blocks:

  • Your coins in one address; transaction; remember only coins on a single address transaction in your wallet are taken into account by the network at each time.
  • Your coinage per coin; so if you haven’t move the coins of a particular address transaction for 60 days you would enter 60.
    In the amber block:
  • Optionally you can play with the percentage of total coinage online. I’ve set it on 2.0% as this appears to match the reality based on mine and other’s experience as far as I know.
    We definitely need more date in this area. So feel free to post your experiences or PM me if you don’t want to have them in the forum.

The results are in the grey blocks.
Just remember that the number of days to find a block is an average, not a guarantee.

Feedback and comments are more than welcome.

BTW The Excel sheet doesn’t contain any macros, so it should be reasonably safe. Happy to convert to other formats if requested.


#73

Regarding PoS, Greg gmaxwell, the core bitcoin developer, said

The problem with proof of stake is that, ironically, there is nothing at stake
@
https://bitcointalk.org/index.php?topic=406747.msg4452544#msg4452544

What’s your take about this?


#74

[quote=“xjabc, post:73, topic:648”]Regarding PoS, Greg gmaxwell, the core bitcoin developer, said

The problem with proof of stake is that, ironically, there is nothing at stake
@
https://bitcointalk.org/index.php?topic=406747.msg4452544#msg4452544

What’s your take about this?[/quote]

Here’s a breakout topic that discussed the assertion: “What stops me from POS minting several different chains at once?


#75

Thanks for the modeling effort, which is very much needed for an innovative coins such as Peercoin.

[quote=“Cybnate, post:72, topic:648”]Just enter the following in the green blocks:

  • Your coinage per coin; so if you haven’t move the coins in a particular address for 60 days you would enter 60.
    In the amber block:[/quote]

I think coinage is transaction based, not address based. For example in a mining payout address you can have many batches of coins paid by the pool at different times. Coins in different batches have different ages. I hope coinage is not calculated such that when a new payout is received coinage is reset to 0 for all coins in the address. That would be a bad surprise. Then it’s better to use a new address for every payout to preserve accumulated coinage.


#76

Coin age is tied to a transaction, that is correct. It’s also segregated by address; because multiple transactions that have coin age that have reached “maturity” can be summed together for the purpose of solving a block.

Once a block is solved, the transactions that were used, and the reward for the block, are rolled into a single new transaction with coin age equal to zero, but any non-matured coins in that address are still able to mature and eventually attempt to solve their own block.


#77

[quote=“mhps, post:75, topic:648”]Thanks for the modeling effort, which is very much needed for an innovative coins such as Peercoin.

[quote=“Cybnate, post:72, topic:648”]Just enter the following in the green blocks:

  • Your coinage per coin; so if you haven’t move the coins in a particular address for 60 days you would enter 60.
    In the amber block:[/quote]

I think coinage is transaction based, not address based. For example in a mining payout address you can have many batches of coins paid by the pool at different times. Coins in different batches have different ages. I hope coinage is not calculated such that when a new payout is received coinage is reset to 0 for all coins in the address. That would be a bad surprise. Then it’s better to use a new address for every payout to preserve accumulated coinage.[/quote]

Agree with you and Ben, I confused transaction and address, will update my spreadsheet accordingly.
@Ben, not sure if I understand what you say about having multiple transactions reaching coin age can be summed up together for purpose of solving a block.
The only purpose would be to increase the chance to solve a block faster. Each transaction would be able to solve a block on itself and gaining the same amount of interest over time anyway.


#78

I’ll have to recheck my logs and compare against against the block chain, but in one of the blocks I solved, the inputs that were summed together and used as the basis to calculate the reward appeared to have come from two separate transactions a couple of days apart.


#79

Maybe this will be referred to later in this thread (I’m still clearing my backlog…)…
…but I had the feeling to jump in the math^^

[quote=“Cybnate, post:57, topic:648”][…]
They are talking about a randomiser factor +Coin age to solve blocks, double the coinage doubles your chance. I got that.
Ok, let’s do some examples ignoring any complex randomisers to equal chances to start with. Let’s say you have just one block in a certain period.

And the following people have their wallet set to minting:
5 people (A) have 100 coinage, 4 people (B) have 50 coinage, 1 © has 24 coinage and 1 (D) only 1 coinage.

Throwing this into the pool; A has double the chance of solving a block over B. B would have double the chance over C.
But what is the actual chance for A, B and C? Total coinage is 5100+450+124+11= 725
So someone in group A would have a 100/725 chance = ~13.79% chance. An individual in B would have 50/725 = 6.7% C would have 24/725 = 3.3% and D only 1/725 = 0.13%

Let’s keep these 11 individuals and add more blocks into it. With Peercoin we seem to have 6 blocks every hour. However it seems there are on average 5 to 6 blocks PoS and 1 block PoW in an hour (this needs further statistical proof). Let’s assume 5 blocks in hour for PoS. A day has 24 hours. 5 blocks x 24 = 120 blocks/days

So what are the chances now? To me each individual would have 120x times more chance (draws) to solve a block in a day then if there was only one.
So someone from group A would on average successfully mint a block after 100/16.55% = 6.04 blocks.
C have to wait for 100/6.7% = 14,93 blocks to successfully mint.
However D 100/0.13% = 769 blocks, so the chance of D minting a block on that day is 0.13% * 120 blocks = 15.6%[/quote]

If A has the chance of solving one block at the given difficulty of 16.55% (0.1655), he has a chance of 83.45% (0.8345) of not solving it.
This makes for a series of n blocks a total chance of 0.8345^n for not solving any block.
After 6.04 blocks (knowing that there are no 0.04 blocks that can be solved :wink: ) the total chance of solving at least 1 block is 1-0.8345^6.04=0.66 -> 66%
You miss the “compound interest” of luck for solving blocks :wink:
If you ask about the average time to solve a block, I think the question would be: at which number of blocks (n) is the chance at least 50% to have successfully minted at least one block.
For participant A that leads to:

1-0.8345^n=0.5
0.8345^n=0.5
log(0.8345^n)=log(0.5)
n*log(0.8345)=log(0.5)
n=log(0.5)/log(0.8345)
-> n=3.83

Beginning with the 4th block in a row the chance to have minted at least one of them is above 50%!

[quote=“Cybnate, post:57, topic:648”][…]
Here I need some help in mathematics.
[…]
If you’re still with me after reading the above then you’re probably a mathematician or a very big proof-of-stake/PPC fan ;-)[/quote]

I am - both a fan of math and Peercoin/PoS! :smiley:


#80

[quote=“Cybnate, post:70, topic:648”][quote=“Jimmy, post:69, topic:648”][…]
I’m wondering whether an attack required more than 51% of all coins or just more than 51% of the forging coins in the fly.
[…][/quote]
[…]
A POS attack is likely to only need 51% of the forging coins based on logic. Only the forging coins can create a block. Coins<30 days or off-line can’t and therefore do not secure the network.
[…][/quote]

I might be wrong - but I’d like to have this thesis checked:

[size=10pt]“There is no such thing as a >50% attack of Peercoin’s PoS process.”[/size]

Explanation:
The success for minting a PoS block is based on luck. The relevant part that determines the luck is the coin-age. The coin-age is capped at 90 days[sup]1[/sup].

Even if you have more than 50% of all coin-age taking actively part in the PoS process, you don’t have control over the PoS part of the Peercoin network.
Your luck for solving the next block is > 50%. And even if that doesn’t significally decrease your total coin-age (let’s assume you still have more than 50%), you only have a chance of 50% for solving the next PoS block and so forth.
Let’s assume you constantly stay above 50% of the coin-age in this game.
Being able to mint n PoS blocks in a row at 50% chance for success has a total chance of 0.5^n.
This is far from being in control over the network (which is completely different for PoW processes as control of > 50% of the hashing power allows to supress valid blocks and prevent them from being added to the blockchain!)

Please try to disprove this thesis.

If you disprove it, I might congratulate you on having shown that an owner of more than 50% of all coin-age can most likely evaporate all his Peercoins by performing such an attack!
The Peercoins that have been used for minting can’t be transferred anywhere for the next ~500 blocks and the price of the Peercoins that are left and have not been used for minting will most likely be worthless once they are credited at an exchange and can be sold (as you can only transfer them earliest if you don’t need them any longer for PoS minting).
And even if it takes some time for the world to get aware of that attack, it will for sure create a huge drop in prices tring to sell them in a short period of time. The losses are either way tremendous.

Just in case you are not plain evil and want to ruin Peercoin…
…maybe you try to pull off a double-spending attack: make sure you have > 50% of Peercoins PoW hashing power as each interfering PoW block might ruin your plans.
AND
Make sure the profit you make by pulling off that double-spending attack exceeds the invested money for buying/mining the coins and for aggregating > 50% of the PoW hashing power!

If you can’t disprove it, let others try to.
If they can’t, consider such an attack more and more unlikely the longer this thesis has not been disproved :wink:

[sup]1[/sup] STAKE_MAX_AGE is defined here: https://github.com/ppcoin/ppcoin/blob/master/src/main.h#L46 and used here: https://github.com/ppcoin/ppcoin/blob/master/src/kernel.cpp#L271