How to setup a Full Node with Tor/i2p

Started by qvqc, Jun 20, 2021, 05:04 PM

Previous topic - Next topic

qvqc

## WHY DO THIS?

[imgMETA]http://forum.wownero.com/custom_avatar/f4f218e9d13381b753e4c65b82f1cb435dafa001.gif[/img]

  * **friends be jelly**
  * **node is available** regardless of home firewall
  * **help the network** with out revealing public ip
  * **be cheap**, no need to pay for VPS hosting



Installing Linux

For ease, this guide is based on ubuntu. To get started download and install your favorite flavor, xubuntu is easy to use.  

**If you dont have an extra machine, use virtualization to run linux on your windows PC.**

#### you will need
  * USB drive for install media
  * 4GB+ RAM recommended (lower can work too)
  * 10GB+ Harddrive (~2GB for Linux, ~4GB for wownero)

If you need help installing, check this

Installing Wownerod

#### Downloading Wownerod

Go to wownero.org and download the latest "Command Line" wallet for Linux 64-bit. Wait for the download to complete.

You can verify the archive by checking the sha256sum provided.

Extract the wownerod to /home/username/Downloads. Wait for the extraction to complete.

Navigate to the folder that contains wownerod and open a terminal inside this folder.

then copy the extracted contents to /usr/local/bin.

`sudo cp wownero* /usr/local/bin/.`

you can test that its installed correctly with this command (it should return yes)
`(ls /usr/local/bin/wownerod && echo yes) || echo no`  

#### Lets add our config file

Open an editor with
`sudo nano /etc/wownerod.conf`

Copy and Paste the following into /etc/wownerod.conf

    check-updates=disabled
    confirm-external-bind=1
    data-dir=/var/lib/wownero
    log-file=/var/log/wownero/wownerod.log
    log-level=0
    no-igd=1
    p2p-bind-port=34567
    p2p-use-ipv6=1
    public-node=1
    restricted-rpc=1
    rpc-bind-ip=0.0.0.0
    rpc-bind-port=34568
   

##### use CTRL+X to save/exit

#### Install the wownero service

Now lets get the wownero service setup

Open an editor with
`sudo nano /etc/systemd/system/wownerod.service`

Copy and Paste the following into /etc/systemd/system/wownerod.service

    [Unit]
    Description=Wownero Full Node
    After=network-online.target
    Wants=network-online.target

    [Service]
    User=wownero
    Group=wownero
    Environment="MONERO_RANDOMX_UMASK=1"
    StateDirectory=wownero
    LogsDirectory=wownero
    Type=simple
    ExecStart=/usr/local/bin/wownerod --config-file /etc/wownerod.conf --non-interactive
    Restart=always

    [Install]
    WantedBy=multi-user.target

##### Setup Directories and User

    sudo addgroup --system wownero
    sudo adduser --system wownero --home /var/lib/wownero
    sudo mkdir /var/log/wownero
    sudo chown wownero:wownero /var/log/wownero

##### CTRL+X to save/exit

Now lets load the service file into systemd

Reload the service files to include wownerod
`sudo systemctl daemon-reload`

To enable wownerod on every reboot
`sudo systemctl enable wownerod.service`

Start wownerod service
`sudo systemctl start wownerod.service`

To check the status of wownerod
`sudo systemctl status wownerod.service`

Wownerod should be up and syncing!


Setting up Tor/i2p

install tor and i2p
`sudo apt install i2pd tor`

#### Create Tor hidden service

creating a hidden service is easy, just add a couple lines to the torrc config file

open the editor with
`sudo nano /etc/tor/torrc`

add the following lines at the bottom

    HiddenServiceDir /var/lib/tor/wownero/
    HiddenServicePort 34568 127.0.0.1:34568
    HiddenServicePort 34566 127.0.0.1:34566

##### CTRL+X to save/exit

restart tor
`sudo /etc/init.d/tor restart`

you can find out your Onion hostname by running
`sudo cat /var/lib/tor/wownero/hostname`

you will see output that looks like (same onion for RPC and P2P, use for P2P url below)

> lrux6na6p47ulqf2owt3wknfiwwbz7iksio5bz3ebdvou47lmfjdmoid.onion

