PIVX CLI: How to easily and safely unlock your wallet for staking

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@givanse·
0.000 HBD
PIVX CLI: How to easily and safely unlock your wallet for staking
Unlocking your wallet for staking is very easy. You'll find on the web that all you have to do is execute this command `pivx-cli walletpassphrase <passphrase> <timeout> <anonimize>`. It is the right command. However, there is a problem, your **passphrase** will be recorded in the **shell history** after you execute it. Nobody wants their wallet passphrase recorded with clear text anywhere.

Of course there are ways to clean up the shell history. But, you don't have to deal with that problem if the passphrase is never put in the shell history to begin with. For that, I use the script below. Once you execute it you'll be prompted for the passphrase in a secure way; i.e. `read -s -p`.

```bash
#!/bin/bash

# pivx-cli docs:
# https://pivx.freshdesk.com/support/solutions/articles/30000020865-debug-console-command-line

set -e

read -s -p 'wallet passphrase: ' passphrase 

timeout=999999999 #300 years
anonymizeonly=true
./pivx-cli walletpassphrase $passphrase $timeout $anonymizeonly 

exit 0
```

I prefer to do it with a script like this because I don't have to type in again the rest of the arguments that I know won't be changing (timeout and anonymize).

Usage example:

```
./.pivx/unlock-for-staking.sh
wallet passphrase:
```

Another good thing is that the characters won't be shown as you type them.
👍 , , , ,