The TezEdge P2P Explorer — revealing the messages of the Tezos P2P network Juraj Selep Follow Mar 31 · 4 min read

When faced with a bug, performance or security issue in the peer to peer (P2P) network, it is useful to look under the hood and examine the messages that are being sent between individual nodes.

For this purpose, we have developed the TezEdge P2P Explorer, a tool for everyone who wants to record and view the contents of the messages that are sent through the Tezos P2P network. Bugs arising from bootstrapping and synchronization can be easily tracked down and examined, saving time for developers who want to fix such issues.

A blockchain is a decentralized ledger that uses a P2P network to distribute data between its nodes. In the Tezos blockchain, a node communicates with other nodes through a P2P network, establishing encrypted communication and distributing information about the blockchain state. For a deeper understanding of the message flow within the Tezos P2P network, please see our past article that describes how nodes interact with each other.

The P2P network features various types of messages that perform a range of actions. The P2P Explorer reveals the contents of these messages. These messages range from those that initiate communication with other peers to information about the state of the blockchain. An overview of these messages is provided below:

Message Types

Bootstrap — Message sent by a local peer after establishing connection. Nothing noteworthy is contained in it. Advertise — Usually a response (from remote peers) to the Bootstrap message, containing a list of other known peers. Swap Request, Swap Ack — Messages for swapping mechanism, remote peer asks local node to swap its place with some other node, if local node is OK with that it will send Ack and propose new peer to swap with. Disconnect — End of connection. Generic Message — These messages are defined in other parts than the P2P layer (like distributed storage or protocol itself). Shell messages for P2P gossip:

5.1 (Get) Current Branch — Request/Response to get information about the current running branch.

5.2 Deactivate — Deactivation of a specific branch or chain.

5.3 (Get) Current head — Request/Response to get information about current head block.

5.4 Get Block headers, Block header — Request block headers for specific blocks, get responses containing block header information.

5.5 Get Operations, Operation — Request operations with specific hashes, receive them one by one.

5.6 (Get) Protocol — Similar to 5.1 but requests protocol information

5.7 Get Operation Hashes For Blocks, Operation Hashes For Block — Request operation hashes for specific blocks, and get them one by one.

5.8 Get Operations For Blocks, Operations For Block — Request all operations for specific blocks, get all operations for a block at a time

How It works

When a message arrives on the P2P layer, it is decrypted, deserialized and saved. Each time the node is restarted, the messages are deleted in order to save storage space. At the moment we are showcasing an working alpha version of the P2P Explorer. We plan on expanding functionalities and improving the user interface (UI) in the future.

The P2P Explorer can display all incoming and outgoing messages between peers, message types and their contents.

Message details

In this screen, there is a list of messages. We can click on a particular message and a preview of its contents will be displayed.

Peer filter

In order to filter out the messages for a particular peer, you may either click on an address from a list of all peers, or click on a peer from a list of all network messages.

Peer search bar

You can also filter out messages by typing the peer address into the search bar.

How to run the P2P Explorer

1. Download and install Docker and Docker Compose

Open shell and type this code into the command line and then press Enter:

docker-compose pull docker-compose up

2. Open the TezEdge Explorer in your browser

You can view the status of the node in your browser by entering this address into your browser’s URL bar:

http://localhost:8080

We thank you for your attention and hope you enjoyed today’s article. As of today, we are also launching the TezEdge documentation, where you can read primarily about the TezEdge project, as well as information on blockchain and Tezos. We will be expanding the documentation as we progress in the development of the TezEdge node. Feedback, comments or questions are always welcome and you may contact me via the form on the TezEdge website or send me an email.