In order for maximum latency I would like to identify the nodes closest to my location. Is there a way I cant find nearby nodes on a map and create a list of them based on distance?

  • 1
    maximum latency? Really? Most people would prefer to decrease it.
    – bortzmeyer
    Commented Jun 8, 2016 at 13:24
  • Latency Commented Jan 5, 2022 at 23:32

3 Answers 3


I would:

  1. set up a supernode to get as many peers as possible, this question gives you the command
  2. list peers with a script like below once you have enough peers
  3. Use BatchGeo to display the ips accessible in the json you got in point 2, otherwise you can look at that answer that will enable you to link ips to lat/lng

    #!/bin/sh geth attach << EOF function getPeers() { console.log(JSON.stringify(admin.peers, null, "")) }; getPeers() EOF


First, distance as "physical length" doesn't mean anything on network. You should mind the time needed for the message to go to the peer and come back. This is ping. if you use the Go client implementation, the p2p part already includes the distance calculation value to select peers. So current Go implementation already does what you aim to do. You can have a look at table.go to start and follow nodesByDistance.

  • The OP said "closest", he never said he was talking about physical (IRL) distance. The Go source code you mention uses words like "closest" and "distance", too.
    – bortzmeyer
    Commented Jun 8, 2016 at 13:40
  • -1 after reading the source code you mention. I find no trace of a measurement by time (the OP asked for latency), "distance" and "closest" in this source code appears to refer to the closeness of the IDs (which is common in Kademlia).
    – bortzmeyer
    Commented Jun 8, 2016 at 13:42
  • OP asked to "find nearby nodes on a map". I don't see why it wouldn't be a physical distance related map. This is the only map that makes sense in this question context. Commented Jun 8, 2016 at 13:45
  • In node discovery you'll find that when a node is found, it's "ping" distance is calculated and it's put into the tree in a way to reflect this. So hash distances reveals nodes distances, so searching the closest IDs is the same as searching the closest nodes. Commented Jun 8, 2016 at 13:51

I am not sure it is a good idea to select the time-closest (minimum latency) peers. Yes, this is what DNS resolvers (to take just an example) do but, in a peer-to-peer network, this would be a security risk: you could take over a node just by having several rogue peers time-close from him. Using peers anywhere in the network protects against targeted attacks.

On my own geth node, I can see that my peers are spread all around the physical globe.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.