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

================ Section 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

================ Section 02 // Virtual Memory ================

This section is valid ONLY if you have less than 2GB of memory.
Paging works by creating an area on your hard drive and using it like extra memory. This memory is much slower than normal memory, however it's necessary when the system is consuming much resources. If you need more than 1024 MB, change it.
Code:
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1

To enable it by default after reboot, add this line to /etc/fstab:
Code:
sudo vi /etc/fstab

Add the line above on the end of /etc/fstab:
Code:
/var/swap.1 swap swap defaults 0 0

Installing wallet as PROOF-OF-STAKE MODE

================ Section 03 // 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:
-->> Level DB
cd /wallets/phantomx/src/leveldb
chmod +x build_detect_platform
make libleveldb.a libmemenv.a

-->> SECP 256
cd /wallets/phantomx/src/secp256k1
chmod +x autogen.sh
./autogen.sh
./configure
make

-->> WALLET
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/

================ Section 04 // 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.
Downloading manually the latest blockchain database updated
Check out here:http://phantomx.co/guide/how-to-update-blockchain-linux

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

LINUX TIPS

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

================ Section 05 // 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

================ Section 06 // 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"

================ Section 07 // 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 PHyDqbAWoiG1mP9uNcoAVF3c5FLAgPRYuD 100

================ Section 08 // 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

================ Section 09 // 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