In this tutorial you will get a basic introduction to how to set up a Morphic Service for the Hive collective network.
Use Morphic Services to setup p2p communication between your network resources like IoT devices, web browser clients or any other type of entity you want to connect to the Hive. Morphic Services can also use links to access other Morphic Services and add more intelligence to the path of enlightenment for each unique network resource.
While you creating your Morphic Service to the Hive others will do the same. For each service that is added to the Hive the Hive becomes more intelligent as a whole. In the Micropage section you can describe your service for the public so other developers can find your service and link to your data structure and use your intelligence for their own local network resources.
The Hive will eventually become a Hive Mind where any device and equipment can get connect and get intelligence from the collective. The ultimate goal is to secure the human mankind to stay on their path into reaching unifying enlightenment!
Choose “Morphic Services” from the left menu and click the button “Add Service”.
You will now have an example service template appear. Before we make changes to the template example let’s test the communication first by hitting the “Save” button in the end. That’s it.
You have now created your first Morphic service for a Hive network and are ready to replace the example text with your own custom service description.
The service Schema is one of the most important parts of creating a Morphic service. Here you will need to define the data structure you want to distribute in the network. All elements need to be in between the start and stop Real Time Web element “<RTW>” and </RTW>.
In the example above only one element has been defined as “<TXT></TXT>”. You can of course add more if you like. Only the key element name is allowed and no value.
The element is what objects and clients in the network can send and receive from your service.
1. Open a terminal window and type in following curl command:
curl -k https://mydomain.cioty.com/example -H "Synx-Cat: 1" -d "TOKEN=x&OBJECTID=0&TXT=Hello World"
2. Replace the X with your own unique token. The token can be found in the account section. Just cut and paste the token and replace the x.
3. The objectID can be set to 0 for now and the element TXT can be set to “Hello World”
4. When you press enter this will simulate a HTTPS POST request against the Hive and send “Hello world” message to your Morphic Service using mydomain.cioty.com/example service data schema.
5. Notis that the header is specified to “Synx-Cat: 1”. This is used when sending data to the hive collective.
6. Open a second terminal window and type following command:
curl -k https://mydomain.cioty.com/example -H "Synx-Cat: 4" -d "TOKEN=x&OBJECTID=0"
7. Replace the X with your own unique token. Notis that the header is specified to “Synx-Cat: 4”. This is used when receiving data from the collective.
8. When communicating against a morphic service the token is always present and is telling the system that this connection is owned by you (token). The objectID is the id of your ghost that you connect to. Since we have not allocated a ghost yet we just use the primary ghost for the service which is ghost 0.
9. To test the communication first enter the curl command for receiving message (“Synx-Cat: 4”). Notis that the cursor is waiting for data. In the other terminal window now send a message (Synx-Cat: 1). This message “ Hello World” should now appear in the receiver window.
Congratulations! You have successfully sent and received a message against the Hive Collective!
Get the help you need and meet like minded people at our developer community Nornir Academy.
If you want to develop machine intelligence for a Hive collective network (like on CiotY Makerspace) there are some rules of thumb you will need to know about. In this article I will try to break it down into some general concepts so that you can better understand how to create and plan your Hive project.
Creating Morphic Service is not difficult. It just requires a different mindset. Once you are done with some demos you will start to understand how to create more advanced services. In fact, you may use the same approach to create any IT system. This can be a chat program, dynamic webpage, logistic system or advanced robotic system. There are no limitations to which type of system you can create.
Beside from different network architecture design there are some practical differences when developing Morphic Service contra Microservice. One of the main concepts in a HIVE network is the use of Ghost. Ghost is a kind of digital twin but operates in multiple layers in the network stack. Normally a digital twin may virtually represent a physical entity in a connected network. When the entity connects to the network a lookup is made against some database or system to find the virtual representation of the entity. The virtual entity then acts as a proxy for the physical entity. In Hive similar things happen where the Ghost acts as a proxy for the physical entity. The difference is that the Ghost does not exist in a database or in any system before it is created. In effect, the Ghost can represent any type of device, application or system in the past, present and future. When you create a Morphic service today, any future device may be able to use your service when the time comes.