I’m running a publicly reachable Zebra 7.0.0 node.
So far, I’ve confirmed the following:
-
Inbound peers can connect to my node.
-
These peers announce new blocks through inventory messages (inv).
-
My node downloads and successfully verifies those blocks.
However, I haven’t been able to confirm whether my node is actually serving block data to other peers.
I’d like to know how to verify that:
-
Another peer sends a getdata request to my node.
-
My Zebra node responds by sending the actual block data (block message).
-
The requesting peer successfully receives that block.
I’ve checked the Docker logs, but they only show INFO-level messages. I also checked TCP traffic counters, but they don’t tell me what type of data is being transmitted.
What is the recommended way to verify outbound block serving in Zebra?
Is there a specific log filter, diagnostic command, RPC method, or network monitoring tool that can confirm this?
I’d also like to know whether Zebra serves full block data to inbound peers by default, or if any additional configuration is required.
Thanks!
2 Likes
I think the best check is Prometheus metrics, not logs. Set [metrics] endpoint_addr = “0.0.0.0:9999”, then curl localhost:9999/metrics. The official Docker image already includes the prometheus feature.
1 Like
The Prometheus route tokidoki mentioned will answer this. These are the metrics to look at.
- zebra_net_in_requests{command=“BlocksByHash”} counts block getdata requests from peers.
- zcash_net_out_messages{command=“block”} counts block messages your node has sent.
Here’s a quick example presuming your metrics are configured to run on port 8888:
curl -s localhost:9999/metrics | grep -E 'zebra_net_in_requests\{command="BlocksByHash"\}|zcash_net_out_messages\{command="block"\}'
Thanks for contributing to the Zcash P2P network!
I managed to get Prometheus running in Docker. Your advice was incredibly helpful. Thank you so much!
1 Like
Yes, I’ve been trying out various commands to inspect the logs. I’ve also tried the commands you provided. At this point, I’m starting to think there may not be anyone in Korea running a publicly accessible node. Perhaps even the Korean ambassadors aren’t running nodes themselves.
Thanks @tokidoki and @emersonian, the Prometheus metrics are exactly the right tool here. Adding a couple of details from the Zebra side to round this out.
Serving blocks is on by default. No extra configuration is needed. Once your node has started up, any peer that sends a getdata for blocks gets the blocks you have in your local state (or a notfound for ones you don’t). Zebra does cap each response (up to 16 blocks, and it stops adding blocks once about 1 MB has been sent), so a large getdata may only be partly answered.
Enabling metrics. The official Docker image is built with the prometheus feature, so you only need to set an endpoint, either in zebrad.toml:
[metrics]
endpoint_addr = "0.0.0.0:9999"
or with the environment variable ZEBRA_METRICS__ENDPOINT_ADDR=0.0.0.0:9999 in Docker. If you build from source, compile with --features prometheus. To clear up the port question above: there’s no fixed port. Use whatever port you set in endpoint_addr (9999 is the convention in our Docker docs). If you run curl from the host rather than inside the container, publish that port, but there’s no need to expose it to the internet.
What to look for.
curl -s localhost:9999/metrics | grep -F \
-e 'zebra_net_in_requests{command="BlocksByHash"}' \
-e 'zcash_net_out_messages{command="block"}'
zebra_net_in_requests{command="BlocksByHash"} counts block requests your node received from peers.
zcash_net_out_messages{command="block"} counts block messages your node actually sent.
If both counters keep going up over time, your node is serving block data. It’s normal for the first to be higher than the second, because some requests are for blocks you don’t have yet or are cut off by the response limits.
Thanks for running a public node!
1 Like
Your explanation has helped me understand how the node system works much better. I’ll try the commands you shared. Thank you again for taking the time to explain everything in such detail.
2 Likes