How to: Staking with the command-line wallet


#1

Here’s how to stake on your server, raspberry pi or on your local computer using the command line wallet pivxd and pivx-cli. Besides the need for this on systems without any graphical interface, this also has the benefit of better stability and slightly lower power consumption.

These steps are mainly for Linux and Mac, but can also be used for Windows with slight tweaks.

Wallet Download
wget https://github.com/PIVX-Project/PIVX/releases/download/pivx-xxx.tar.gz
(check github https://github.com/PIVX-Project/PIVX/releases for the latest version)

Extracting the wallet
tar -xvzf pivx-xxx.tar.gz

Create the pivx data directory
mkdir ~/.pivx

cd ~/.pivx

Create pivx.conf
sudo nano pivx.conf

Paste this and edit the X’s with your own random A-Z 0-9
rpcuser=pivxXXXX
rpcpassword=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(you do not need to remember this password)

To save press: CTRL+X - y - Enter


If you don’t have the patience for full sync you can
wget https://pivx.bitcoiner.me/Pivx-Chain-XXXXXX.zip

and unzip it
unzip Pivx-Chain-XXXXXX.zip
(press y for any replacement request)


OK now is time to start the wallet

cd

cd pivx-2.2.0/bin/

./pivxd &

and check the status
./pivx-cli getinfo
(if you get “error: {“code”:-28,“message”:“Loading block index…”}” wait a minute and run again)

Now while the chain is syncing… let’s get an address, back it up propperly and setup the wallet passphrase
./pivx-cli getnewaddress
(take note)

./pivx-cli bip38encrypt "paste created address" "password (write down/remember)"
(save the encrypted key in a document with your backups)

`./pivx-cli encryptwallet “password (can be the same as bip38)”

Start the wallet again
./pivxd &

./pivx-cli getinfo
(if you get “error: {“code”:-28,“message”:“Loading block index…”}” wait a minute and run again)

Now if everything went well you can send your PIVX to the address you created and noted before, when the chain is fully synced and the transavtion has 101 conformation you can start staking.

./pivx-cli walletpassphrase "your wallet passphrase" 9999999999 true

After a few minutes check if staking is active
./pivx-cli getinfo
(should say “staking status” : “Staking Active”)
and also check using
./pivx-cli getstakingstatus

If you have any questions feel free to DM me on Slack @mbalance

(Additional for Raspberry Pi’s)
If you want to be extra safe you can backup your wallet.dat to a USB drive in addition

To propperly mount it follow this

once mounted you can copy your wallet.dat onto the USB
cp ~/.pivx/wallet.dat /media/usb


Raspberry pi for pc or apple
#2

Using
./pivx-cli backupwallet ~
Also does the backup. ~ can be swapped with any directory

Sweet tutorial!


#3

Now is there a way to query strat amount in your wallet using command line?


#4

Sorry, how would you do this in the qt wallet?

Edit: maybe like this setstakesplitthreshold <1 - 999,999>


#5

Amazing tutorial! Thank you SOOOO much!!!


#6

Great guide, I just had to add

staking=1

to my pivx.conf to get staking active.


#7

pivx-cli getbalance is that what you are looking for?


#9

instead of the github link for 2.2.0, maybe just ad x.x.x?


#10

Not working. When I enter

./pivxd &

I get

[1] XXXX

and then when I enter

./pivx-cli getinfo

I get

Segmentation fault

Anyone know what this could be?


#11

In the .pivx directory there is a debug.log, do the last few lines of that file indicate any errors?


#12

There’s nothing in there except pivx.conf. I tried ./pivxd -printtoconsole so anything would go to the screen instead of the log file and it’s just the same as when I try ./pivx-cli getinfo. It displays Segmentation fault.

Also, this is a new install and I had no other problems with any of the steps.


#13

Very interesting, it would appear as if the daemon isn’t really starting. Is there anyway to run the GUI wallet for a test? ./pivx-qt


#14

GUI wallet won’t even start. Entering ./pivx-qt just gives me the same thing Segmentation error.

I should have clarified it from the start so just to clarify it now before more effort is put into this… this is a new install on a Raspberry Pi B+ with a 16gb SD card with Raspbian Stretch Lite with the Pixel Desktop added on and I am using the 32bit ARM PIVX Wallet version pivx-3.0.6-arm-linux-gnueabihf.tar.


#15

The wallet most likely cannot run on the raspberry pi b+ due to a lack of RAM. The wallet uses +/- 1 GB of RAM.

I did some searching and there is a chance that your SD card has become corrupt and needs to be re-written but if I were to bet, i think it’s due to the lack of RAM.

You could try increasing the swap space to 2048 but I think you’ll still have issues:

Unfortunately using a different device is a the better option. I would look at boards with 2GB RAM, potentially an ODroid.


#16

Newb here. Trying to start the staking process.

Here is what I see:
“validtime” : true,
“haveconnections” : true,
“walletunlocked” : true,
“mintablecoins” : true,
“enoughcoins” : true,
“mnsync” : true,
“staking status” : false

How can I set staking status: true?

TYIA


#17

Try restarting your wallet and unlocking for staking again. It should start staking within 30 minutes and usually much faster.


#18

Great guide, thank you so much for the walk through. Just one question since I’m kind of a noob:

./pivx-cli walletpassphrase “your wallet passphrase” 9999999999 true

this command unlocks the wallet for staking and anonymazation only correct? Like nobody could potentially access my Pi and send pivx without re entering my password?


#19

That’s what the “true” value is for. If that is left out (or if false is used) then the wallet is fully unlocked for sending. Also it is better to use 0 instead of 9999999999


#20

Hey thanks for both of the tips!


#21

I did all that and staking arrow still is dim, showing no staking. Why is this so hard?