Network map API
Developers12.5.9+

Network map API

Read the network as a node sees it: peers and their kind, the mesh of nodes and apps with names, countries and direct links, and the WebSocket addresses for browser nodes.

These public routes describe the P2P network around a node. Use them for network maps, crawlers, dashboards and to find nodes a browser can reach. Nothing in them identifies a person: browsers, desktop apps and phones are listed under a random id and a name of three words, never their address.

RouteAnswer
GET /api/v1/networkCounts, protocol version, per-kind connections, service counters
GET /api/v1/network/peersThe connected peers (a JSON array)
GET /api/v1/network/meshThe map: nodes, apps and links reported by the nodes this node knows (cached 2 s)
GET /api/v1/network/wsnodesWebSocket P2P addresses a browser node can dial, and the library files
GET /api/v1/network/nodesConnected peers as addnode strings

Peer kinds #

Every peer has a kind, worked out from its user agent and service bits. It is a hint for display and counting, never a permission: anyone can send any user agent.

kindUser agent
full/lotusd:12.5.9(EB32.0)/, with NODE_NETWORK
thin/lotusd:12.5.9-thin(EB32.0)/
browser/lotusd:12.5.9-browser(lotus-node.js 0.3.0)/, or /lotus-node.js:0.3.0/ for an unstamped copy of the library
extension/lotusd:12.5.8-browser(lotus-node.js 0.2.0; extension 0.2.1)/: the Lotus RANK browser extension
desktop/lotus-desktop:12.5.9/
phone (12.5.9)/lotus-desktop:<v>(lotus-mobile <v>; ...)/ or /lotus-mobile:<v>/
otherAnything else

GET /api/v1/network counts them in connections_by_kind:

JSON
{"full":23,"thin":10,"desktop":1,"browser":1,"other":0,"extension":1,"phone":0}

A node before 12.5.9 reports a phone as desktop; one before 12.5.7 reports the extension as browser.

Peers #

Shell
curl -s https://givelotus.org/api/v1/network/peers | jq '.[] | {kind, subver, country, name}'

The answer is a plain array, one object per peer, with the fields of getpeerinfo and more (kind, height, ping_ms, zstd, encryption, ...). For a browser, extension, desktop or phone peer:

JSON
{"id":451,"addr":"anon:a4611da46758ec89","anon":true,"name":"ship-mixture-together",
 "mesh_id":"3fdc20e837c83a12","country":"FR","subver":"/lotusd:12.5.9-browser(lotus-node.js 0.3.0)/",
 "kind":"browser","protocol_version":70016,"inbound":true, ...}
FieldMeaning
anon, addrFor an app, addr is anon:<16 hex>: a value stable for the connection that reveals nothing. Full and thin nodes are listed with their address
name (12.5.9)The app's three-word name, when it gave one
mesh_idThe app's map id (16 hex digits), the key of its dot in the mesh
country (12.5.9)Two letters, worked out by this node from the address it sees. Nothing more precise (no region, city or operator)

An app that turned "Show this browser on the network map" off has no name and no country: it is only counted.

The mesh #

Shell
curl -s https://givelotus.org/api/v1/network/mesh | jq '.counts'
JSON
{"nodes":45,"reporters":28,"stale":0,"expired":0,"edges":411,"parent_nodes":241,"hidden":0,"named":4,
 "by_kind":{"full":28,"thin":10,"desktop":2,"browser":3,"other":0,"extension":2,"phone":0},"reports_stored":54}

Top level: self (this node's mesh id), share (all, public or off: what this node shares), time, nodes, edges, parent_nodes, parent_edges (the Bitcoin, Litecoin, eCash and Bitcoin Cash nodes the feeders talk to), counts, crawl, stats, rules. ?include_recent=1 adds entries that expired, marked expired.

Nodes #

FieldMeaning
keym<id>: a node that reported its links; a:<addr>: a listening node with no report; r:<reporter>:<addr>: a peer of one reporter that does not listen; t<id>: a browser, extension, desktop app or phone
kind, subver, heightAs for peers
name (12.5.9)Three BIP39 English words joined by -, for an app
country, asn, as_orgFor a public node address, from the node's GeoIP table. For an app, country only (12.5.9), and asn, as_org are absent
anontrue for an app: addr is then anon:<16 hex>
rolesintroducer, pool
mesh, public, fleet, reported, seen_by, last_seen, connected_viaHow the node is known
share, hidden, report_age_s, stale, via, seq, reports, first_seenFor a node that reported

Edges #

FieldMeaning
key, from, tofrom dialled to
since, ping_ms, age_s, last_seen, reported_by, encryptedThe connection
bytes, bytes_total{block, tx, pool, other: [from to, to from]}
direct, both_ends (12.5.9)A direct link between two apps, key t<a>~t<b>: webrtc (browser to browser, browser to desktop) or tcp (desktop to desktop); both_ends when both apps report it
claimed (12.5.9)A link only the app reports, to a node that does not list it

Nothing an app reports adds a dot: a link is drawn only between dots the nodes' own reports already have.

The name rule #

A name is exactly three words of the BIP39 English list, lower case ASCII, joined by single -, 26 bytes at most, for example brave-only-tunnel. Anything else is refused and never stored or shown, so free text never reaches the map. If you build an app that reports itself, draw names the same way; the list is the published BIP39 English word list.

WebSocket nodes for browsers #

Shell
curl -s https://givelotus.org/api/v1/network/wsnodes
JSON
{"enabled":true,"network":"mainnet","port":10605,
 "nodes":[{"url":"wss://nng-120.givelotus.org:10605/p2p","self":true}],
 "rtc":{"relay":false,"max_links":12,"stun":[],"stun_port":0},
 "lib":[{"path":"/lib/lotus-node.js","bytes":365297,"sha256":"f1fc9746...","integrity":"sha256-8fyXRuCE..."}, ...]}

nodes are ws:// or wss:// P2P endpoints (self: this node's own public ones); lib gives each library file with its SHA-256 and Subresource Integrity value, so a page can pin the code it loads. See Browser node library.

Privacy and limits #

  • An app's address is never in a route that needs no credentials. Only the operator of the node it is connected to sees it, with getpeerinfo and the RPC credentials.
  • A node in -sharetopology=public mode lists only public nodes; off shares nothing.
  • Self reports: one per app per 10 s, at most 8 nodes and 16 links per report; reports expire after 30 minutes without renewal (rules.expiry_s).
Source share/www/docs/api-network.md in the lotusd repository
Checked against doc/network-mesh.md src/api/network_handler.cpp src/netmesh.cpp src/meshname.h src/peerkind.h src/api/browser_node_handler.cpp src/api/geoip.h