How Do I Run a Full NuBit Node on My Raspberry Pi?

Well i’m a bit late to respond to the ping, and it seems like everything has been answered. I don’t know if I saw it mentioned somewhere but I always had to set up a swap space to compile it from source.

##Beore compile:

sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile

##After compile

sudo swapoff /swapfile
sudo rm /swapfile

Those are the commands I was running to set it up. It may not be as much of a problem on the RaPi2, but on the first one I needed it. It took a LONG time to compile. I think upwards of two hours sometimes.

1 Like

Thank you guys, this is a very good start. I am putting together a draft while I do it myself on a brand new raspi b.

I am still lacking the instructions to clone the repo and build from source. Any hints?

I will add a few steps to the tutorial :

  • Create a user for nud
  • Configure static ip
  • enable ssh keys and disable password login
  • how to Run nud as a service (ping @pennybreaker :wink: )
  • import private keys
  • encrypt wallet
  • unlock wallet
  • configure data feeds
  • clear bsh history at logout automatically (to avoid leaks to the rpc pass or any CLI command)
  • you name it -

you’ll have to install git first

sudo apt-get install git

git clone https://bitbucket.org/JordanLeePeershares/nubit.git

cd nubit/src

make -f makefile.unix

That will clone and build from source.

https://docs.nubits.com/using-a-data-feed/#using-data-feeds-from-the-daemon

That’s how to use data feeds from the command line

1 Like

I think you should distinguish a full node that invites all the world to connect and a minting wallet node that security is important. The former has no fund and is barely more an empty R-pi on the net. There is not a lot motivation to break into it and default security setting is almost enough (get a good password though). The latter has funds and should have better security but overkill steps discourages adoption.

what I do specifically -

Either use user pi for simplicity or create a user of random name.

Only needed for full node.

[quote]enable ssh keys and disable password login
[/quote]

Keep passwd login for situation when you want to get into the pi without network connection. Do use a strong password.

starting nud -daemon is good enough for me.

I got everything working on my laptop and ftp the data directory (with the database subdirectory) to the pi. The wallet on the pi can be used with the same balance, passwd, and doesn’t need to download the full block chain. Remember to chmod 600 all data files.

see below

peerbox links .bash_history to /dev/null so there is no history

I have made a few scripts since I tend to forget -

start (start the daemon)
./nud -daemon

pass (Type in the password to start minting. There is no prompt! the password shows! type password, press return, press control-D)
./nud walletpassphrase `cat` 999999999 true

setfeed (set datafeed)
./nud setdatafeed https://...

nofeed (set no datafeed)
./nud setdatafeed ""

novote (clear all vote)
./nud setvote "{}"

I also have these aliases in .bashrc for status, logfile, pi temperature, recent blocks

alias g=’~/.nu/nud getinfo’
alias deb=‘less ~/.nu/debug.log’
alias temp=’/opt/vc/bin/vcgencmd measure_temp’
alias tx=’~/.nu/nud listtransactions | less’

Glad it’s been useful :slight_smile:

1 Like

Sure. After thinking it through this tutorial will illustrate how to run a minting node for securing the network via voting and staking. Will do a full node version when there is demand for it.

[static ip]Only needed for full node.

So you suggest to hide ssh from outside the network as a security measure?

What do you mean?

That’s actually a good point… What are the pros and cons of having a raspi minting on the same wallet you use somewhere else via GUI (on a laptop, like you said) ?[quote=“mhps, post:11, topic:490”]
I have made a few scripts since I tend to forget -
[/quote]

this is also why you’d want nud to run as a service :wink:

I thought you meant that the Pi should have a static IP to the outside world. I set up the router so that it always assign the same LAN IP to the Pi according to the MAC address. So the pi doesn’t need to change from DHCP, and internally it is easy to remember where to ssh to.

I recommend set up the router to block any connection of in bound ssh.

When you said “disable password login” did you mean it wouldn’t be possible to login from a plugged-in keyboard and monitor? If yes you could lock yourself out if you don’t have the other computer whose key is stored in the Pi.

I don’t mean they should mint at the same time. Usually the pi mints. The lap top is either off or running the client in locked mode to monitor new block rate remotely as a pi/nu-network health indicator.

peerbox has ppcoind in service mode. I find it very difficult to remember where all the files are located after a while. There are 3-4 places… /var/lib/ppcoind for the blkchain, /etc/conf.d for the service start conf file, ~/.ppcoin/ppcoin.conf for a user config… of course they are all different for a different kind of linux… nud stop is not enough to stop the service, you have to do a systemctl stop ppcoind … How confusing!

1 Like

Thanks! Very useful.

Oh no, sorry, I meant disable password authentication for SSH.

does anybody ever had problems with locale?

When I run nud getinfo I get :

 terminate called after throwing an instance of 'std::runtime_error'
   what():  locale::facet::_S_create_c_locale name not valid
 Aborted

I’ve googled and tried pretty much all the suggestions without success. A dirty fix is running an export everytime after I ssh into the raspberry ( export LC_ALL=“en_GB.UTF-8” ) .

I remember the same was happening to me with the old rpi last year .

Maybe depends on locale settings on my MacOs?

I don’t remember ever having seen that error on my RaPi.
Can’t say anything about McOS, though - don’t have products with bitten fruits :wink:

1 Like

Did you change locale using rasp-config ?

