Hello World
We are going to send the message "Hello World"
from one node to another, i.e., peer-to-peer, using Python.
In this very introductory Hello_World Quick Start, we focus on you understanding how to run a script and to get a feeling for the effects of hyveOS. If you want a complete walkthrough from developing the asynchronous application code of the Hello_World example to correct dockerizing of the application and pushing it to your Container registry—before deploying it on the node and running—you can go through the tutorial (end-to-end) for Hello World.
Let’s start this very simple demonstration of peer-to-peer robot communication.
Preparation
Prepare two nodes Node 0
and Node 1
with Debian running on each.
Make sure that hyveOS is installed or updated to the latest version.
Make sure that Docker is installed on the nodes.
Pull the Docker image
We have already written the Hello_World code. We have dockerized it. You can find the built image hyveos-hello_world in P2P Industries’ GitHub Container Registry.
Pull it directly onto each node with this command:
What code will be running?
The whole code is seen in the collapsed block. It will run on each node independently. If you want to go through it step-by-step, check out the full Hello_World tutorial.
main.py
What does the main.py
do?
Node 0
will discover Node 1
and vice versa. Once they have found each other, they both subscribe to the topic = greetings
. Everyone subscribed to topic
will receive all the messages someone else sends into the topic—our networking and decentralization components take care of that.
Then, both send the message Hello from <own_node_id>
into the greetings
, and both nodes will receive a message of the form Hello from <other_node_id>
and print it.
Run Hello_World
Use our Command Line Interface to build the image and run it on each node.
Output
You should see an output of the following form on the nodes:
That’s it! You have successfully used hyveOS to send a message from Node 1
to Node 0
and vice versa.
© 2025 P2P Industries. This documentation is licensed under the MIT License.
Cookie Policy
Privacy Policy