Skip to main content

Debug API

Now that you have created your Swarm wallet and your Bee node has begun to participate in the global Swarm network, we can use the Debug API to take a closer look at what's happening with your node.

The Debug API provides a privileged environment where you are able to interact with your Bee node to get more information about the status of your node.

danger

Never expose your Debug API to the public Internet, make sure to use a firewall or bind to localhost, as we have in the example below.

To use the Debug API we must first configure Bee to enable it, as it is disabled by default.

bee start --debug-api-enable --debug-api-addr=localhost:1635

Checking Connectivity

First, let's check how many nodes we are currently connected to.

curl -s http://localhost:1635/peers | jq '.peers | length'
23

Great! We can see that we are currently connected and sharing data with 23 other nodes!

info

Here we are using the jq command line utility to count the amount of objects in the peers array in the JSON response we have received from our Debug API, learn more about how to install and use jq here.

Inspect Network Topology

We can gain even more insight into how your Bee is becoming a part of the global network using the topology endpoint.

curl -X GET http://localhost:1635/topology | jq

In this example, our node is beginning to form a healthy network. We hope to see our node adding and connecting to nodes in as many bins as possible. Learn more about proximity order bins and how your Bee node becomes part of the ordered p2p network in

The Book of Swarm .
{
"baseAddr": "793cdae71d51b0ffc09fecd1c5b063560150cf2e1d55058bad4a659be5894ab1",
"population": 159,
"connected": 19,
"timestamp": "2020-08-27T19:24:16.451187+01:00",
"nnLowWatermark": 2,
"depth": 4,
"bins": {
"bin_0": {
"population": 77,
"connected": 4,
"...": "..."
},
"bin_1": {
"population": 37,
"connected": 4,
}
}
}
}

Find out more about what you can do with the Debug API here.