Easy FIX for running a Massa node with a Dynamic ip

If you are reading this, you are probably running a Massa node from home and you do not have a static ip. In this case any router restart would change the ip and you end up in losing your rolls and important score points.

Manage your Massa node with SystemD – MassAdopted.com

Here we go
Install HttpHeaders extension for Chrome

Getting the Discord authorization key and the ID of the private chat with MassaBot

Will be using Chrome browser for the purpose of this tutorial.

Visit https://discord.com/app login to your discord account in your browser and open the private chat with MassaBot. You should be getting something like bellow.

Open HttpHeaders located on the right top

Click on “Live”

Now go to Discord tab where you have your private chat with MassaBot and send an “info” command.

Go back to your HttpHeaders tab, select “Discord” on “Filter by tabs”. Look for a Request that looks similar to the one in the picture bellow and save the private chat ID link, the one that looks like:


Click on the “REQ” header which will give you additional info on the right column, including your Authorization key. Save it as we need it in the next step, private chat ID also.

Now that we have our Discord authorization key and private chat ID lets move to the next step.

See also  All Masstronauts and Masscots list
Connect to your server with Putty (root access)

Modify the code bellow with your Authorization key and private channel ID that you saved at the begining, also if you have IPV6 ip, modify the line

cur=$(dig -4 +short ANY @resolver1.opendns.com myip.opendns.com)


cur=$(dig -6 +short ANY @resolver1.opendns.com myip.opendns.com)

prev=$(cat workingip.txt)
while true; do
cur=$(dig -4 +short ANY @resolver1.opendns.com myip.opendns.com)
if [ "$prev" != "$cur" ]; then
echo "$cur"
rm massa/massa-node/config/config.toml
echo -e "[network]\nroutable_ip = \""$cur"\"" >> massa/massa-node/config/config.toml
rm workingip.txt
echo -e "$cur" >> workingip.txt
sudo systemctl restart massad
curl -v \
-H "Authorization: OTQxMDIxMTA4ODA1NzA5OTA0.GH6_u_.iKfOG3wTr1TuXBR_Vrjrz0qoeOVHjUu9VTPFfE" \
-H "Content-Type: application/json" \
-d "{\"content\":\"$cur\"}" \
exit 0
echo "$cur"
exit 0



 Type sudo cat > /root/getip and hit enter. Copy/Paste your modified code above and hit Ctrl+D to save the file

Create a Systemd Service and timer so our script will execute once a few minutes to check if the ip was changed

While still with Putty connection opened, go ahead and do the bellow command, Copy/Paste all at once in Putty to create the “get_ip.service” file:

printf "[Unit]
Description=A job to test the systemd scheduler
ExecStart=bash /root/getip
WantedBy=default.target" > /etc/systemd/system/get_ip.service

Now for the “get_ip.timer” file do the same with the code bellow:

printf "[Unit]
Description=Get Ip for Massa
RefuseManualStart=no  # Allow manual starts
RefuseManualStop=no   # Allow manual stops
#File describing job to execute
WantedBy=timers.target" > /etc/systemd/system/get_ip.timer

We have created our Systemd files that will run our script every 4 minutes to check for the ip change. Lets go ahead and enable the service. Still on Putty, give the commands bellow one by one:

sudo systemctl daemon-reload

sudo systemctl enable get_ip.service

sudo systemctl enable get_ip.timer

sudo systemctl start get_ip.timer

Now to check if the timer service is active:

See also  New announcement from Massa Labs regarding TestNet 14.7

sudo systemctl status get_ip.timer

You should see a count-down on-going untill the service will be executed again.

Voila !!! You are done, wasn’t that hard.

1 comment
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
Last week's Hot Altcoin events

Last week’s Hot Altcoin events

Next Post

Presenting Masstronauts Series: Interview with Benoit@Dockyr

Disclaimer : This website does not invite anyone to invest in the projects we are talking about. This is simple information about crypto projects that we find interesting.
Related Posts