(Tutorial) Configuring Peercoin Proof-of-Stake Minting on OS X

@masterOfDisaster: Running PPCoind in headless mode appears to work. I say appears, because I’d like to figure out a way to have the activity log piped out so it can be seen that it is actually running, but that shouldn’t be too difficult once I figure out what the command is.

$ ./ppcoind getinfo

GetInfo may contain what I need, if polled periodically. I have a feeling there is something better though, so if you have any recommendations, let me know.

I’ll go back through the steps to make sure I’ve got them down and then provide an update to the tutorial with both options.

For the questions that have come in over the last couple of hours, I haven’t forgotten about you, I’ve just had a bunch going on. I’ll answer your questions later this morning, once I’ve had a chance to do a few things around the house :slight_smile: Thanks for the feedback and the questions!

@ Ben
I don’t know where the user profile is located on MacOS, but I assume at the least a debug.log to be written there.
On linux you could check the status of ppcoind by e.g. tailing the debug.log (I hope “tail” is available on MacOS, but as it is UNIX based, I guess so…):

tail -n 30 ~/.ppcoin/debug.log

You can verify the correct limitation of ppcoind methods (most important: unlocked for stake minting only and not being able to execute transactions etc.) by trying to send PPC to yourself:

ppcoind sendfrom <accountname> <receivingaddress> <amount>

If you want to have a complete list of methods for ppcoind, try

ppcoind help

E.g. if you want to know the name of one of your accounts, you can try

ppcoind listaccounts

And most important:
can ppcoin-qt be started once the ppcoind is runing?
I assume it can’t because of locked files. And that would be great :wink:

I hope this helps a bit…

And in response to your request in the chat box here is a code snippet to get a quick and dirty compact overview of transactions:

ppcoind listtransactions | grep time |  sed -e "s/.* : //" -e "s/,//" | sort | xargs -n 1 -I '{}' date --date=@'{}'

[quote=“jawnzer, post:15, topic:939”]Awesome, really appreciate it Ben. I got stuck up on the same thing. Here’s what I get

total 474904
drwxr-xr-x 20 bradporter staff 680 27 Nov 20:57 .
drwx------+ 41 bradporter staff 1394 19 Nov 19:04 …
-rw-r–r--@ 1 bradporter staff 12292 27 Nov 20:55 .DS_Store
-rw------- 1 bradporter staff 0 10 Nov 10:06 .lock
-rw------- 1 bradporter staff 24576 27 Nov 20:57 __db.001
-rw------- 1 bradporter staff 999424 27 Nov 20:57 __db.002
-rw------- 1 bradporter staff 32776192 27 Nov 20:57 __db.003
-rw------- 1 bradporter staff 1179648 27 Nov 20:57 __db.004
-rw------- 1 bradporter staff 4653056 27 Nov 20:57 __db.005
-rw------- 1 bradporter staff 40960 27 Nov 20:57 __db.006
-rw------- 1 bradporter staff 708608 27 Nov 21:02 addr.dat
-rw------- 1 bradporter staff 116942404 27 Nov 21:03 blk0001.dat
-rw------- 1 bradporter staff 78143488 27 Nov 21:03 blkindex.dat
drwx------ 5 bradporter staff 170 27 Nov 20:59 database
-rw------- 1 bradporter staff 0 10 Nov 10:06 db.log
-rw------- 1 bradporter staff 1929525 27 Nov 21:03 debug.log
-rw-r–r-- 1 bradporter staff 2350 27 Nov 20:54 ppcoin.conf
-rwxr-xr-x@ 1 bradporter staff 5668888 29 Apr 2013 ppcoind
-rw-r–r-- 1 bradporter staff 228 27 Nov 20:57 start.sh
-rw------- 1 bradporter staff 49152 27 Nov 21:03 wallet.dat[/quote]

@jawnzer:

For my start.sh file, locally, I see this:

-rwxrwxr-x 1 benrossi staff 222 Nov 12 13:52 start.sh

Let’s see if updating yours doesn’t get us past this problem. From Terminal, use this command:

$ sudo chmod 775 start.sh

You’ll be prompted for your OS X SYSTEM password (not your wallet passphase) because you used sudo. After that, check the directory’s content permissions to make sure it updated.

$ ls -la

Assuming all went as planned, it should now read:

-rwxrwxr-x 1 bradporter staff 228 27 Nov 20:57 start.sh

Try to re-run ./start.sh to see if you can get past the permissions issue. Let me know if that works.

