Network Project

UPDATE ON THE NETWORK & SOCIAL TRADING PROJECTS

Today I finished 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.

  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.

  1. 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…

  2. 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 ! :grin:

  1. 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 added from the Profile Constructor node.

  2. After you add all the app / nodes you want, you will find at the Profile Contructor Config, all the private keys and other details. As of today, you need to copy this config, and paste into a new file under the My-Secrets folder, so that they can be read by all these applications once launched.

image

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

  1. 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.

  1. 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.

  1. The procedure to make this test is to open 6 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.

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

  1. 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)

  1. 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.

  1. 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.

2 Likes