Skip to content

Instantly share code, notes, and snippets.

@pinheadmz
Last active August 10, 2022 09:28
Show Gist options
  • Save pinheadmz/a3e5ded7a4f0413e948a6a257c375891 to your computer and use it in GitHub Desktop.
Save pinheadmz/a3e5ded7a4f0413e948a6a257c375891 to your computer and use it in GitHub Desktop.

Upgrade nodejs to v12.x.x

$ sudo npm install -g n
$ sudo n lts

Install hsd

$ sudo apt install libunbound-dev
$ git clone https://github.com/handshake-org/hsd
$ cd hsd
$ npm i

Get IP

$ ifconfig
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.1.5  netmask 255.255.255.0  broadcast 10.0.1.255
        ...

Run hsd: note that I am using the IP obtained from ifconfig as the rs-host setting

$ sudo hsd --rs-host=10.0.1.5 --rs-port=53

BONUS: enable as service for auto-restart!

edit file with this command:

$ sudo nano /lib/systemd/system/hsd.service

these are the contents:

[Unit]
Description=hsd
After=network.target

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
Environment="HSD_NETWORK=main"
Environment="HSD_LOG_LEVEL=debug"
Environment="HSD_NO_WALLET=true"
Environment="HSD_RS_PORT"
Environment="HSD_RS_HOST=0.0.0.0"
Environment="HSD_PREFIX=/home/pi/.hsd"
ExecStart=/usr/local/bin/node /home/pi/hsd/bin/hsd

[Install]
WantedBy=multi-user.target

execute:

$ sudo systemctl daemon-reload
$ sudo systemctl enable hsd.service
$ sudo systemctl start hsd

The service file is just a nice touch to enable auto-restart. For static IP, I followed this guide: https://pimylifeup.com/raspberry-pi-static-ip-address/ and just set my static IP to 10.0.1.5 which was the address my router DHCP gave me anyway

Then I set my iphone settings to the screenshot below under my home wifi network:

and OSX network settings:

@Falci
Copy link

Falci commented Oct 9, 2020

Tip: add the 10.0.1.5 in the router as default DNS for any device (DHCP section).

@faddat
Copy link

faddat commented Nov 15, 2020

<3

Thanks!

@magicstone1412
Copy link

magicstone1412 commented Jan 1, 2021

Thank you for your guide.

It's more convenient to set up a light node combine with Wireguard.

  • You don't need to set up manually static IP
  • Use your own Handshake DNS resolver anywhere
  • Turn DNS resolver faster: only ON or OFF
  • Quick DNS value modification in Wireguard setting files
  • Lighter than a full node

At this time, I can resolve Handshake name on my phone by putting the DNS IP in the Wireguard configuration file, but I am not sure why it does not work on my computer.

Edit: I can access Handshake name site on computer after reset about:config on firefox to default settings based on this guide

@unclehowell
Copy link

unclehowell commented Mar 15, 2021

Imagine this had a localhost webapp/ gui and was embedded into a raspberry pi net-installer - my current project should give you some idea of what I'm suggesting - https://github.com/unclehowell/datro/tree/net-installer/hbnb/arm ?

@pinheadmz
Copy link
Author

@unclehowell cool! Let me know if you need any help, there's a HNS developer channel here: https://t.me/hns_tech

@unclehowell
Copy link

Thanks. Will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment