Using an XU4 as a NavCoin Stakebox (CLI Command Line)

Moderators: mdrjr, odroid

Using an XU4 as a NavCoin Stakebox (CLI Command Line)

Unread postby BuckoNZ » Tue Aug 07, 2018 7:52 am

Using An Odroid XU4 For A NavCoin Stakebox – NavPi Replacement.

The Odroid XU4 SBC from HardKernel packs quite a punch compared with many other SBC’s on the market. And as HardKernel has committed to continue making the XU4 until 2020 (probably longer) it’s going to be around for a while. We used the XU4Q (with the heatsink instead of the fan) to minimise power use (and therefore cost) and noise.

While the NavCoin NavPi stakebox – built on the Raspberry Pi 3B platform – is a great concept, many users are struggling to get the device to remain stable over time, due to the lack of native resources. While following these steps will not provide you with a nice GUI NavCoin wallet - it utlises the CLI command line tool - I have found it to be very usable. I use the app JuiceSSH on my Android phone to run CLI commands on the XU4.

I am not a developer. I am not a linux guru. In fact, I have no idea what I’m doing, so take that into consideration when you are following these steps.

Update #01 (30th Aug. 2018): Consolidated a number of steps and removed unnecessary tasks.
Update #02 (8th Sept. 2018): Two new dependencies added to the command in step 3). Discovered while doing a test build for recently released NavCoin v4.3.0.

STEPS:

1) Install a fresh full XU4 Ubuntu MATE image onto your eMMC storage card, using the USB connector. The image used here was the one dated 20180501 – this will install Ubuntu 18.04 LTS.

2) When first logging in, configure the usual look and feel, network settings and date/time, etc..

3) There are a number of build prerequisites that are required, including the Boost development packages, miniupnpc and Synaptic (because it's handy to have) :
$ sudo apt-get install build-essential libcurl3-dev libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils libqrencode-dev libboost-all-dev libminiupnpc-dev synaptic libunbound-dev libzmq3-dev

4) Some of the processing we will need to do is quite resource intensive, so we should grab ‘Zram’ as well, plus we will need 'Git':
$ sudo apt install zram-config git

5) BerkeleyDB is also required for wallet functionality, so we need to grab that:
$ sudo add-apt-repository ppa:bitcoin/bitcoin
$ sudo apt-get update
$ sudo apt-get install libdb4.8-dev libdb4.8++-dev


6) Lets reboot the XU4 at this point:
$ sudo reboot

7) After the reboot, we need to grab ‘NavCoin’ itself:
$ git clone https://github.com/navcoin/navcoin-core.git

8) We also need to make sure that the XU4 OS and components are all up to date before progressing further:
$ sudo apt update
$ sudo apt upgrade
$ sudo apt dist-upgrade
$ sudo reboot


9) After the reboot, move to the new ‘navcoin-core’ folder that is now on your XU4:
cd ~/navcoin-core

10) Lets now install NavCoin:
$ sudo ./autogen.sh
$ sudo ./configure CFLAGS="-O2 -mtune=cortex-a15.cortex-a7 -mfpu=neon" CXXFLAGS="-O2 -mtune=cortex-a15.cortex-a7 -mfpu=neon" --enable-hardening --without-gui
$ sudo make
$ sudo make install


11) The above process will take some time to complete. Once complete, lets reboot the XU4:
$ sudo reboot

12) Once the reboot is complete, open a new Terminal window, move to the NavCoin folder and start the NavCoin daemon:
$ sudo navcoind -staking

13) Please wait a good 5 minutes before doing anything else. After about 5 minutes, open a second Terminal window, use the NavCoin CLI tool – the command provided below will give you a list of commands you can use in conjunction with ‘navcoin-cli’.:
$ sudo navcoin-cli help

14) Using the web browser, go to the following URL to check what block the NavCoin blockchain is currently up too – take note of the block number at the very top of the web page:
https://chainz.cryptoid.info/nav/

