HOW TO INSTALL A LTO NODE ON A RASPBERRY PI 2
To prepare this document I based myself on the documentation that created @iicc and hawky, and I want to thank you for the help received, it is a pleasure to meet people like that.
My knowledge of Linux and raspberry are very limited, practically null, so I had to find out how to install things from the console, but finally looking for information you find out everything and learn by the way.
Initially I focused on running the node following the same steps as if it were any other platform.
Using Docker and later Docker-compose as explained here https://www.dumbitcoin.com/como-montar-un-nodo-de-lto-y-recibir-recompensas/
I first installed “Raspbian Stretch Lite”, but later tried “Raspbian Stretch with desktop and recommended software”, “Raspbian Stretch with desktop” and “Ubuntu Mate”.
These installations always gave me errors, I could install Docker without problems but when I installed Docker-Compose depending on the version of the Python libraries, if I used the last ones, later when I installed Docker-compose I got an error.
I managed to solve this problem by installing older Python libraries, and I managed to install Docker-Compose and edit the configuration of my Node.
Executing the “docker-compose up” command with the corresponding configuration returned an error.
Here I saw that I needed help because I did not know how to continue or what was happening, that was when I decided to ask in the group LTO Network Tech of Telegram.
First I talked to Ivan, I told him what I wanted to do and he told me that hawky was preparing a guide and it would be published shortly indicating how to solve it.
Talking with hawky he told me that he had managed to run it on a Raspberry 3 and explained that the problem is because of the ARM architecture, and that some dependencies of the node included in a jar file are not compiled for ARM, so the solution is to patch the files that are not compatible in that jar file.
Here is the original document with all the explanation:
Next I describe the steps that I have followed to install from the beginning everything, together with the information of the guide of hawky and the help of iicc to carry it out resolving the doubts that were appearing to me.
What we need:
- Raspberry Pi 2
- Memory SD 64Gb
- HDMI monitor and HDMI cable (although I use a VGA-HDMI converter and a VGA monitor)
- Image Raspbian stretch Lite
- LTO Main Wallet
- LTO NODE Wallet.
- Have ports 6868 and 6869 open on the router.
- Format the MicroSD (I have used the SD Formatter program in Windows https://www.sdcard.org/downloads/formatter/ )
- We write the downloaded image in microsd(I used win32 diskimager https://sourceforge.net/projects/win32diskimager/)
- Introduce the sd with the image in the raspberry we turn it on and start.
I start from this process assuming that you already have a main LTO wallet with your LTO and you have created a secondary wallet (for the NODE) with LTOs in leasing from primary.
If not you can create them here:
We logged in using RPI2’s default credentials
- User: pi
- Password: raspberry
The first thing is to change this password by default, this is VERY important, so we write in the console:
Select the first option and change the password.
We install git because we will need it to clone the LTO Network repository and download the necessary jar file.
We write in the console:
sudo apt-get install git
Install java, write in the console:
sudo apt-get install oracle-java8-jdk
Let’s go with matter:
First we clone the repository
git clone https://github.com/legalthings/docker-public-node
and go to the created folder
Although the node is available as a JAR (Java File), you cannot automatically start this version of the node on a Raspberry PI,.
Now I explain how to modify the corresponding JAR file to allow it to work. Here are the steps described in hawky’s guide.
Although the node is available as a JAR (Java ARchive), which is usually considered a platform-independent deployment…telegra.ph
The problem, one of the dependencies of the node, the LevelDB implementation, is not compiled for the architecture of the ARM processor that runs the Raspberry.
The idea is to patch incompatible parts of the JAR file and replace them with compatible parts of the raspberry’s ARM architecture.
We have copied the file lto-public-all.jar when cloning the GIT and from the new folder created we will execute the commands.
Let’s install a independent version of LevelDB by typing into the console:
sudo apt install libleveldb-java libleveldb-api-java
Unzip the JAR file
jar -xvf lto-public-all.jar
Once decompressed (it takes a while), we delete the JAR file, to prevent it from being included later when we compress it again in the new JAR file.
rm -f lto-public-all.jar
We have to protect the file MANIFEST.MF, which is like a configuration file of the JAR file, to be able to restore it later and keep all the information about the file, classes to be executed, etc…
Therefore, we copy the file META-INF/MANIFEST.MF to the current directory:
cp META-INF/MANIFEST.MF .
Delete all traces of the LevelDB version that gave us problems:
rm -rf ‘find . -name *leveldb*’
Extract the independent version of LevelDB we created in Step 5, and copy two necessary files.
And then we need to compress those files again:
jar -xvf leveldb-api.jar
jar -xvf leveldb.jar
We clean up and delete those two files, so they won’t be included in the new node file we’ll create later.
rm -f *.jar
Now we need to recover the MANIFEST.MF file that we secured in step 6:
cp MANIFEST.MF META-INF/
In order to pack the contents of our current directory into a new file that will be our new ARM-compatible JAR file we write:
jar -cfm lto-public-all-arm.jar META-INF/MANIFEST.MF *
This process may take a while. When finished, the new JAR file created lto-public-all-arm.jar can be copied to any directory from which you want to start the node.
STEP 9 NODE CONFIGURATION:
Let’s edit the file lto-mainnet.conf with our data.
We’ll use the Nano editor, it’s very easy to use and it’s handled with the arrows.
To save, you have to press “control+o” and enter and to exit “control+x”
We have to modify several fields (# is to comment the line).
# Password to protect wallet file
password = “PUT_A_PASSWORD_LONG_AND_DIFFICULTY_PASSWORD”
We introduce a password that will encrypt our seed in the disk.
The seed field must also be decommented and put your seed the one that was shown when creating the wallet for the LTO NODE but in base58 not in plain text.
I used this converter https://www.browserling.com/tools/base58-encode
There we paste the seed each word separated by a space and it codifies it to us to base 58.
That’s what we have to copy.
Example with changed data:
And further down on the block that says “rest api.”
enable = yes
The rest of things is not necessary to modify it to make it work, you could name the node but it is optional, and you would have to remove the # from the front if you do…
Finally, save “control+o” and enter and exit “control+x”
STEP 10 START THE NODE:
The next command will start the node:
java -jar lto-public-all-arm.jar lto-mainnet.conf
And if all goes well it will show a screen similar to this one
And he’ll start looking for peers. This process takes about 17 hours. And after this finally you will have mounted a LTO Node using a Raspberry Pi 2 for it.