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

Using the [font=courier]GetProofOfStakeReward [/font] calculation below, I put together a simple spreadsheet to show what your expected payout is for a given incoming (credit) transaction.

You can play with the “Transaction Amount” field and it will update the Coin Age and PPC Reward fields below.

Assumptions:

[ul][li]Coin Age is accumulated between d1 and d29, but no reward is possible because Proof-of-Stake minting hasn’t started yet[/li]
[li]Between d30 and d90, the transaction’s coin age is increased, and the potential reward if the a Proof-of-Stake block is increased based on the [font=courier]GetProofOfStakeReward[/font] calculation[/li]
[li]After d90, the coin age for the transaction is frozen, and while Proof-of-Stake validation continues until the block is solved, the reward does not get any bigger[/li][/ul]

Could the community please review this model to make sure that I’m representing it accurately? Thanks!

https://db.tt/yRJsAbzb
(Dropbox link, because I still can’t attach things to posts, for some reason.)

@Ben

any news regarding the unlock function of the wallet?
I refer to my second last post in this thread: http://www.peercointalk.org/index.php?topic=979.msg8749#msg8749

@MoD:

I’ll test it right now and post the results.

Attempts to send PPC to an address from an encrypted wallet (ppcoin-qt v0.3.0, Mac OS X 10.9):

[ol][li]Encrypted wallet, ppcoind not running, “Minting suspended due to locked wallet”: Passphrase required to send funds[/li]
[li]Encrypted wallet, ppcoind running, “unlocked for block minting only”[1]: No passphrase required to send funds[/li]
[li]Encrypted wallet, ppcoind running, “unlocked for block minting only”[2]: No passphrase required to send funds[/li][/ol]

[1] Unlocked using command line string [font=courier]./ppcoind walletpassphrase 999999 true[/font]
[2] Unlocked using a custom start.sh bash script, run from the command line:

#!/bin/bash
echo "make sure you've started ppcoin-qt first."
read -s -p "Enter ppcoin wallet passphrase  : " passphrase
echo "starting ppcoind with stake mining enabled"
./ppcoind walletpassphrase $passphrase 9999999 true

No bueno.

I tried to narrow down the scope of what could be the problem, so I tested out different configurations of the addresses that I was sending to. It didn’t seem to make a difference if the address was already one that you had sent to (and you included from the ppcoin-qt address book) or if this was a totally new address that you had never sent to before.

I tried the same on Windows 7 64 bit with Peercoin 0.3.0

Scenario 1:
ppcoin-qt.exe running
ppcoind.exe used for minting unlock (ppcoind.exe walletpassphrase true)

Tried to execute a transaction with ppcoind.exe.
Result:
error: {“code”:-4,“message”:“Error: Wallet unlocked for block minting only, unable to create transaction.”}

Tried to execute a transaction with ppcoin-qt.exe (“Wallet is encrypted and currently unlocked for block minting only” says the mouse-over of the lock symbol)
Result:
successfully executed the transaction

WTF?

[size=12pt]It looks like the ppcoin-qt.exe doesn’t handle the unlock properly (at least the MacOS and the Windows version). ppcoind.exe being used for enabling stake minting only unlocks the ppcoin-qt.exe for more than just stake minting.[/size]

Scenario 2:
ppcoin-qt.exe NOT running
ppcoind.exe running as daemon and used for minting unlock (ppcoind.exe walletpassphrase true)

Tried to execute a transaction with ppcoind.exe
Result:
error: {“code”:-4,“message”:“Error: Wallet unlocked for block minting only, unable to create transaction.”}

Tried to create a new address
Result:
Success. This should not work as well with a wallet that is unlocked for stake minting only, but at least I don’t see a security issue here…

[size=12pt]I highly recommend not not have ppcoin-qt.exe running in parallel while ppcoind.exe was used for minting unlock!
If you want to enable stake minting, let solely ppcoind.exe be running.[/size]

Start ppcoind.exe as daemon:

ppcoind.exe -daemon

Open another command prompt to enable stake minting

ppcoind.exe walletpassphrase <passphrase> <timeout> true
$ ./ppcoind -daemon
ppcoin server starting

$ ./ppcoind walletpassphrase <passphrase> 9999999 true
error: couldn't connect to server

$ ./ppcoind -watch
PPCoin: Cannot obtain a lock on data directory /Users/benrossi/Library/Application Support/PPCoin.  PPCoin is probably already running.

I tried it a few ways, but all with the same result. It may be a ppcoin.conf setting issue, so is there anything that I need to set to get the daemon to allow local connections?

I have a “ppcoin.conf” with some config lines:

server=1
rpcuser=GfGegBdWj3Tkzo5Q7Fxn
rpcpassword=4o7z7Ej65lMB3f1qCFdm
rpcallowip=127.0.0.1
rpcallowip=192.168.1.*

where 192.168.1.0/24 is my local subnet.
Give it a try! :wink:

Current rpcallowip configruations:

rpcallowip=127.0.0.1
rpcallowip=192.168.2.*
rpcallowip=10.0.0.*

