# Understanding the mechanics and day-to-day implication of Proof-of-Stake

REVIEW REQUESTED
I’ve been trying to get my brain around PoS and how it impacts the monetary supply. To do so, I’ve begun to model what a hypothetical 100.00 PPC in a wallet, charted over a couple months, “looks” like. This simulation will assume a number of credit and debit transactions in addition to the original stake.

The attached PDF is just the first draft, because I wanted to keep it simple, and I still have a bunch of questions that I need answered before it’s useful to really spend time cleaning up the visualization.

As I started to follow how money flows through a wallet, and what and when PoS minting occurs, these questions came to mind. All of these assume that the wallet you store these coins in is “automatically” configured for Proof-of-Stake minting, and it just “knows” how to invoke it at the right time.

Assumptions:

[ul][li]100.00 PPC mature over a 90-day period.[/li]
[li]From Day 1 through Day 30, there is no change, but the coins “age” in the background[/li]
[li]On Day 30, 100.00 PPC are “locked” as Proof-of-Stake minting beings.[/li]
[li]From Day 31 through Day 90, Proof-of-Stake minting maintains the lock on the 100.00 PPC, and each day generates 100 coindays (for a total of 6,000 coindays)[/li]
[li]On Day 90, the 100.00 PPC has “aged out” of Proof-of-Stake minting, and a 1% minting reward (1.00 PPC) is deposited in the wallet.[/li]
[li]Total on Day 91 is 101.00 PPC in the wallet.[/li][/ul]

Now, that brings up a bunch of questions that I’ll need answered before I can continue to refine a flow that covers multiple debits and credits during a 1 year period.

[ul][li]What happens to a coin that has “aged out” after Day 90? Are they somehow no longer eligible to accumulate coindays, or do they restart their ninety day journey on Day 91 (new cycle, “Day 1”)? [/li]
[li]When are Proof-of-Stake rewards added to a wallet? Is it on Day 90, or are there incremental payouts during Days 30 through Day 90, as long as the coin is “locked”?[/li]
[li]Presumably, if you have 1 PPC in your wallet, and you allow it to be used for Proof-of-Stake minting, will your actual funds available for transactions be 0.00 PPC?[/li]
[li]Once coins are locked up, from Day 30 to day 90, is there any way to unlock them so they can be spent?[/li]
[li]If they can be unlocked, is the penalty a complete loss of that cycle’s minting reward, or are there the opportunities for potential payouts?[/li]
[li]How can I tell how many coindays a particular PPC unit has?[/li][/ul]

So, that’s just the first batch of questions that I’ve got. My goal is to model this out over the course of a year, during which time at least 100 transactions (debits and credits) occur, resulting in total transaction fees of 1.00 PPC (100 * 0.01 PPC / txn).

Hopefully this will end up being useful - it’s already helped me start to get my brain around how this all works. Any and all critiques, advice or challenges are appreciated. Also, if there are resources that already exist that provide answers for the questions above, please let me know, I’ll use them in future drafts of the monetary flow.

My attachment was failing when I tried to add it to the previous post, so here’s a link to the simple Proof-of-Stake flowchart:

https://dl.dropboxusercontent.com/u/4111133/Peercoin/PPC%20Proof%20of%20Stake%20Flow.png

It’s looking really good!

Now we just have to iron out the technical accuracy of it all.

There is a randomization element I think that takes place. Coins are minted based on the amount of destroyed transaction fees that are available on the network. Plus there is a luck element isn’t there?

I also recommending adding some other rows, just like the ppcoind client has:

Balance:
New Mint:
Stake:

Balance is your regular, spendable balance. During the minting process, anything you have specified in the client with the “reservebalance” command will stay available to you. The theoretical person exampled in this flowchart might have elected to keep 20 coins in his reserve balance and not used them for minting.

New Mint: is coins you’ve created (but not spendable yet)

Stake: is coins you own, but cannot use, until the new mint is confirmed for 520 blocks.

I think I have these right.

When Sunny’s available, would be nice to hear his comments. I feel a lot of the time he prefers to sit back and let the community do the work when possible. This is one of those times would be nice to hear from him though.