15) Go back to the second Terminal window and use the following command to see how many blocks the XU4 has currently downloaded:
$ sudo navcoin-cli getblockcount

16) You can now close the first terminal window, used to start the NavCoin daemon - it will continue running in the background. As at the time of writing, depending on your internet connection, you are looking at 9 to 10 hours, for your instance of NavCoin to catchup with the blockchain. And until it has, you should not try and do anything with your NavCoin wallet.
Last edited by BuckoNZ on Sat Sep 08, 2018 3:45 pm, edited 6 times in total.
BuckoNZ
 
Posts: 13
Joined: Sun Jan 07, 2018 10:27 am
languages_spoken: english
ODROIDs: XU4

Re: Using an XU4 as a NavCoin Stakebox

Unread postby BuckoNZ » Tue Aug 07, 2018 10:30 am

** REMOVED COMMENT **
Last edited by BuckoNZ on Thu Aug 30, 2018 4:31 pm, edited 1 time in total.
BuckoNZ
 
Posts: 13
Joined: Sun Jan 07, 2018 10:27 am
languages_spoken: english
ODROIDs: XU4

Re: Using an XU4 as a NavCoin Stakebox

Unread postby BuckoNZ » Wed Aug 08, 2018 8:28 am

Some Additional Information

Importing Wallet
Assuming you already have a NavCoin wallet - I tried using the importwallet CLI command and this didn't work for me. I had too:
- Reboot the XU4
- Move into the /home/odroid/.navcoin4 folder.
- Using the MV command, change the name of wallet.dat to something else - I think I used wallet_old.dat .
- Using the CP command, I copied my wallet.dat file from my previous wallet into the .navcoin4 folder.
- Started the navcoind process.

Checking Your Wallet & Balance
Once I started the navcoind process, again I waited the 5 minutes for it to settle in and used the getwalletinfo CLI command, which returned the balance of NavCoin wallet.
To return the addresses associated with the wallet use the CLI command getaddressesbyaccount "".
If you have imported a previous wallet, you will probably see two addresses associated with your account - the first one would have been created with the build and the second (and any others) due to the import.