this is your onion! you can now use wowlet or wownero-wallet-cli to access wownerod over Tor


#### Create i2p http tunnel (hidden service)

Creating an i2p service is similar to tor

open the editor with
`sudo nano /etc/i2pd/tunnels.conf`

add the following lines at the bottom of the file

```
[wownero-rpc]
type = http
host = 127.0.0.1
port = 34568
keys = wownero-rpc.dat
[wownero-p2p]
type = server
host = 127.0.0.1
port = 34565
keys = wownero-p2p.dat
```

##### CTRL+X to save/exit

restart i2pd
`sudo /etc/init.d/i2pd restart`

you can find out your p2p b32.i2p hostname by running curl
`curl http://127.0.0.1:7070/?page=i2p_tunnels 2>&1 | grep -Eo "[a-zA-Z0-9./?=_%:-]*" | grep "34565"`

you will see output that looks like (add this to wownerod.conf below)
> mshhr3stejy6dyhdjclaamezae2c75av6eazhru3s3hoccimya5a.b32.i2p:34565

you can find out your rpc b32.i2p hostname by running curl
`curl http://127.0.0.1:7070/?page=i2p_tunnels 2>&1 | grep -Eo "[a-zA-Z0-9./?=_%:-]*" | grep "34568"`

you will see output that looks like (use this with a client wallet)
> lvy4crit5gcodniovffckwcwcto3gjgr3enwu4tsrki4x2ocq6ra.b32.i2p:34568

you can now use this wownero-wallet-cli to access wownerod over i2p

## Add incoming p2p to wownerod.conf
In order to let other servers on the Tor and i2p network communicate with your server on p2p you have to add a few lines to the bottom of your wownerod.conf

open your editor
`sudo nano /etc/wownerod.conf`

add the following to the bottom, replace YOUR_I2P_ADDRESS and YOUR_ONION_ADDRESS with the p2p addresses you recieved above

    tx-proxy=tor,127.0.0.1:9050,23
    tx-proxy=i2p,127.0.0.1:4447,23
    anonymous-inbound=YOUR_I2P_ADDRESS:34565,127.0.0.1:34565,64
    anonymous-inbound=YOUR_ONION_ADDRESS:34566,127.0.0.1:34566,64

restart wownero
`sudo systemctl restart wownerod.service`

## How to use the services
* RPC - clients(use with wowlet, wownero-wallet-cli) wallets connect to wownerod
* P2P - wownerod talks to other wownerod
* RPC port - 34568 (use with wowlet, wownero-wallet-cli)
* P2P port - 34567 (use with wownerod)
* Tor-RPC port - 34568 (use with wowlet, wownero-wallet-cli)
* i2p-RPC port - 34568 (use with wowlet, wownero-wallet-cli)
* Tor-P2P port - 34566 (use with wownerod)
* i2p-P2P port - 34565 (use with wownerod)

on Tor only one hiddenservice url is needed as it can handle multiple ports per service.  see this in the torrc created, multiple ports under one hiddenservicedir(one key) directory.  i2p works differently where it needs a separate tunnel for every port served.  see in the i2p tunnels.conf that we set a service for port 34565 and 34568 each with a separate key file

with anonymous-inbound and tx-proxy it sets wownerod to prefer relaying transactions over Tor-p2p and i2p-p2p.  you can use add-exclusive-node= in the wownerod in order to sync over i2p-p2p or Tor-p2p

post all three urls.  p2p urls are for system admins who want to add as a peer to wownerod. rpc urls are for clients who need to use the wallet

## Share your nodes!
Add your nodes to https://monero.fail/?crypto=wownero and post them here, thanks for helping the network!



## Setup your first node and thats not enough?  
Use the ansible playbooks which automate these steps for multiple nodes!

## Big thanks to @wow4reedom for polishing this up!! :fire::pineapple:

wowario

`iy6ry6uudpzvbd72zsipepukp6nsazjdu72n52vg3isfnxqn342flzad.onion:34568`

