Package Grin node for personal servers?

Running a public node is easy. This is how you do it.

Connect to you instance via SSH. Make sure you’re root.
Execute the next command to download and install the node binary:

wget https://github.com/mimblewimble/grin/releases/download/v5.1.2/grin-v5.1.2-linux-amd64.tar.gz &&  tar -C /usr/local/bin -xzf grin-v5.1.2-linux-amd64.tar.gz --strip-components=1 && rm grin-v5.1.2-linux-amd64.tar.gz

In the future, replace v5.1.2 but right now this is the latest stable release.

Start the node by running the next command: grin. You will see a screen with information, this means everything is working fine. Now, press Q to quit.

Open the config file like this:

nano .grin/main/grin-server.toml

Set run_tui to false.

To add a service, create a file like this here: /etc/systemd/system/grinpp.service

[Unit]
Description=Grin Node Service
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/grin
Restart=always
User=root
Group=root

[Install]
WantedBy=multi-user.target

Start the service by running:

systemctl enable grin.service && systemctl start grin.service && systemctl status grin.service

Turn off your instance’s firewall: systemctl stop firewalld && systemctl disable firewalld (you probably will need to confirm the firewall rules with your VPS provider).

Query the node like this:

curl -s --user grin:$(cat ~/.grin/main/.api_secret)  -d '{"id":"1","method":"get_status","params":{}}' -o - http://127.0.0.1:3413/v2/owner

You will see something like:

{
  "id": "1",
  "result": {
    "Ok": {
      "connections": 15,
      "protocol_version": 1000,
      "sync_status": "no_sync",
      "tip": {
        "height": 1713718,
        "last_block_pushed": "000356384cbf78d8f4c718b0b21e172d02a7c6ff3899f5505e273987fe88e1dd",
        "prev_block_to_last": "00012454aa5b74ff72a90c918921a4cfbd193c8bf5ad42c8b93174121bdadd0e",
        "total_difficulty": 1924411298264920
      },
      "user_agent": "MW/Grin 5.1.2"
    }
  }
}

Easy. An instance with 2GB of RAM should work.

3 Likes