When I type in chmod, I get no such file or directory

Make sure that you are trying to run that from the PPCoin directory, or, alternatively, from anywhere with:

$ sudo chmod 775 ~/Library/Application\ Support/PPCoin/start.sh

Hi, thank you for all your help. I’m getting this error when running start.sh

I fixed the Permission denied error.

localhost:~ iMac$ cd ~/Library/Application\ Support/PPCoin/
localhost:PPCoin iMac$ ./start.sh
-bash: ./start.sh: Permission denied
localhost:PPCoin iMac$ ./start.sh
-bash: ./start.sh: Permission denied
localhost:PPCoin iMac$ ./start.sh
-bash: ./start.sh: Permission denied
localhost:PPCoin iMac$ ls -la
total 396744
drwxr-xr-x 14 iMac staff 476 Nov 29 00:19 .
drwx------+ 81 iMac staff 2754 Nov 28 23:52 …
-rw-r–r--@ 1 iMac staff 6148 Nov 29 00:19 .DS_Store
-rw------- 1 iMac staff 0 Nov 27 22:54 .lock
-rw------- 1 iMac staff 749568 Nov 29 00:19 addr.dat
-rw------- 1 iMac staff 117832818 Nov 29 00:15 blk0001.dat
-rw------- 1 iMac staff 78594048 Nov 29 00:15 blkindex.dat
drwx------ 3 iMac staff 102 Nov 29 00:19 database
-rw------- 1 iMac staff 0 Nov 27 22:54 db.log
-rw------- 1 iMac staff 214076 Nov 29 00:19 debug.log
-rw-r–r--@ 1 iMac admin 2356 Nov 27 23:22 ppcoin.conf
-rwxr-xr-x@ 1 iMac staff 5668888 Apr 29 2013 ppcoind
-rw-r–r--@ 1 iMac staff 223 Nov 29 00:20 start.sh
-rw------- 1 iMac staff 49152 Nov 29 00:15 wallet.dat
localhost:PPCoin iMac$ sudo chmod 775 start.sh
Password:
localhost:PPCoin iMac$ ls -la
total 396744
drwxr-xr-x 14 iMac staff 476 Nov 29 00:19 .
drwx------+ 81 iMac staff 2754 Nov 28 23:52 …
-rw-r–r--@ 1 iMac staff 6148 Nov 29 00:19 .DS_Store
-rw------- 1 iMac staff 0 Nov 27 22:54 .lock
-rw------- 1 iMac staff 749568 Nov 29 00:19 addr.dat
-rw------- 1 iMac staff 117832818 Nov 29 00:15 blk0001.dat
-rw------- 1 iMac staff 78594048 Nov 29 00:15 blkindex.dat
drwx------ 3 iMac staff 102 Nov 29 00:19 database
-rw------- 1 iMac staff 0 Nov 27 22:54 db.log
-rw------- 1 iMac staff 214076 Nov 29 00:19 debug.log
-rw-r–r--@ 1 iMac admin 2356 Nov 27 23:22 ppcoin.conf
-rwxr-xr-x@ 1 iMac staff 5668888 Apr 29 2013 ppcoind
-rwxrwxr-x@ 1 iMac staff 223 Nov 29 00:20 start.sh
-rw------- 1 iMac staff 49152 Nov 29 00:15 wallet.dat
localhost:PPCoin iMac$ ./start.sh
./start.sh: line 2: unexpected EOF while looking for matching `’’
./start.sh: line 6: syntax error: unexpected end of file
localhost:PPCoin iMac$

Am I supposed to actually enter my wallet passphrase inside the start.sh file?

#!/bin/bash
#echo “Make sure you’ve started PPCoin-qt first."
read -s -p “Enter PPCoin wallet passphrase : " passphrase
echo “Starting PPCoind with stake minting enabled”
./ppcoind walletpassphrase $passphrase 9999999 true

Thanks a lot,
Alejandro

Hi, Alejandro.

No, you don’t need to enter your passphrase in the [font=courier]start.sh[/font] script. That error looks like one that shows up if you have special characters or spaces in your passphrase. I ran into the same one when I originally wrote the bash script, but after I got rid of the spaces in my passphrase, it worked fine.

I don’t believe it’s a problem with the script, but rather, how the passphrase is passed into ppcoind.

Does that sound like it could be the problem you’re having?

Hello I got past the denied permissions but now am having trouble with this too:

Ezekiels-MacBook-Pro:PPCoin kazem666$ ./start.sh
./start.sh: line 2: unexpected EOF while looking for matching `’’
./start.sh: line 6: syntax error: unexpected end of file