You can PM him if you think it’s important enough. If nobody else here knows the answer, go ahead.

I got this in a PM from czarly a while back -

You have exactly one shot per incoming transaction from the past that gathered coin age, once per second. You always use the coins from a past transaction as a whole to generate a coin stake transaction from it. You cannot combine the coinage from multiple transactions.

So it’s not something that happens after 90 days, you essentially have one shot every second until you use up your coin age so you can go beyond the 90 day limit without getting a PoS block and at that point your coin age no longer increases so your chances of generating the PoS are essentially static from that point on. Up until the 90 day limit your chances are constantly increasing as your coin age increases.

On Day 30, 100.00 PPC are "locked" as Proof-of-Stake minting beings.

I don’t think this is the case. My understanding (and I might be wrong) is the funds get locked after a PoS block. So for example if on day 90 you generate a PoS block with your 100 coins, it is only at that point those 100 coins get locked.

[quote=“Ben, post:1, topic:849”]

100.00 PPC mature over a 90-day period.
From Day 1 through Day 30, there is no change, but the coins “age” in the background
On Day 30, 100.00 PPC are “locked” as Proof-of-Stake minting beings.
From Day 31 through Day 90, Proof-of-Stake minting maintains the lock on the 100.00 PPC, and each day generates 100 coindays (for a total of 6,000 coindays)
On Day 90, the 100.00 PPC has “aged out” of Proof-of-Stake minting, and a 1% minting reward (1.00 PPC) is deposited in the wallet.
Total on Day 91 is 101.00 PPC in the wallet.[/quote]

1. OK
2. OK
3. You do not have to lock the coins. You just start minting. After 30 days you have already 3000 coinage, after 31 days you have 3 100 coinage, after 90 days you have 9000 coinage, after 91 days you have still 9000 coinage.
4. That´s not true. You get you reward after you found a block. This is based on luck and will in the end give you about 1% per year.
5. No, when you get 1% per year you will have (in average) 100.25 PPC after you PoS minted wit 100 PPC for 90 days.

[quote=“Ben, post:1, topic:849”][ul][li]What happens to a coin that has “aged out” after Day 90? Are they somehow no longer eligible to accumulate coindays, or do they restart their ninety day journey on Day 91 (new cycle, “Day 1”)? [/li]
[li]When are Proof-of-Stake rewards added to a wallet? Is it on Day 90, or are there incremental payouts during Days 30 through Day 90, as long as the coin is “locked”?[/li]
[li]Presumably, if you have 1 PPC in your wallet, and you allow it to be used for Proof-of-Stake minting, will your actual funds available for transactions be 0.00 PPC?[/li]
[li]Once coins are locked up, from Day 30 to day 90, is there any way to unlock them so they can be spent?[/li]
[li]If they can be unlocked, is the penalty a complete loss of that cycle’s minting reward, or are there the opportunities for potential payouts?[/li]
[li]How can I tell how many coindays a particular PPC unit has?[/li][/ul][/quote]

1. They stop @ a coinage of 90 per coin. Otherweise you whould have to wait for 30days when your coins were offline for 90 days. Which is definitely not the case. You get rather fast blocks when you had your coins offline for some time. So: Every Coin gets one coinage per day (see 6.) to a maximum of 90.

2. It´s added as soon as you mint a PoS block. The first time this can happen is day 30. The more coin age you have, the mor likely it is to mint a block. So the chance to find a block increases from day 30 to day 90, because you have a lower personal (not for your wallet but for the PPC belonging together) diff, the more coinage you have. When you found a block your coinage is reset to 0. After 30 more days you have the chance to find a block again.

3. You PPC is available as long as you didn’t find a block with it. It’s locked in stake as soon as you found a block with it.

4. It´s not locked from day 30 to day 90, but when you successfully minted a block with. It´s not possible to unlock it then.

5. n/a

6. By math: NumberOfCoins * DaysMatured

There are several post explaining this (and more) around here in the forum.

I love that from a miner’s perspective.

Over time your “personal diff” gets lower for minting coins as each day passes from day 30 to day 90, increasing the likelihood you can successfully mint new coins.