Starting To Stake
Using the -staking flag when starting the navcoind process, starts the NavCoin core with an intent to stake your coins. However just like you need to do on your Windows or NavPi wallet, you need to "unlock" your wallet, before staking commences.
- Using the getstakinginfo CLI command, you will see that Enabled returns TRUE and Staking returns FALSE. So as mentioned above, the NavCoin core is expecting you to stake and is ready to do so, but it's not currently staking.
- To unlock your encrypted wallet to begin staking, you need to use the following CLI command: walletpassphrase "password" 9999999 true
- However if your password contains special characters (like ! etc., as it should), you need to use single quotes (') around your password instead of double quotes ("). So the command would look like: walletpassphrase 'password' 9999999 true
- If you run the getstakinginfo CLI command again, you will then see that both Enabled and Staking now return TRUE. You are staking!
The value of 9999999 (that is seven 9's) should keep your XU4 staking for approx. 110 days, so if you factor in a restart every quarter (3 months) and repeat of the above process, it will ensure you keep staking.

Backing Up Your Wallet
Unlike the importwallet CLI command that didn't work for me, the backupwallet CLI command appeared to work fine.
The full command is: backupwallet "destination".
For my test, I sent the backup dat file to the Desktop, so the syntax I used was: backupwallet "/home/odroid/Desktop/wallet_YYYYMMDD.dat" .

Sending Nav
In order to send Nav from your wallet on the XU4, you first need to unlock it for the purposes of a transaction. The command is very similar to the one used to unlock your wallet for Staking except (a) you don't want a significant timeout value associated with it and (b) you do not use the true flag at the end.
The CLI command to use is: walletpassphrase "password" 300.
The timeout value of 300 will give you 5 minutes in order to perform the command to send Nav to another wallet.
The CLI command to send Nav is: sendtoaddress "walletaddress" value
Once you're done, remember to use the wallet unlock command specifically for Staking to ensure you start Staking again.
Last edited by BuckoNZ on Thu Aug 30, 2018 4:37 pm, edited 1 time in total.
BuckoNZ
 
Posts: 13
Joined: Sun Jan 07, 2018 10:27 am
languages_spoken: english
ODROIDs: XU4

Re: Using an XU4 as a NavCoin Stakebox

Unread postby BuckoNZ » Sat Aug 11, 2018 3:09 pm

Confirming the stability of NavCoin on the XU4

Before I completely abdanoned my NavPi permanetly, I wanted to ensure my instance of NavCoin that I built on the XU4 was "working as intended". As a result, I wanted to complete the following key tests to ensure that was the case

Test 1 - Receicing Nav from an External Party
- I purcahsed NZ$100 worth of Nav from an exchange and configured the order, so that the coins went directly into my wallet on the XU4.
- I eventually received an email from the exchange confirming that the order had been completed.
- On checking the balance of the wallet on the XU4, it had increased by the order amount. Checked by using the getwalletinfo CLI command.
[Test 1 Passed]

Test 2 - Sending Nav from wallet on XU4 to an External Party
- Using the sendtoaddress CLI command, I sent 25 Nav to a wallet address on an external platform.
- Checking the balance of the wallet on the external platform, approximnately 15 minutes later, it's balance had increase by 25 Nav. And the balance of the wallet on the XU4 had decreased by 25 Nav.
- As a double check, I then sent 24.5 Nav from the external platform to the wallet on the XU4.
- About 15 miniutes later, using the getwalletinfo CLI command, I confirmed the balance of the wallet on the XU4 has increased by the 24.5 Nav .
[Test 2 Passed]

Test 3 - Receiving Stake Reward to the wallet on XU4
- Using the getstakingreport CLI command, it was determined that a Staking Reward of about 3.2 Nav had been received a couple of days prior.
- I confirmed that the balance of the wallet on the XU4 had increased by the same amount, sing the getwalletinfo CLI command.
[Test 3 Passed]

Test 4 - Restoring wallet on XU4 onto External Platform
- After revecing the Stake Reward, mentioned above, the wallet on the XU4 was backed up, used the backupwallet CLI command.
- The resulting file was captured and moved to an external platform.
- The existing wallet.dat file on the external platform was deleted and replaced with the wallet.dat from the wallet on the XU4.
- The external platform was rebooted and the XU4 was shutdown.
- On reboot, the wallet information on the external platform was checked and it was showed a wallet address and wallet balance associated with the wallet on the XU4. This would indicate the restoration was successful.
[Test 4 Passed]

Test 5 - Successfully Completed OpenAlias Registration Recently Added
- Registered an OpenAlias friendly address name on the website.
- Used the CLI command signmessage "address" "OpenAlias name"
- This resulted in a long string being provided. This was copied and pasted into the relevant area on the OpenAlias signup page. Was advised that the Registration was successful.
[Test 5 Passed]

With the successful completion of all 5 tests, I'm comfortable that the XU4 build is working correctly.
Last edited by BuckoNZ on Fri Aug 31, 2018 8:29 am, edited 1 time in total.
BuckoNZ
 
Posts: 13
Joined: Sun Jan 07, 2018 10:27 am
languages_spoken: english
ODROIDs: XU4

Re: Using an XU4 as a NavCoin Stakebox

Unread postby rooted » Sat Aug 11, 2018 3:57 pm

Thanks for taking us along for the ride and providing documentation.
User avatar
rooted
 
Posts: 5578
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english
ODROIDs: C1, C1+, C2
XU3 Lite, XU4
N1
VU7+
HiFi Shield 2
Smart Power (original)

Re: Using an XU4 as a NavCoin Stakebox (CLI Command Line)

Unread postby caquinn7 » Sun Sep 02, 2018 1:48 am

Thank you for all this info BuckoNZ. Following your steps, I was able to get a wallet working on my xu4. I have sent a couple of transactions to the wallet, and according to the getstakinginfo command, I am currently staking my coins. However, whenever I run the getstakereport command the navcoind process crashes with a segmentation fault. Any idea why this is happening and what I could do to fix it? I haven't been able to find any reports of others having this problem.
caquinn7
 
Posts: 3
Joined: Sun Sep 02, 2018 1:36 am
languages_spoken: english
ODROIDs: XU4

Re: Using an XU4 as a NavCoin Stakebox (CLI Command Line)

Unread postby BuckoNZ » Sun Sep 02, 2018 5:13 am

caquinn7 wrote:Thank you for all this info BuckoNZ. Following your steps, I was able to get a wallet working on my xu4. I have sent a couple of transactions to the wallet, and according to the getstakinginfo command, I am currently staking my coins. However, whenever I run the getstakereport command the navcoind process crashes with a segmentation fault. Any idea why this is happening and what I could do to fix it? I haven't been able to find any reports of others having this problem.


Sorry you are having this issue and I haven't come across it before. As I mentioned in my first post, I'm not a dev or a Linux expert (far from it), but it's my understanding that segmentation fault is usually caused by (a) the program is trying to address memory that either isn't there or in an address range it's not supposed to use, or (b) the programme is referencing a pointer of some kind that isn't there.

Now this is usually a software bug, however perhaps it's trying to use some swap memory on a dodgy part of your MicroSD card or eMMC card?

As a starting point, perhaps uninstall/remove/stop zram before starting up the navcoind daemon, wait the 5 minutes to let it settle in and try again?

Just a thought.
BuckoNZ
 
Posts: 13
Joined: Sun Jan 07, 2018 10:27 am
languages_spoken: english
ODROIDs: XU4

Re: Using an XU4 as a NavCoin Stakebox (CLI Command Line)

Unread postby BuckoNZ » Wed Sep 05, 2018 4:20 am

It looks like a new NavCoin Core has been released. It might be worthwhile backing up your wallet and starting again, to see how you get on.
BuckoNZ
 
Posts: 13
Joined: Sun Jan 07, 2018 10:27 am
languages_spoken: english
ODROIDs: XU4

Re: Using an XU4 as a NavCoin Stakebox (CLI Command Line)

Unread postby caquinn7 » Wed Sep 05, 2018 10:25 am

BuckoNZ wrote:It looks like a new NavCoin Core has been released. It might be worthwhile backing up your wallet and starting again, to see how you get on.


I will definitely back up my wallet and try out 4.3.0.

In regards to your earlier post, I uninstalled zram, rebooted, and started up navcoind again, but unfortunately that did not fix the problem.
Also, I am running the rootfs from an external ssd over usb3.0. The ssd is new, so hopefully there aren't any issues with it.

Thanks for letting me know about the update.
caquinn7
 
Posts: 3
Joined: Sun Sep 02, 2018 1:36 am
languages_spoken: english
ODROIDs: XU4

Re: Using an XU4 as a NavCoin Stakebox (CLI Command Line)

Unread postby vtr1000 » Wed Sep 12, 2018 2:16 am

Thank you very much for this, it helped tremendously. :)

If you want any input I'd recommend stripping 'sudo' from the first 3 commands under point 10. Also, 'make' can be sped-up by assigning more jobs with ' -j4' (assuming that navcoind is not running).

Example:

Code: Select all
./autogen.sh
./configure CFLAGS="-O2 -mtune=cortex-a15.cortex-a7 -mfpu=neon" CXXFLAGS="-O2 -mtune=cortex-a15.cortex-a7 -mfpu=neon" --enable-hardening --without-gui --enable-upnp-default --prefix=/usr
make -j4
sudo checkinstall
make clean


Thanks again - this guide helped me decide upon the Odroid platform. 8-)
vtr1000
 
Posts: 1
Joined: Wed Sep 12, 2018 1:56 am
languages_spoken: english
ODROIDs: HC1 w/ Armbian Bionic


Return to Projects

Who is online

Users browsing this forum: No registered users and 1 guest