Getting started

From Nxtwiki
Jump to: navigation, search

Nxt is an open source second generation blockchain that provides tools for a decentralized financial platform. Coded in Java completely from scratch, Nxt was the first currency to rely purely on proof-of-stake for consensus.


Download Nxt

Nxt is supported by all major operating systems. Before we begin, if you haven’t already done so, you may wish to check that you have the correct (usually most recent) version of Java installed on your computer. You can use any compatible Java available for your platform. The minimum required version is Java 8. The recommended version is Java 11. We usually test with OpenJDK 11.


To start with Nxt, you need to have the Nxt client software installed and up to date. You can find the download and installation instructions of the core Nxt client as follows:

Windowslogo.jpg AppleLogo.jpg Linuxlogo.jpg RaspberryPi Logo.png Android.png

Client Installation

  1. Download the Windows installer for the latest official Nxt Client 1.12.1 from https://www.jelurida.com/nxt-client.exe.

After downloading, verify its signature

  1. Run the installer and follow the instructions on screen. Icons will be created by default in your desktop and Start Menu.
  2. You can now run the Nxt software.If you already have created a Nxt account, click in 'Returning User' to introduce your passphrase. If you need to create your Nxt account, click here for instructions to Create a New Nxt Account.


  1. Download the Mac installer for the latest official Nxt Client 1.12.1 from https://www.jelurida.com/nxt-installer.dmg.

