SUPERALGOS GOVERNANCE

Luis’ Team Proof of Work, November 2021

First iteration P2P Network + Ground work for Sharing Signals.

Luis Fernando Molina
Superalgos | Algorithmic Trading

--

Photo by JJ Ying on Unsplash

P2P Network

I finished a first iteration of the networking plumbing of the p2p Network, Desktop Client App and Desktop Web App, and all that is at the develop branch for whoever would like to take a look at.

New nodes to define entities able to connect to the p2p network.

Step by Step:

1. Users define at their User Profile which apps / nodes they are going to run. See my own profile as an example.

2. Each app (like the desktop app, mobile app, server app, platform app, or network node) needs to run with a network identity, which I called Signing Account, because they will sign their messages with a private key, so that even if the message travels through many hops, the recipient can verify the signature.

3. This means that your profile identity has its own private key that will not need to be stored at any of these devices. Only the private key belonging to the signing account for a certain device need to be there, which is a good thing, since the Profile account will be holding tokens most of the time.

4. In my profile I have set up 3 Network Nodes and 3 Desktop Apps (for the purpose of testing if all this works). At the config of each of these guys, there is the host name and ip address of where they will be running.

5. Since this definition is at my User Profile, that in turn is a plugin, that means that all these definitions will end up at the Superalgos repository and they will be part of the codebase so to speak. That also means that at runtime, any of these nodes, will have the information of where to find all the other nodes of the network and to which User Profile they belong to, because it will be at their own hard drives ! 😁

6. Because we will be generating private keys and we don’t want anyone to be saving those as part of their profile, in this case, these nodes under the User Profile are going to be signed from the Profile Constructor node.

7. Sensitive information like the private keys of these signing accounts are stored a Secrets.json file under the My-Secrets folder, so that they can be read by all these applications once launched.

This is the location of the Secrets file. Of course it is git ignored.

8. All these apps / nodes source code are at the Superalgos repo, that means that you can run any of them in a similar way you run the platform:

node platform
node desktop
node network

For any particular installation you have, you can define at the Environment.js file, which identity (signing account) each of this apps will use in this machine.

9. While we are testing this, I created 3 launch scripts for starting 3 different network nodes at the same time and 3 scripts for launching 3 different Desktop Apps at the same time.

10. The procedure to make this test is to open 4 instances of VS Code from here. At each one run it while standing at each of the files shown at (9).

(1) These settings at the Environment file defines to how many peers each network node will connect to, and from how many peer your network node will accept connections from. Also from how many Client App. (2) Also, you can define to how many Network Nodes your Desktop Client App will connect to. It might be more than one at the same time.

12. When you run the 3 network nodes, you will see that each one, connects itself to the other 2.

13. When you run each of the Desktop Apps you will see that each one connects to one of the 3 network nodes running. (current setting are that each node receives only 1 client connection max)

13. For each Desktop App we ran, we will find a new tab opened at the browser, with the current status of the Desktop Web App, showing some data. The only possible action / event we can generate today is to FOLLOW some body else.

14. If we click on FOLLOW the following things will happen:

A. Desktop Web App 3 will send a message to Desktop Client App 3, which in turn will send a message with that event to the Network Node 3.

B. Network Node 3 will update it’s social graph recording the following of my profile to the profile I followed.

C. Then it will send the event to all the Network Nodes that it is connected to: 1 and 2.

C. After that is will send the message to all the Clients that are connected to Network Node 3, which in this case is Desktop App 3, the same place where the message came from so we can ignore it.

D. The event gets then to Node 1 and 2. They will both apply the Follow at their own social graph and then send the event to the nodes they are connected to. After that to the Clients connected to them.

E. Node 1 and 2 will not sent the event to the same node they received from but they will send it to 3 that already know about it. 3 will ignore it because it already applied it. Eventually the recursive broadcasting between nodes reaches all connected nodes of the network.

F. When the event goes down from the Nodes to the Desktop Client App 1 and 2, the event is also applied to a smaller social graph with only relevant profiles to the one running the desktop app (this is not implemented yet). After that each one of these 2 desktop app clients will send the event to the Web App 1 and 2. This web app for the purpose of this test, just show the message received at a pop up window.

Ground Work for Sharing Signals

Some work has been done to enable the sharing of signals from current Trading Bots. I will give you a glimpse on how that will work.

At trading Systems we will be able to define which events produce signals.
In a similar way, which events consume signals.
There will be a link between a Trading Bot with Social Trading Bot (the last one is the one that can be followed at Social Trading Apps). There will also be a link between a Task, and a Task Server App (the last one is a P2P Network Client that can access the P2P Network to send or receive signals)
Task Server Apps will also require Token Power to connect to the network and get priority over the available bandwidth to send or receive signals.

As you can see, all the pieces are slowly appearing and fitting together into the big-picture puzzle. There is no tangible thing to test regarding this at the moment, so this will be probably the focus of December POW report. For now it is just a glimpse into what is coming. That’s all for now. For more details you can check my PRs from November 2021 at https://github.com/Superalgos/Superalgos/pulls?q=is%3Apr+author%3ALuis-Fernando-Molina+merged%3A%3E2021-11-01+

--

--