kazem666, please read the post above yours and see if the scenario applies to you. At this time, you cannot have spaces or special characters in your passphrase.

I’m looking into whether or not this is something that we can get changed (or if it’s a problem with the script and not the Peercoin daemon), but in the meanwhile that’s my recommendation.

Ben, I changed my passphrase to something very simple, “testing” and still I get the same error. I downloaded the ppcoind file again and also looked for another source for the ppcoind file just in case the ppcoind file itself is damaged but I only find the Mega.co.nz url.

Is it okey that the ppcoind file in OSX shows as a Unix Executable File? This is what some corrupted files in OSX sometimes turn into.

Best,
Alejandro

Hey Ben, I didn’t have any special characters or spaces in my passphrase. Like Alejandro did I changed my passphrase to “testing” in both nano ppcoin.conf and nano start.sh to see if that would fix but still got the same error.

My ppcoind file in OSX is also a Unix Executable File.

Ezekiel

You can test it directly from the command line with this:

$ ./ppcoind walletpassphrase <passphrase> 9999999 true

Replace with your wallet passphrase. The only negative with this approach is that your wallet passphrase will be in your bash history, so once you’ve tested this out, you can clear your bash history with:

$ cat /dev/null > ~/.bash_history

If that works, it may be a problem with the [font=courier]start.sh[/font] script. Do you by chance have an extra couple of blank lines at the end? I’ve seem strange things with EOF errors when there’s more than one.

Re: Unix executable file – that’s what I see when I look at my PPCoin directory as well, so that’s most likely not the problem.

I think I might have discovered something…

I was getting this error when using $ ./ppcoind walletpassphrase 9999999 true

localhost:PPCoin iMac$ ./ppcoind walletpassphrase testing 9999999 true
error: incorrect rpcuser or rpcpassword (authorization failed)

So it made me wonder why is it checking on the password in the ppcoin.conf file? So instead of using my wallet passphrase I decided to use the passphrase in my ppcoin.conf file and I got this error:

localhost:PPCoin iMac$ ./ppcoind walletpassphrase cryptocurrency 9999999 true
error: {“code”:-14,“message”:“Error: The wallet passphrase entered was incorrect.”}

So that made wonder if both wallet and ppcoin.conf must have identical passphrases.
So I changed both to “test” and I ran again $ ./ppcoind walletpassphrase test 9999999 true

And it appeared to work, because I ran it again and I got this:

localhost:PPCoin iMac$ ./ppcoind walletpassphrase test 9999999 true
error: {“code”:-17,“message”:“Error: Wallet is already unlocked, use walletlock first if need to change unlock settings.”}

So I went to check the PPcoin-Qt app and the “locked” message on the lower left corner is gone.

I think I’m happy. Should I be?

So I guess this raises a security question about the wallet passphrase…?

Best,
Alejandro

When I run $ ./ppcoind walletpassphrase 9999999 true I get: -bash: passphrase: No such file or directory

Now I’m really confused.

That happened to me too, that’s because you copy and pasted the line in, including the $ symbol which isn’t needed…

Happened again without the $

Are you in the correct directory?

localhost:~ iMac$ cd ~/Library/Application\ Support/PPCoin/
localhost:PPCoin iMac$

I sure hope so. This is where I’m at:

Ezekiels-MacBook-Pro:PPCoin kazem666$ cd ~/Library/Application\ Support/PPCoin/
Ezekiels-MacBook-Pro:PPCoin kazem666$

No, they don’t need to be the same, because I’m running with different password (in ppcoin.conf) and passphrase (for my wallet).

@kazem666, are you pasting in the line directly from my comment [font=courier]./ppcoind walletpassphrase 9999999 true[/font] or are you pasting it in and then replacing [font=courier][/font] with the one that you use for your wallet?

For instance, if my wallet passphrase was ThisShouldNotBePubliclyKnown, the line that I’d enter into Terminal, from the [font=courier]~/Library/Application\ Support/PPCoin/[/font] directory would be:

./ppcoind walletpassphrase ThisShouldNotBePubliclyKnown 9999999 true

Please note, wallet passphrases are case-sensitive, so make sure that you are entering your passphrase exactly as you’ve set it up from inside of PPCoin-Qt.