qvqc

    rmysl337zlocxrpgib372ea2ov2q2n3wdzwjj2zb5odeykkjvvna.b32.i2p:34568
    ycq4yo6nrc4gmwbyd77v7p6nuuleg22n3e4balvugpmj63hhoz5q.b32.i2p:34568
    j7wrndaonjrvx67ud7jzdytr2lvu7s2tmhm5rnoazodp6tprvhla.b32.i2p:34568


wow4reedom

Quote from: "qvqc, post:1, topic:588"You can verify the archive by checking the sha256sum provided.

For Linux newbies (myself included), how do I perform a checksum check in Ubuntu?

orklemerkle

In a terminal, run `sha256sum path/to/file`. Under most desktop environments, you can drag a file into the terminal window to insert its path.

wow4reedom

Quote from: "qvqc, post:1, topic:588"sudo systemctl status wownerod.service

I can't seem to start the wownero service. Here is the "Failed" message I get after running the above command:

    ● wownerod.service - Wownero Full Node
         Loaded: loaded (/etc/systemd/system/wownerod.service; enabled; vendor preset: enabled)
         Active: failed (Result: exit-code) since Sun 2021-07-18 03:10:29 AEST; 1min 30s ago
        Process: 2938 ExecStart=/usr/local/bin/wownerod --config-file /etc/wownerod.conf --non-interactive (code=exited, status=217/USER)
       Main PID: 2938 (code=exited, status=217/USER)

    Jul 18 03:10:29 LARK01 systemd[1]: wownerod.service: Scheduled restart job, restart counter is at 5.
    Jul 18 03:10:29 LARK01 systemd[1]: Stopped Wownero Full Node.
    Jul 18 03:10:29 LARK01 systemd[1]: wownerod.service: Start request repeated too quickly.
    Jul 18 03:10:29 LARK01 systemd[1]: wownerod.service: Failed with result 'exit-code'.
    Jul 18 03:10:29 LARK01 systemd[1]: Failed to start Wownero Full Node.

But here's what's strange, if I start the node manually from the terminal:
`./wownerod`  
followed by
`status`
the Node starts, syncs and I get the following:

`Height: 335709/335709 (100.0%) on mainnet, not mining, net hash 45.40 MH/s, v19, 11(out)+0(in) connections, uptime 0d 0h 0m 23s`


I'm a newbie to Linux and I setup a new machine running Ubuntu LTS 20.04.2 and I've followed this guide line-by-line.
 
I'm unsure if there is a step missing in the guide, but I can's seem to make sense of the above error hence my machine won't start my full node.
 
Any thoughts?

qvqc

thanks for catching,

try this:

    sudo addgroup --system wownero
    sudo adduser --system wownero --home /var/lib/wownero
    sudo mkdir /var/log/wownero
    sudo chown wownero:wownero /var/log/wownero
    sudo systemctl start wownerod

wow4reedom

