Wallet for LINUX

Updating the UBUNTU Linux

Considering your Operation System is working, we will start to install the wallet, update the blockchain data and set-up the Masternode

================ Step 01 // Preparing the environment ================

Updating the Ubuntu system
Code:
sudo apt-get -y update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Installing the GIT process to download the Wallet Code
Code:
sudo apt-get install git

Installing the DIG to identify your IP Address
Code:
sudo apt-get install dnsutils

Installing the libraries to load to load the PNX Wallet
Code:
sudo apt-get install build-essential libssl-dev libboost-all-dev git libdb5.3++-dev libminiupnpc-dev screen

First, let's create a specific folder for PNX and give permission
Code:
sudo mkdir /wallets
sudo chmod 777 /wallets

PROOF-OF-STAKE MODE

================ Step 02 // Getting the wallet ================

Downloading the Github Code
Code:
cd /wallets
git clone https://github.com/phantomxdev/phantomx.git

Compiling the code maybe this process will take long time running
Code:
cd /wallets/phantomx/src/leveldb
chmod +x build_detect_platform
cd /wallets/phantomx/src
sudo make -f makefile.unix

Copying the bin to the main folder
Code:
cd /wallets
cp /wallets/phantomx/src/phantomxd /wallets/phantomx/

================ Step 03 // Personalizing the WALLET DATA folder ================

This step will allow to save the data like wallet.dat, phantomx.conf and blockchain data in a specific folder into the dir "/wallets/phantomx/wallet"
Code:
mkdir /wallets/phantomx/wallet

Creating the CONFIG file authorizing the Proof-of-Stake mode
Code:
vi /wallets/phantomx/wallet/phantomx.conf
and add these lines:
rpcallowip=127.0.0.1
rpcuser=<user you want>
rpcpassword=<your password>
staking=1
server=1
listen=1
addnode=54.218.118.59:9340
addnode=54.218.118.59:9341
TIPS:
To insert these lines using VI EDITOR, press:
    "i": to insert
    "SHIFT + INSERT or RIGHT CLICK" to paste the code above
    "ESC": to leave from edit mode
    ": + x": to leave from VI EDITOR and SAVE

Starting the Wallet with PoS Mode activated
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet -daemon -server

Waiting the BLOCKCHAIN update with the EXPLORER.
1 - Open the EXPLORER: http://explorer.phantomx.co
2 - Check the latest number of block
3 - Run the command bellow and the look the number on the parameter BLOCKS:
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet getinfo

After the blockchain is updated, let's create the WALLET ADDRESS
SAVE your WALLET ADDRESS
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet getaccountaddress MN01

HOW TO CREATE A MASTERNODE

Considering your wallet is completed syncronized.
To create a PNX Masternode, you need to have EXACTLY 20.000 PNX.
First of all, let's change the phantomx.conf to allow load the MASTERNODE.

================ Step 01 // Getting additional infos ================

Get you private key using your WALLET ADDRESS - do not send it for anyone
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet dumpprivkey <your WALLET ADDRESS>
Lost your ADDRESS WALLET? Run this command:
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet getaccountaddress MN01
SAVE THIS PRIVATE KEY in a safety place

Identifying your EXTERNAL IP Address
Code:
dig +short myip.opendns.com @resolver1.opendns.com
Save this IP ADDRESS temporarily

================ Step 02 // Configuring your wallet ================

STOPPING your wallet
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet stop

Changing the CONFIG file
Code:
vi /wallets/phantomx/wallet/phantomx.conf
change your CONF file similar with this:
rpcallowip=127.0.0.1
rpcuser=<user you want>
rpcpassword=<your password>
staking=0
server=1
listen=1
port=9340
masternode=1
masternodeaddr=<your IP ADDRESS listed above>:9340
masternodeprivkey=<your PRIVATE KEY listed above>

addnode=54.218.118.59:9340
addnode=54.218.118.59:9341

STARTING your wallet
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet -daemon -server

Check if your wallet is update with the EXPLORER.
1 - Open the EXPLORER: http://explorer.phantomx.co
2 - Check the latest number of block
3 - Run the command bellow and the look the number on the parameter BLOCKS:
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet getinfo

================ Step 03 // Sending PNX Coins ================

SEND EXACTLY 20.000 PNX for your new WALLET ADDRESS created on the process above

Waiting the TX be confirmed. You can accomplish it via:
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet listtransactions

Check if your balance is OK (should have 20.000 PNX at this point):
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet getbalance

================ Step 04 // Starting your Masternode ================

If all steps are OK, now you can start your Masternode
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet masternode start

Wait 3-5 minutes and check if your IP is listed on MASTERNODES LIST
Code:
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet masternode list | grep <your IP ADDRESS>

LINUX TIPS

These tips will allow you to create "shortcuts" instead of to right the full command in your console

================ Step 01 // Creating alias ================

ALIAS will help you to reduce the code when you are writing the code in the prompt.
Code:
alias pnx="/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet"

Now, type only:
Code:
pnx getinfo
instead of write
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet getinfo

================ Step 02 // Saving the alias in your profile ================

Let's save the alias on your profile
Code:
cd ~
vi .bash_profile

If .bash_profile is NOT empty, ignore this step! If IS EMPTY, add this on the begin of the file .bash_profile:
Code:
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
That's fine, let's add the ALIAS on the end of file:
alias pnx="/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet"

================ Step 03 // Quick tips ================

Wallet HELP
Code:
pnx -?

To know the balance and POW / POS / Block
Code:
pnx getinfo

Get only the total of coins
Code:
pnx getbalance

List of lasts of transactions
Code:
pnx listtransactions

Transfering coins to another wallet
Code:
pnx sendtoaddress <wallet address destionation> <total PNX>

example:

pnx sendtoaddress YechFPuCc4wd8BLQpwjWsNKazRJa2qfJEF 100

================ Step 04 // Creating SCRIPT to start the wallet when the Linux is restarted ================

Creating the shell-script file:
Code:
cd /wallets
vi start_wallet.sh

Copy and paste this code:
Code:
echo Starting PHANTOMX wallet /wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet -daemon -server
sleep 25
echo Starting PHANTOMX Masternode
/wallets/phantomx/phantomxd -datadir=/wallets/phantomx/wallet masternode start

================ Step 05 // Scheduling the Shell-Script ================

Opening the Ubuntu schedule in your local user
Code:
crontab -e
Copy and paste on the end of the file
Code:
@reboot /wallets/start_wallet.sh