Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Hyperswarm DHT setup

Checking your network for P2Pness

First, it's a good idea to check if your network has good "holepunching" support. We can check that using the hyperdht cli

npm i -g @hyperswarm/cli
hyperswarm-discovery --ping

The above command will print a series of pongs from the network. If your pong object contains the same ip and port across responses, your network is P2P friendly and you should run a DHT node.

(Note to self, we should integrate that in the hyperdht cli :D)

Running a node

Running a dht node is as simple as installing the DHT cli.

npm i -g @hyperswarm/dht

Then to run the node do:

hyperswarm-dht

That's it! You probably run to run the above command as a daemon so it get's decent uptime.

The DHT node will store IPs and ports from other users through an udp interface. The network is quite redundant so no worries if you shutdown your node or if it crashes :) It also shouldn't consume too much bandwidth as it's just simple small udp messages that exchanged when peers do discovery.

Stay in touch

We might upgrade the command set in the future so it's a good idea to hang in #dat on freenode so we can share updates and you can give us feedback.

Leaving a comment here that you are running a node for a bit will help us in this early phase of the rollout also so we can stay in touch :)

@pfrazee

This comment has been minimized.

Copy link

pfrazee commented Jul 16, 2019

👋 I'm running one

@RangerMauve

This comment has been minimized.

Copy link

RangerMauve commented Jul 16, 2019

Running on gateway.mauve.moe

@rschulman

This comment has been minimized.

Copy link

rschulman commented Jul 16, 2019

I'm running one!

@Frando

This comment has been minimized.

Copy link

Frando commented Jul 16, 2019

i'm running one too

@martinheidegger

This comment has been minimized.

Copy link

martinheidegger commented Jul 16, 2019

What ports need to be opened?

@mafintosh

This comment has been minimized.

Copy link
Owner Author

mafintosh commented Jul 16, 2019

@martinheidegger if the ping command above returns a stable port, none - otherwise let me know and i'll make the script print the port it bound to

@martinheidegger

This comment has been minimized.

Copy link

martinheidegger commented Jul 16, 2019

Another note: Didn't manage to get it to work on node12 without error: node 10 works better.

@DeltaF1

This comment has been minimized.

Copy link

DeltaF1 commented Jul 16, 2019

I'm running one for the next few hours, should it survive changing networks/IPs?

@DeltaF1

This comment has been minimized.

Copy link

DeltaF1 commented Jul 17, 2019

Update: It survived changing from wifi -> 4G -> a new wifi network.

@mafintosh

This comment has been minimized.

Copy link
Owner Author

mafintosh commented Jul 17, 2019

@DeltaF1 that’s awesome, mind sharing your node id jere?

@DeltaF1

This comment has been minimized.

Copy link

DeltaF1 commented Jul 17, 2019

node id: 7c312f3958183e19381662c76d76428aca473b66cbb08e701382619972b73434

I'll try and leave this running on my phone for the next couple days

@DeltaF1

This comment has been minimized.

Copy link

DeltaF1 commented Jul 22, 2019

Is there any way to re-launch a node with a specific node id? (assuming that you need a consistent list of node ids for testing)

@mafintosh

This comment has been minimized.

Copy link
Owner Author

mafintosh commented Jul 23, 2019

@DeltaF1 no, but just update your ID here :) i'm mostly just tracking for fun to see how the dht grows

@bcomnes

This comment has been minimized.

Copy link

bcomnes commented Jul 27, 2019

node id: ae3d7d7f0012323924075b3950b5466c54c7ed78dfcc06b17097eed417a52816
dht node fully bootstrapped

Running in NYC

@bcomnes

This comment has been minimized.

Copy link

bcomnes commented Jul 27, 2019

Sorry f6e18194de12bb53633d6069b5b8902df6f01181945f83a3ce4d362d6887343f. I guess the node id changes.

@mafintosh

This comment has been minimized.

Copy link
Owner Author

mafintosh commented Feb 18, 2020

Added some updated logic so would be nice if anyone here still running a node could reinstall and restart it

@martinheidegger

This comment has been minimized.

Copy link

martinheidegger commented Feb 18, 2020

26f76f77676c2400357bb12465a3ae41d86001d772532c0c1d88b368e612325d

@bcomnes

This comment has been minimized.

Copy link

bcomnes commented Feb 20, 2020

New node running at node id: 260bc18966282f7be31f403ded90ad8e922db98821154f8ae5d11a6118804097 at http://dht.12core.net.

We might be killing the node from time to it should be stable at that URL though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.