Finally, something “in your favor” instead of against you.

Hey a new tagline for peercoiners:

I prefer to mint my coins instead of mining them.

Awesome, feedback, guys, that little bit has helped me understand it a lot better.

I’ll work on a second draft starting this evening.

Q: If coinage accumulates up until 1 PPC has a value of 90 coindays, let’s assume that it takes another 60 days to actually solve a Proof-of-Stake block. Once that unit has minted a block, is it removed from cirrculation and replaced with a new minted unit worth 1.01 PPC that now has a coinage of 0 (or 1) coindays? In this way, if that new unit is maintained for another 30 days, it now has the opportunity to also mint it’s own reward?

Q: If there is a potential for randomness in the system, just like with mining, is the “1%” an average (and if I’m lucky, I could see a lot of Proof-of-Stake blocks solved, and my actually reward could be higher, or, the alternative could occur and I don’t find many blocks at all…), or is 1% solidly enforced by the system through some mechanism?

With a coinage of 90 you would only generate approximately 0.002466 coins in the stake (1% of 90/365). Which becomes a new transaction of 1.002466 which now has coin age of zero.

I believe it is random and in theory you could end up with slightly more or less than 1%, but on average you should expect 1%. The obvious case is if your PoS doesn’t arrive until after the 90 days limit you will have lost any coinage accumulated after that which will directly impact your PoS reward for that transaction.

I believe it is random and in theory you could end up with slightly more or less than 1%, but on average you should expect 1%. The obvious case is if your PoS doesn't arrive until after the 90 days limit you will have lost any coinage accumulated after that which will directly impact your PoS reward for that transaction.

Would you mind walking me through this part of it? Based on what you wrote, is this accurate?

Day | Value | Coinage | PoS “Difficulty”

d1, 1.00, 1cd, n/a
d15, 1.00, 15cd, n/a
d30, 1.00, 30cd, 100x <-- Proof-of-Stake begins[sup]1[/sup]
d31, 1.00, 31cd, 98.334x
d61, 1.00, 61cd, 48.354x
d90, 1.00, 90cd, 0.001x <-- Proof-of-Stake maintains max-coinage[sup]2[/sup]
d91, 1.00, 90cd, 0.001x
d200, 1.00, 90cd, 0.001x <-- Same “difficulty”, until block is solved

[1] Proof-of-Stake difficulty begins drops 1.666% per coinday after 30cd (semi-fabricated number)
[2] Proof-of-Stake difficulty, at 90 coindays, no longer decreases, and stay at the lowest point until the block is solved

Q: Is it accurate to say that for 1.00 PPC, each coinday is worth 0.00002740 PPC (1% of 1/365), but that no rewards can be claimed until that coin has a coinage of 30, at which point, solving the block would reward 0.000822 PPC?

If that is true, is it a linear scale? So that, if all things are equal, on Day 90 of a cycle, if the Proof-of-Stake block was solved, you would see this stake reward?

``((1% of 1/365) * total coinage)``

1.00 PPC @ 90cd = 0.002466 PPC in stake
10.00 PPC @ 900cd = 0.02466 PPC in stake
100.00 PPC @ 900cd = 0.2466 PPC in stake
1000.00 PPC @ 90000cd = 2.466 PPC in stake

I don’t think my math is off there, but if that’s the case, Proof-of-Stake rewards ~2.5%, not the ~1.0% that I thought it should. Where did I go wrong?

Other questions as they come to mind:

[ul][li]Are coindays fractional or are they an integer value? I’ve never seen a mention of “coinage 45.5”, but then again, I haven’t read through the code to see if it uses a fractional value in the stake calculation[/li][/ul]

From czarly’s PM that mcgin posted:

You have exactly one shot per incoming transaction from the past that gathered coin age, once per second. You always use the coins from a past transaction as a whole to generate a coin stake transaction from it. You cannot combine the coinage from multiple transactions.

…if I understand correctly, we’ll need to take into account in the model that for a given wallet, you’ll have a number of concurrent stake minting “pools”, each based on their respective incoming transaction amounts.

I think there are a lot of beating the bushes here.

The best approach to understand this is going directly into the codes. Also since I’m planning on writing for the video, I would really appreciate Sunny to guide us on the understanding of PoS with coding proof. It is easier to refer back if any question or confusion arise.

Also there is one more question that is in need of urgent answer.

Q: What is the advantage/disadvantage of PoS for someone with 100 PPC and someone with 100 000 PPC?

I think the answer to that can either make or break, or the design has been flawed from the beginning (which if so, should be repaired). I hope all the explanations are backed by coding proof.

I do not exactly know how the reward is calculated. But it really comes down to 1% a year on average.

Q: Is it accurate to say that for 1.00 PPC, each coinday is worth 0.00002740 PPC (1% of 1/365), but that no rewards can be claimed until that coin has a coinage of 30, at which point, solving the block would reward 0.000822 PPC?

I guess the 0.00002740 PPC per Coinage is not correct. While I cannot say why.

...if I understand correctly, we'll need to take into account in the model that for a given wallet, you'll have a number of concurrent stake minting "pools", each based on their respective incoming transaction amounts.

That’s also my understanding.

[quote=“Ben, post:11, topic:849”]100.00 PPC @ 900cd = 0.2466 PPC in stake

I don’t think my math is off there, but if that’s the case, Proof-of-Stake rewards ~2.5%, not the ~1.0% that I thought it should. Where did I go wrong?[/quote]

You’re math is a bit off. Taking the 100 example you generate 0.2466 coins after 90 days which is ~ 0.25% not 2.5%. Since that is after approximately a quarter of a year it is ~1% annually.

From what I can make out from the code the PoS reward calculation is below which should help you out.

PoS Reward in PPC = (Coinage * 33 / (365 * 33 + 8 ) )/100

I discovered something interesting as I was looking at this. I expect a small compounding effect depending on when you generate the PoS block. For example if you have 100 coins and generate a PoS every 30 days you end up with 100.9901 after 360 days. Whereas if you generate the PoS every 90 days instead you end up with 100.9893 after 360 days.

There is no advantage or disadvantage. Someone with 100PPC is expected to get 1PPC per annum and the 100,000PPC expects 1,000PPC per annum in POS, everyone earns 1% regardless of holdings

As long as I understood it correctly you may have little advantage with 100k PPC over someone is 100 PPC. That´s because the chance of not finding a block within 90 days is much higher with small amounts of coins.

It’s only an advantage if you got the 100k coins in one transaction. As long as you got 100k coins in 1000 transactions á 100 coins you have no advantage over someone minting with 100 coins (beside the variance)

[quote=“MUTO, post:17, topic:849”]As long as I understood it correctly you may have little advantage with 100k PPC over someone is 100 PPC. That´s because the chance of not finding a block within 90 days is much higher with small amounts of coins.

It’s only an advantage if you got the 100k coins in one transaction. As long as you got 100k coins in 1000 transactions á 100 coins you have no advantage over someone minting with 100 coins (beside the variance)[/quote]

I stand corrected, you are right MUTO

Approaching this from the code-side is my plan too, but I’m initially trying to understand this as someone who isn’t going to take the time to go through the code (read: most small to mid-sized investors).

My hope is that by talking it through, in layman’s terms, while solidifying it with calculations from the code, we can identify areas that need messaging refinement. It will probably get messier before it gets cleaned up

[quote=“Ben, post:12, topic:849”]Other questions as they come to mind:

[ul][li]Are coindays fractional or are they an integer value? I’ve never seen a mention of “coinage 45.5”, but then again, I haven’t read through the code to see if it uses a fractional value in the stake calculation[/li][/ul]

From czarly’s PM that mcgin posted:

You have exactly one shot per incoming transaction from the past that gathered coin age, once per second. You always use the coins from a past transaction as a whole to generate a coin stake transaction from it. You cannot combine the coinage from multiple transactions.

…if I understand correctly, we’ll need to take into account in the model that for a given wallet, you’ll have a number of concurrent stake minting “pools”, each based on their respective incoming transaction amounts.[/quote]

The coin days are fractional. The code calculate the time based on unix time difference in seconds.