I have a line in nu.conf to force languate
lang=en_US

I had this problem a lot. Just send the export command to your user profile settings and you won’t have to enter it in every time.

echo export LC_ALL=en_US.UTF-8 >> ~/.profile

1 Like

submitted the initial draft of the tutorial, I tried to keep it as simple as possible.

There is an open PR on the repository : you can also see a (almost fully) rendered preview at this address .

Before we merge I invite everybody (thinking @CoinGame @mhps @Cybnate @woolly_sammoth @masterOfDisaster @pennybreaker ) to take a look at it, comment and suggest edits , here or directly on github

I have only skimmed through it so far.
It looks very good and comprehensive! Good job!
It’s good to see that the basic installation of an operating system on a RaPi is included as well.

I’m not familiar with making pull requests at github. Please forgive me making suggestions here.
This was a hack I once needed. Not sure whether it’s required in standard setup:

sudo ln -s /usr/lib/libminiupnpc.so.5 /usr/lib/libminiupnpc.so.10

By recommendation the config files are user only / read only mode, so I suggest changing that after nu.conf has been edited from

this to

sudo chmod 400 ~/.nu/nu.conf

I’ve created a tiny script to unlock the wallet for my Peercoin minter:

#!/bin/bash
read -s -p "Enter ppcoin wallet passphrase  : " passphrase
echo "Enabling stake mining"
ppcoind walletpassphrase $passphrase 99999999 true
sleep 5
ppcoind getinfo

Providing such a script as alternative (located at /bin/ ?) to manually unlocking might be convenient.

And sorry for the way I used the github links, but Discourse is so clever that directly providing a link leads to this:

1 Like

thanks!

Oh yes, I also needed it for upnp support , indeed is in there :

Changed in 5f80a6b85000f6c1c0dc84cf995a33cbc2a53a8f

Very useful indeed. Right now I’d prefer to keep it simple (with no need to create / execute script) … I’ll make a gist and link to it! Wait for it…

done.

It’s very good already.

To not discourage those who already have Raspberry Pi 1 B and 1B+, I think it should be pointed out that running nud on R-pi 1 does work, although R-pi 2 is faster, especially when there are more than 1 million shares (100+ outputs).

The SD card should have more than 4GB or there will be shortage in disk space… Buying a faster SD card helps to shorten start up time.

Compiling is not necessary if official binary is available.

The steps can be scary to someone who is new to R-pi. I think providing a pre-installed R-pi image for downloading will be really convenient.

1 Like

Alrighty, I already found that line in the guide - that’s why my config line (sudo ln -s /usr/lib/libminiupnpc.so.5 /usr/lib/libminiupnpc.so.10) looks so shiny :wink: It’s a link to that line in the documentation on github.
Only I wasn’t sure whether that was necessary due to some buggy installation on my side…

Great, but https://gist.github.com/desrever-nu/6e18d037251edeaeb4d6#file-unlock-nud-sh-L2
should have “ppcoin” replaced with “NuShares” :wink:

I’m not sure how long it will take to free some time for an installation following that ingenious guide. Maybe I don’t have the time, before other users test it. It looks very well and I bet it’s close to what one needs to know.

As we are talking about scripts - I have another one that backups my ppc wallet monthly (by crontab). It can be used for comfortable backups beyond the monthly backup. As I backup the whole “~/.ppcoin” folder regularly, I found it convenient to put all right there.
I adjusted it to be used for backing up the NSR wallet:

[backup script]
echo '#!/bin/bash
nud backupwallet ~/.nu/walletS.dat.$(date +%F)' >> ~/.nu/backup-nsr-wallet
chmod +x ~/.nu/backup-nsr-wallet
[/backup script]

[add backup script to crontab]
crontab -e
#append line to have a monthly backup at the first day of the month, 22:00:
0 22 1 * * ~/.nu/backup-nsr-wallet
[/add backup script to crontab]

This is highly optional, but as you lose all information about the points of time at which you minted successfully, you need to make backups of your wallet to restore not only the keys, but the details about transactions from a backup wallet.
I don’t know why the time stamps of blocks (there are time stamps, right?) are not used to translate that into a date and time, but…
To just have the keys backed up this might not be necessary as the minted blocks use the address of the UTXO that minted the block, right?
Anyway - all this belongs in the “advanced” or “highly optional section” of the guide…
Maybe someone is happy about that. Integrating it into the base guide would complicate things.

I tried nud on RaPi1; the RAM is almost too small to compile it… and using swap during the compiling doesn’t speed the process up :wink:

8 GB or even 16 GB shouldn’t be way more expensive than 4 GB. I’d recommend class 10 speed as it’s already as fast as the RaPi can read form the card reader.

That would be awesome! The compiling is the hardest part. And if you have a RaPi1 it really takes for ages.

+1 something like NuBox (made by peerchemist?) would be awesome!

Ha. You can already install pre-compiled nud in a peerbox with one command. Not working w/o a hitch, though.

88de084

I agree, we said earlier that there won’t be an official binary on the download page, or it will require proper testing and maintenance. However, no one stops us to link to an independent build from the tutorial, providing a proper disclaimer is shown.

Can we get a permalink to a community-maintaned nud-pi ? I’ll add the link to the tutorial … A torrent maybe?

5ba37c5

tnx, fixed it

Very good, let’s also collect advanced best practices for future revisions!