After downloading, verify its signature and check the SHA256 hash of the package for security.

  1. Run the installer package (Nxt's Mac installer comes packaged in .dmg format) and follow the instructions on screen
    1. Open the nxt-installer.app and click on the "Open" button
    2. Select the language
    3. Click on 'Next' to begin with the installation
    4. Accept the terms of the license agreement
    5. Select the installation path
    6. Check the options
    7. Once installed, click on finish
  2. You can now run the Nxt software clicking on the "Nxt.app" in Applications. If you already have created a Nxt account, click in 'Returning User' to introduce your passphrase. If you need to create your Nxt account, click here for instructions to Create a New Nxt Account.



Here is the guide to installing the Nxt Client on a Linux 64-bit platform. 32-bit installation instructions are very similar; you just might need to download the 32-bit version of Java instead of the 64-bit one.

You can use this instructions on your Linux VPS as well (but also see our public node installation instructions ).

Set up Java

You can skip this step if you already have Java installed. Otherwise, you can install it via PPA repository doing the following (for Ubuntu/Debian builds):

sudo apt update 
sudo apt install openjdk-11-jre-headless

Install and run the Nxt Client

Find below the instructions for installing the software.

Using the Universal Zip Package
  1. Change to your home folder and download the latest client (version 1.12.1):
    cd ~
    wget https://www.jelurida.com/nxt-client.zip
    • SHA256 hash -
      d5d48729a1f32b8c11066bcdb203dd7760a582896afe8d2506feb93cf833f606 nxt-client-1.12.1.zip
(source: Jelurida Release) - How to verify SHA256 checksums
  1. Unzip it:
    unzip nxt-client-1.12.1.zip
    cd nxt
Using the Unix installer

You can execute the unix installer executable compatible with most linux distributions from nxt-client.sh and follow the instructions.

wget https://www.jelurida.com/nxt-client.sh
sh nxt-client.sh
Run the Nxt client
  1. Now it's time to start the software. You may start it by executing ./run.sh, which you will find in the nxt directory. The server will be active as soon as you see in the window a text similar to this:
    Nxt server 1.12.1 started successfully. This shell window will be running the Nxt server and print all the Nxt log messages, so it needs to stay running!
  2. Open http://localhost:7876/ from a web browser to access the Nxt Client. Please note that, if it's the first time you run Nxt in your machine, the Nxt blockchain will need to be downloaded until it is up to date. Depending on the your network connection speed, this may take a few hours. The Nxt Client will show you a progress bar as the blockchain downloads. Now you can visit the instructions to create your Nxt account!
    NxtWallet start small.png
    • NOTE: If you've installed the client on a dedicated server or VPS, you should change "localhost" to your Server/VPS IP.



(Originally created by barbarosinciler at nextcoin.org . If this is of value to you, please donate some Nxt to him at address 7121642459245273749. The Java package that installs Nxt on your Pi was written by davethetrousers, at 14923118471272229432)

Raspbian and the NRS client for Nxt both run very well on a Raspberry Pi. CPU usage is approximately ~15-20% with the web client open and an account unlocked. Without the web client open (still unlocked) it is less than ~10% most of the time (it occasionally peaks higher and MAY occasionally spike to full load). Memory usage is about 100MB

Once this software is installed on your Raspberry Pi, it will start automatically on boot. You can administer it using remote desktop from another PC.

This tutorial makes the following assumptions; adjust accordingly!

  • your installation PC's is running Windows and has an IP of 192.168.1.20
  • your network router's IP is 192.168.1.1

Basic Raspbian install guide

  1. download and install Raspbian
    • Download the Raspbian image from [1]
    • Download diskimager for windows [2].
    • Install image on an SD Card, and boot the Raspberry from the card. You should see a config menu.
      • Expand filesystem and change your password.
      • Enable boot to desktop.
      • Set internationalisation options (language, keyboard and timezone)
      • Under advanced options enable ssh and set a hostname like "rpi".
      • Reboot. Now you should see a desktop and the system is running

Update the system

  1. open the bash commandline (LXTerminal), type the following, and follow the instructions:
    • sudo apt-get upgrade
      sudo apt-get dist-upgrade
  2. Check your IP configuration
    • Your Pi should pick up an IP address from DHC, and this can be confirmed with the ifconfig command in a shell. To configure a static ip, open the bash commandline (LXTerminal) and type the following:
      • sudo nano /etc/network/interfaces
    • Change the following entry from:
      iface eth0 inet dhcp
      To:
      iface eth0 inet static
      address 192.168.1.10
      netmask 255.255.255.0
      gateway 192.168.1.1
      network 192.168.1.0
      broadcast 192.168.1.255
    • Press CTRL and O at the same time to save the file
    • Press CTRL and X together to exit
    • Reboot your Pi

Install XRDP (RDP server)

  1. Open the bash commandline (LXTerminal) and type the following, and follow the instructions:
    • sudo apt-get install xrdp
      sudo apt-get upgrade xrdp
  2. Now you can use Microsoft Remote Desktop and work remote on the Raspberry.
    • In windows go to start -> open -> and type "mstsc"
    • Enter your Raspberry's address (192.168.1.10), connect and sign in with your password


Router/firewall port forwarding

  1. Make sure to forward TCP port 7874 tcp on your network router to the IP your raspberry has (192.168.1.10)

Install NXT Client

You have two possible options here:

  1. Use your Raspberry Pi with the standalone package Oracle JRE included (all credits to the author: davethetrousers )
    1. Download the tar.gz file from davethetrousers' mirror with wget and extract it:
      • wget http://109.230.224.65/~nxt/nxt_rasppi.tar.gz
        tar -xf nxt_rasppi.tar.gz
      • To start NRS automatically on raspberry reboot edit the run_nxt.sh file in nxt folder:
        • nano nxt/run_nxt.sh
      • Copy the code located at the end of this section, and paste it into your file.
      • Press CTRL and O at the same time to save
      • Press CTRL and X together to exit.
      • Enter: crontab -e
      • Insert the code at the end of the file:
        @reboot /home/pi/nxt/run_nxt.sh start
      • Press CTRL and O at the same time to save
      • Press CTRL and X together to exit.
    2. Now the raspberry should be able to load the NRS software on boot
  2. Step by step installation from devs mirror with build in raspbian java
    1. Download the NRS client (current version: 1.12.1) https://www.jelurida.com/nxt-client.zip
      • SHA256 hash -
        d5d48729a1f32b8c11066bcdb203dd7760a582896afe8d2506feb93cf833f606 nxt-client-1.12.1.zip
(source: Jelurida Release) - How to verify SHA256 checksums (you really should check here to make sure this matches your downloaded file's checksum before you install anything!)
    1. Unzip the file:
      unzip nxt.zip
    2. Now the NRS client is in your home folder (/home/pi/nxt/)
    3. Enter: crontab -e
      • Insert the code at the end of the file:
        @reboot /home/pi/nxt/run.sh
      • Press CTRL and O at the same time to save
      • Press CTRL and X together to exit.
    4. Now the raspberry should be able to load the NRS software on boot

Stop script for the Nxt software

  1. Create a new file in the /home/pi/nxt/ folder and name it something like "stop_nxt.sh":
    nano nxt/stop_nxt.sh
    1. If you are using davethetrousers' Java package, enter this code:
      /home/pi/nxt/ejre1.7.0_45/bin/java -Xmx1024M -cp nxt.jar;lib/*;conf nxt.Nxt STOP.PORT=11111 STOP.KEY=123456 --stop
    2. If you downloaded the Nxt software directly:
      /usr/bin/java -Xmx1024M -cp nxt.jar;lib/*;conf nxt.Nxt STOP.PORT=11111 STOP.KEY=123456 --stop
  2. Press CTRL and O at the same time to save
  3. Press CTRL and X together to exit.

Now you can stop the client on bash command line with the following command:
sudo bash nxt/stop_nxt.sh Before reboot your Pi, you should use this script to prevent a blockchain error!

Now you can reboot the system with:
sudo reboot

Connecting from your PC instead of localhost

  1. Create a nxt.properties file under the nxt/conf/ folder. You can create the file from command line using the command nano nxt/conf/nxt.properties and write the following in it. Make sure to modify the IP accordingly to yours:
    nxt.allowedBotHosts=127.0.0.1; localhost; 192.168.1.20; 0:0:0:0:0:0:0:1;
    nxt.allowedUserHosts=127.0.0.1; localhost; 192.168.1.20; 0:0:0:0:0:0:0:1;
  2. Press CTRL and O at the same time to save
  3. Press CTRL and X together to exit

Manually start forging with the NRS client

To start forging you will need to be logged in with your web browser once.

  1. Open http://192.168.1.10:7876
  2. Unlock your account with your passphrase (unlocking an address takes a few seconds).
  3. If on the left side, next to the red dot, it says "Not forging", click it to start.
  4. Now you can close your browser. It will keep forging.

Handling NRS and Java errors

You can check the java logfiles (nxtout.txt and nxterr.txt) in the nxt folder for errors!

Having issues?

Check the Faq and the "common problems and resolutions" pages!

Additional useful commands and tools

Mount your local windows hard drive remotely, for Raspberry Pi data sharing

sudo mount -t cifs //192.168.1.20/c$ /mnt -o user=myusername Where:

  • x = The IP address of your Windows PC
  • myusername = your username on the windows PC
Start the menu changing raspbian settings (language, keyboard, timezone, hostname etc.)

sudo raspi-config

Check the built-in Java configuration

sudo update-alternatives --config java (The standard location is marked with a star, and the path is something like /usr/lib/jvm/jdk-7-oracle-armhf/jre/bin/java/ The defaults are priority = 317 and auto-modus. If that is ok, confirm by pressing Enter.

Remote administration with putty

You can manage your raspberry with the tool "putty" through a command line SSL connection. Download the tool from [3]

run_nxt.sh file

Use the following code in your run_nxt.sh script:

#!/bin/bash
### BEGIN INIT INFO
# Provides:          NXTserver
# Required-Start:    $local_fs $remote_fs $network $syslog $named $sshd
# Required-Stop:     
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop NXT server
### END INIT INFO

if [ `id -u` != "0" ] && [ "$1" = "start" -o "$1" = "stop" ] ; then
  echo "You must be root to start/stop nxt."
  exit 1
fi

# Settings
nxtdir=/home/pi/nxt
nxt=nxt.jar
java=/usr/bin/java
nxtpid=/var/run/nxt.pid
nxtlog=/home/pi/nxt/nxt.log
nxtuser=pi
nxtgroup=pi
nxtnice=19
timeout=700
maxmem=120
# end Settings

# check for exist files and dirs
test -d $nxtdir || exit 0
test -f $nxtdir/$nxt || exit 0
test -f $java || exit 0

# make sure $nxtdir is ours!
chown -R $nxtuser:$nxtgroup $nxtdir

. /lib/lsb/init-functions

function status {

    start-stop-daemon -T --pidfile "$nxtpid" && echo "NXT server is started." \
    || { echo "NXT server is stopped." ; return 1; }

    return 0;
}

case "$1" in
    start)
        log_daemon_msg "Starting NXT server..." "" || true

        # check if server is running
        if [ -e $nxtpid ]; then
            pid=`cat $nxtpid`
            var=`ps -p$pid | wc -l`

            if [ $var -lt "2" ]; then
                # clear logfile
                echo -n > $nxtlog
            else
                echo -n " NXT server is already running!"
                log_end_msg 0 || true
                exit 0
            fi
        fi
        
        # Enable Debug for more info when starting NXT
        if cat $nxtdir/conf/nxt.properties | grep -q  "nxt.debug="; then
            if cat $nxtdir/conf/nxt.properties | grep -q  "nxt.debug=true"; then
                # Debug is enabled, nothing todo...
                echo -n ""
            elif cat $nxtdir/conf/nxt.properties | grep -q  "nxt.debug=false"; then
                echo nxt.debug=true >> $nxtdir/conf/nxt.properties
            fi
        else
            echo nxt.debug=true >> $nxtdir/conf/nxt.properties
        fi
                
        # n minute timeout.
        sleep $timeout &
        timerPid=$!

        # check log file and generate status-msg; will be killed when server is started or timeout hit
        tail -q -n0 -F --pid=$timerPid $nxtlog 2> /dev/null | while read line; do

            if echo $line | grep -q  "Scanning blockchain"; then
                echo -n " Scanning blockchain"            
            elif echo $line | grep -q  "processed block"; then
                echo -n "."            
            fi

            if echo $line | grep -q  "started successfully."; then
                echo -n "NXT server started successfully."
                log_end_msg 0 || true
                # stop the timer..
                kill $timerPid > /dev/null 2>&1
				$nxtdir/traffic_shaper.sh > /dev/null 2>&1
            fi
        done &
        
        # start server
        if start-stop-daemon --start --name nxt --nicelevel $nxtnice --chuid $nxtuser:$nxtgroup --pidfile $nxtpid -m --chdir $nxtdir --exec $java >> $nxtlog 2>&1 -- -Xmx"$maxmem"m -cp $nxt:lib/*:conf nxt.Nxt >> $nxtlog 2>&1 & then
            # wait for the timer to expire (or be killed)
            wait %sleep > /dev/null 2>&1
        else
            log_end_msg 1 || true
        fi
        ;;
    stop)
        log_daemon_msg "Stopping NXT server..." || true

        # check if server is running
        if start-stop-daemon --stop --pidfile $nxtpid > /dev/null 2>&1; then
            
            while status > /dev/null; do
                sleep 1;
            done
            
            echo -n " NXT server stopped."
            log_end_msg 0 || true
            rm $nxtpid  > /dev/null 2>&1
        else 
            echo -n " NXT server is not running!"
            log_end_msg 0 || true
            exit 0
        fi
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    status)
        status
        ;;
    *)
        echo "usage:`basename $0` start | stop | restart | status"
        exit 1
        ;;
esac


Starting from release 1.11.0e the NXT client is also released as a mobile app for Android.

The mobile app is based on the existing web wallet packaged as an Apache Cordova application

Usability

The following usability enhancements were implemented for both the mobile app and web wallet

Lock screen has been reworked to support QR code scanning for both the account id and passphrase

Account id, passphrase and QR code scanning now use a button group to switch between input modes

The remember account and remember passphrase checkboxes has been merged into a single "Remember Me" checkbox. Choosing the "Remember Me" option when in passphrase entry mode will save the passphrase on the device itself so that next time the user enters the app it will load automatically the main menu. Choosing logout will delete the passphrase.

All data entry modals now support scanning the account id and passphrase using the device QR code scanner

The mobile app works as a light client, it will never download the blockchain to the mobile device and can therefore start to operate instantly after installation

Security

Upon startup, the mobile device, randomly selects a remote node to connect to from a list of bootstrap nodes hard-coded into the app based on the available remote nodes at the time of the app release

As usual, transactions are signed locally so that the passphrase never leaves the device

Functions which require the passphrase to be submitted to a remote node are disabled for the mobile device

In order to mitigate data manipulation attack by remote nodes, data returned by the remote node is validated against other remote nodes. In case of a difference a visual indication is displayed on the toolbar to warn the user that the data returned by the remote node may not be consistent. The same mechanism is also used when working as light client or as roaming client while the blockchain downloads

All communication with remote nodes is transmitted over insecure Http connection since most remote nodes which support Https use a self signed certificate which cannot be used by the mobile app. In order to use Https communication, one can configure the app to connect to a specific remote node as explained in the configuration section

New Widgets

When running the mobile app, a link to the "Mobile Settings" menu is displayed on the lockup screen and welcome screen. The "Mobile Settings" menu is also accessible from the cogwheel menu

Configuration

The mobile settings modal allows the user to select the following configurations

Check Remember Me Checkbox - determines the default state of the "Remember Me" checkbox (this setting was present in the account settings previously but did not work since version 1.5)

Simulate Mobile App - allows a web wallet to simulate a mobile app with respect to peer selection and other functions. This setting should only be used for development and troubleshooting and it is not displayed when running a mobile app

Connect to Testnet - when checked, the mobile device will connect to testnet nodes instead of mainnent node. This mode is useful for testing and demonstration purposes

Remote Node Address, Remote Node Port and Use Https - when relying on random public nodes is not good enough for your purpose, and in case you know of a trusted public node you can use, you can configure the address, port and protocol selection of this node using these settings. This will also allow you to communicate with the remote node over Https but only in case the remote node support CA approved SSL certificate.

Number of Data Validators - number of nodes with which to compare each response from the connected remote node. By default the client will use 3 such random nodes, this value can be reduced to 0 in case you are connected to a trusted remote node

Number of Bootstrap Nodes - number of random nodes from which to select the connected node and the data validator nodes. These nodes will be further queried to obtain additional remote nodes

Data Validation

In order to make sure that a random remote node to which the app is connected, does not feed the app with false or malicious data, each request sent to a remote node is further confirmed with up to 3 additional remote nodes. The status of the confirmations is displayed as an icon with Green/Yellow/Red colors to the right of the "Mobile Client" status button. In case the indicator consistently displays Red values, this may hint that the connected remote node has been compromised

Click on the "Mobile Client" link, to see a list of the latest requests from the remote node and their validation status

In some cases, a temporary validation failure is normal, for example, while a new transaction propagates through the network, therefore use your best judgement

Testing the mobile app

At the moment, the mobile app is not deployed to the Google and Apple app stores

Users who wish to use the app has the following options:

1. Manually deploy the app bundle uploaded to BitBucket to their mobile device

2. Register an account at Ionic using your email, then install the Ionic View application on your mobile device, send me your email address so that I share the app with you, then from the ionic view options menu, select "Preview an app" and enter app id ec170f70


Start using the Nxt client

If you would prefer, you can first familiarise yourself with Nxt by playing around with the Demo.

  1. Create a Nxt account address
  2. Learn how the Nxt client software works
  3. Learn the Security Features of NXT
  4. Exchanges to get or buy some NXT
  5. Explore more features of Nxt


Need help?

Need help during the download or development process? Contact us on the slack #helpdesk channel, chat with community experts on the Nxt Forum. You can also reach us opening a ticket in our helpdesk

You can also ask community experts in the Nxt Forum or in the Nxt Slack (invites are here) or take a look at the NxtWiki FAQ


Getting your first NXT

The exchanges and tools where you can get NXT with CNY, EUR, USDT, BTC and other currencies are listed here.

With the Nxt client installed, it is now time to start transacting. To do that, we need to get some NXT tokens. The Nxt mainnet is live and actual tokens are in circulation across numerous major exchanges.

Note the tokens we will be using in the next examples are from testnet. These tokens are not traded in exchanges and have no monetary value -- they exist only as a convenience for developers and those willing to experiment with the features.

The process for receiving testnet tokens is simple. Ask for them in the Nxt Forum, contact us on the slack channel #helpdesk. There is an external faucet as well.


Next steps

Learn how to use the Nxt platform by following the basic guides or start reading about Nxt's extensive built-in Features.


Feedback and errors

If an error in this documentation is found, we would love to be aware to correct it as soon as possible. Please write a question to info@jelurida.com and we will take care.