Thanks @qvqc,  that fixed it!  

    ● wownerod.service - Wownero Full Node
         Loaded: loaded (/etc/systemd/system/wownerod.service; enabled; vendor pres>
         Active: active (running) since Sun 2021-07-18 18:26:14 AEST; 22s ago
 
I shall continue with the rest of the steps.
 
Thanks for putting this step-by-step guide together, very much appreciated!

wow4reedom

Quote from: "qvqc, post:1, topic:588"`sudo cat /var/lib/tor/wownero/hostname`

This is the error message I get when running this command:
`cat: /var/lib/tor/wownero/hostname: No such file or directory`

The /var/lib/tor/wownero directory doesn't exist. Here's what I see:

    $ sudo ls -la /var/lib/tor/
    total 8876
    drwx--S---  3 debian-tor debian-tor    4096 Jul 18 19:14 .
    drwxr-xr-x 69 root       root          4096 Jul 18 18:25 ..
    -rw-------  1 debian-tor debian-tor   20472 Jul 18 05:29 cached-certs
    -rw-------  1 debian-tor debian-tor 2304840 Jul 18 18:54 cached-microdesc-consensus
    -rw-------  1 debian-tor debian-tor 6531415 Jul 18 05:37 cached-microdescs
    -rw-------  1 debian-tor debian-tor  206234 Jul 18 18:55 cached-microdescs.new
    drwx--S---  2 debian-tor debian-tor    4096 Jul 18 05:29 keys
    -rw-------  1 debian-tor debian-tor       0 Jul 18 19:10 lock
    -rw-------  1 debian-tor debian-tor    5540 Jul 18 19:14 state


Any ideas?  Thanks in advance.

wowario

Quote from: "qvqc, post:1, topic:588"#### Create Tor hidden service

creating a hidden service is easy, just add a couple lines to the torrc config file

open the editor with
`sudo nano /etc/torrc`

add the following lines at the bottom

```
HiddenServiceDir /var/lib/tor/wownero/
HiddenServicePort 34568 127.0.0.1:34568
HiddenServicePort 34566 127.0.0.1:34566
```

restart tor
`sudo /etc/init.d/tor restart`

did you do this^

wow4reedom

Quote from: "qvqc, post:1, topic:588"`sudo cat /var/lib/tor/wownero/hostname`

Yep I did that step and here is a snippet of my terminal ...

    $ sudo /etc/init.d/tor restart
    Restarting tor (via systemctl): tor.service.

    $ sudo systemctl status tor.service
    ● tor.service - Anonymizing overlay network for TCP (multi-instance-master)
         Loaded: loaded (/lib/systemd/system/tor.service; enabled; vendor preset: e>
         Active: active (exited) since Sun 2021-07-18 23:26:28 AEST; 9s ago
        Process: 2363 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
       Main PID: 2363 (code=exited, status=0/SUCCESS)

    Jul 18 23:26:28 L01 systemd[1]: Starting Anonymizing overlay network for TCP>
    Jul 18 23:26:28 L01 systemd[1]: Finished Anonymizing overlay network for TCP>

    $ sudo cat /var/lib/tor/wownero/hostname
    cat: /var/lib/tor/wownero/hostname: No such file or directory

The /wownero directory under /lib/tor/  does not exist.

Also, please note that when I carried out the step below:

Quote from: "qvqc, post:1, topic:588"open the editor with
`sudo nano /etc/torrc`

It creates an empty file, then pasted in the 3 lines and saved the file, hence the file /etc/torrc  did not exist in my /etc/ directory.  

However, after a little bit of digging around using the File Manager, I noticed there is a torrc file located under /etc/tor/ , should this be the file that needs the 3 lines added at the end?

wowario

yes, edit that torrc file. You should change the "HiddenServiceDir" location to `/etc/tor/wownero`, restart, and then do: `sudo cat /etc/tor/wownero/hostname`

wow4reedom

Thanks for all your help thus far @wowario and @qvqc. Unfortunately, I'm still having an issue with starting up my full node.

My node seems doesn't seem to startup via the systemctl. I can start it manually from the  /usr/local/bin/   directory. It runs and syncs, but when I check the status I get the following error:

    larkbox@LARK01:/usr/bin$ sudo systemctl status wownerod.service
    ● wownerod.service - Wownero Full Node
         Loaded: loaded (/etc/systemd/system/wownerod.service; enabled; vendor preset: enabled)
         Active: failed (Result: exit-code) since Mon 2021-07-19 04:05:16 AEST; 26s ago
        Process: 2647 ExecStart=/usr/local/bin/wownerod --config-file /etc/wownerod.conf --non-interactive (code=exited, status=1/FAILURE)
       Main PID: 2647 (code=exited, status=1/FAILURE)

    Jul 19 04:05:16 LARK01 systemd[1]: wownerod.service: Scheduled restart job, restart counter is at 5.
    Jul 19 04:05:16 LARK01 systemd[1]: Stopped Wownero Full Node.
    Jul 19 04:05:16 LARK01 systemd[1]: wownerod.service: Start request repeated too quickly.
    Jul 19 04:05:16 LARK01 systemd[1]: wownerod.service: Failed with result 'exit-code'.
    Jul 19 04:05:16 LARK01 systemd[1]: Failed to start Wownero Full Node.
 
When I reboot the PC, the node fails to start via the systemctl.
 
Sorry, I wish I was more technical, but I just can't seem to figure out what's going wrong. Any ideas?  

Thanks in advance.

qvqc

try posting the log

get the last hundred lines with:

    tail -n 100 /var/log/wownero/wownerod.log

no stress, u are close to having it all online.  thanks for testing