The second one may be a typo on my part. I’ll make a change to [font=courier]192.168.1.*[/font] and see if that fixes it.

[quote=“Ben, post:36, topic:849”][code]
$ ./ppcoind -daemon
ppcoin server starting

$ ./ppcoind walletpassphrase 9999999 true
error: couldn’t connect to server
[/code][/quote]

In my experience, you cannot send commands to ppcoind until it has established multiple peer node connections and caught up to the block chain a little bit to verify their authenticity.

Even on linux, if I start ppcoind and immediately start throwing commands at it, they won’t work, until a few minutes have passed.

No dice. I started it and waited 20 minutes before trying to connect to the server with [font=courier]./ppcoind walletpassphrase 999999 true[/font], but I’m still getting the “error: couldn’t connect to server”.

I’ll make sure that my ppcoin.conf file is pared down to the bare minimum for troubleshooting.

A couple of things to try:

  1. Check the ownership of your .ppcoin folder as well as the ppcoin.conf files. What user owns it?
    (On Linux for instance, if the .ppcoin folder was created by root, and you are running ppcoind as a user, that’s not going to work until you sudo sh or sudo bash first)

  2. what username is ppcoind running as? Double verify it by running psauxxx |grep ppcoind

  3. Make sure you shutdown and restart ppcoind after the ppcoin.conf file exists. For instance, if you’ve had ppcoind running the entire time while you are making changes to ppcoin.conf, that won’t work. ppcoind only reads ppcoin.conf while it starts. Any changes to it afterwards have no effect until you stop it and start it again.

So I tried it on testnet, it seems working alright to me. My experience is (linux 64 bit):

  1. ppcoin-qt running with server=1 mode set in ppcoin.conf. wallet locked
  2. unlock for block-minting only using ‘ppcoind walletphrase’ command. now the lock icon says ‘unlocked for block-minting only’
  3. send coins via ppcoind: rejected with message "wallet unlocked for block minting only, unable to create transaction
  4. send coins via ppcoin-qt: it pops window to ask for passphrase and send successfully. wallet returns to locked mode after the send.

So I don’t see anything obvious wrong here. The send in Qt must ask for passphrase for the send, then it is the correct behavior. If it doesn’t ask for the passphrase, then it’s wrong. Because the feature is meant to make it harder for hacker to steal coins. Say if he somehow gains control of your desktop, he still needs your passphrase to steal coins. Can you guys verify that your experience is different from mine?

Would be really great, is if someone could make a youtube video of their experience of what they are reporting is incorrect behavior.

Make it a private video where it is set to “only users with the link can see this video” and then post the link here. (This way it stays out of regular youtube searches)

A picture is worth 1000 words, a video is worth even more!

I’ll take a video, but I’m also happy to run a concurrent join.me so it can be seen live. I’ll make a video first thing, just to start the conversation

And yes, my experience is different. With the client unlocked, I’m not prompted for a pass phrase.

I’ll spool up an Ubuntu VM to compare against. It may be an OSX / Win issue with QT

i’ll try to reproduce my findings, I recall having my wallet unlocked for minting only, and I tried to make a new receiving address, there it should ask for the passphrase, but it did not, will let you know if I have it reproduced

[quote=“Ben, post:44, topic:849”]I’ll take a video, but I’m also happy to run a concurrent join.me so it can be seen live. I’ll make a video first thing, just to start the conversation

And yes, my experience is different. With the client unlocked, I’m not prompted for a pass phrase.

I’ll spool up an Ubuntu VM to compare against. It may be an OSX / Win issue with QT[/quote]

Same for me, i have unlocked my wallet for block minting only but was able to send ppc without entering my password. I will stop POS for now because i dont want an open wallet. Please look into this issue.

Here’s a screen capture of the potential ppcoin-qt client defect, in action. Apologies in advance for the large size of the recording, but I’m not set up to demo this on my laptop, so the desktop was the best option. You should be able to see everything clearly, even if you have to resize the image, but if it’s not clear, let me know and I can come up with an alternative. I’ve zipped it up, but it’s still ~120MB in size.

https://db.tt/03E4SRrV

I don’t think I included anything that would compromise this wallet’s security, but if you see something that I should be concerned with, please let me know.

[quote=“Ben, post:47, topic:849”]Here’s a screen capture of the potential ppcoin-qt client defect, in action. Apologies in advance for the large size of the recording, but I’m not set up to demo this on my laptop, so the desktop was the best option. You should be able to see everything clearly, even if you have to resize the image, but if it’s not clear, let me know and I can come up with an alternative. I’ve zipped it up, but it’s still ~120MB in size.

https://db.tt/03E4SRrV

I don’t think I included anything that would compromise this wallet’s security, but if you see something that I should be concerned with, please let me know.[/quote]

On my VLC Media Player I was able to hear your voice, and see a static screenshot of your ppcoind.conf config.

Did you watch the .MOV ?

I don’t know if it is my player, or the video itself, but I couldn’t see what you were clicking or typing.

[edit: I was finally able to successfully watch the .MOV on Linux using it’s Media Player instead]

My guess is that your player was working, but that it was out of view. Is there a “scale player” option on VLC?