Skip to main content

Test connections between nodes

Experimental feature

Please note that this is an experimental feature. Experimental features have full functionality (i.e. they work), but the user experience is a little complex and will change in the next releases.

You can get a list of all connected nodes by sending an HTTP request. The following command will returns a list of all nodes that the node with IP address 192.168.2.10 is connected to:

Invoke-WebRequest 'http://192.168.2.10:4457/_internal/swarm/state' | Select-Object -Expand Content

The above command returns a JSON object. Unfortunately, there is no easy way to make JSON objects readable in PowerShell, we advise that you copy it into Visual Studio Code and format it there.

This is an example answer:

{
"Ok": {
"store": {
"count": 0,
"size": 0
},
"swarm": {
"listen_addrs": ["/ip4/10.0.0.5/tcp/4001", "/ip4/127.0.0.1/tcp/4001"],
"peer_id": "12D3KooWFTwsQQwYYDKX4JingSJqEhs2QEa7gkfzBst6mniSYBRD",
"peers": {
"12D3KooWFBDaJZD3CPadPy9fMr29mbKtMsy4U1w5s7TnEvHQGRi9": {
"addresses": {
"/ip4/127.0.0.1/tcp/4001": {
"provenance": "Swarm",
"state": "Initial"
},
"/ip4/172.26.0.1/tcp/4001": {
"provenance": "Swarm",
"state": "Initial"
}
},
"connection_state": "Disconnected"
},
"QmUD1mA3Y8qSQB34HmgSNcxDss72UHW2kzQy7RdVstN2hH": {
"addresses": {
"/ip4/3.125.108.42/tcp/4001": {
"provenance": "Bootstrap",
"state": {
"Connected": {
"since": 5
}
}
}
},
"connection_state": "Connected"
}
}
}
}
}

In the peers object, you get a list of all peers that the node has been connected to. For each of the peers, you get important debugging information:

  • adresses: lists all network interfaces of the peer, and over which interface they are connected
  • provenenance: shows how the connection was established, e.g. if it is a bootstrap node or was discovered through mDNS
  • since: shows the duration of the connection in seconds
  • connection_state: shows whether the nodes are currently connected