Questions about apps requiring external servers

I’ve been bouncing ideas around for a while on how to leverage the Safe Network for an app I’m working on. Currently I’m in the brainstorming phase, so nothing concrete yet. The app will target mobile users and will require some server side processing power to handle the data writen by the app. After drawing this up, I had some questions about how this would all work in practice:

The main idea here is that a user would write the private data themselves to the Safe Network. The app would look at this data and write out meta data about it, things like:

  1. The XOR address of the object created

  2. Where in the public data space should this be posted

  3. Optionally, a user name

  4. Optionally, keywords to enable searching for this object

  5. Other information depending on what you’re doing

The user would write the metadata and the XOR path would be written to the ‘Temp Data’ public sequence object.

In the physical world, a server would poll this sequence object and read in the meta data. It would do the necessary processing of the data and make sure that the requested write to the ‘Site Data’ is valid. If all is good, it will write the metadata XOR to the site data in the proper location along with any data that it generated along the way.

Now that the data is written, any user app can go access this data.

Reasons for this topology:

  1. Users are in total control of their data and the servers have no idea who is writing what. If a user wants to delete their stuff, they can and the XOR will no longer point to anything.

  2. The gatekeeper servers would be used to prevent bad writes to the site data structure. The app would render client side based on the data, so it is very important that the data structure be consistent. Opening up this space publicly would open the door for malicious writes that could cause client apps to react unexpectedly or worse, break entirely.

  3. The Site Data would be ‘private’. The main reason for this would be for moderation. The data is owned by the person who created it, so it would never go away, but the links to it could be removed if the content was deemed ‘illegal’. I’m all for free speech, but having servers linked to a company in the physical world means you have to play by the rules regarding ‘illegal’ speech. Once compute capability is available on network, this becomes a different story…

  4. Another reason for the Site Data being private is to allow ad injection. The app reads chunks of data and renders it client side. By injecting ads into the data structure it enables a generic means of advertising that isn’t linked to a user profile. Instead the ads are injected based on surrounding content (based on metadata). The ad revenue would be used not only for company profit, but also for repaying users for uploaded content. The idea here being after data is successfully written to the Site Data, Safe Network Tokens would be repaid to the user.

  5. The servers themselves would also act as Safe Network nodes. This not only generates revenue from farming, but also improves performance for the app and for the Safe Network as a whole.

  6. Even after compute capability is added to Safe Network, the servers could act as a baseline compute facility. My guess is that, in the beginning at least, compute on privately owned servers will be faster and cheaper than running computation on Safe Network itself. These servers could look at the going rate for computation and make a decision (based on their current load) whether it would be more economical to run locally or on the Safe Network. This would set a kind of price ceiling for what is an acceptable rate to process on the Safe Network while also having the capability to scale instantly if the servers were overwhelmed with requests. Over time as prices stabilize, the servers could be phased out. That will be a very good day :slight_smile:

With all that said, I had some general questions about this approach:

  1. Is it possible for a server to read in metadata from the Temp Data sequence based on an event instead of polling?

  2. For the Safe Network itself, would it make sense to have an ability to have some kind of gate keeper script for writes to a particular data structure? In practice I could see this as being a script that is located at the top of the data structure that the elders of that section run to verify that this particular write should be allowed. I realize this opens up all sorts of potential issues since a malicious user could write very compute intensive code that could bring down the section. I don’t think we need a general purpose language for this, just a simplified set of commands that determine whether the write request violates a small set of rules. I’m still thinking about how this would work, but this would eliminate a big reason for having an external gatekeeper server in the first place.

And my final question is, does this topology make sense? Is there a better way? How would you all solve this set of problems?

4 Likes

It’s been a couple days and no responses yet. I dont think I’ve ever seen a post so quiet around here :grinning: Any ideas/feedback from the software developer crowd?

1 Like

I think the issue is huge posts and it’s not clear up front what the purpose of the app and design are. I know I sometimes am guilty of not much time to dig into other folks designs. I would say polling the network seems wrong (I imagine constant Get requests).

For this you should look at our policy types (check Seq / List or Lseq type)

I am not sure about the problem you are trying to solve (sorry man).

1 Like

Thanks for the feedback. I tend to write down everything on my mind and it becomes over complicated. Too many thoughts, too little filtering :crazy_face: I will go read up on the policy types again.

This all boils down to this: Until SafeNetwork can do computing itself, applications with server side compute requirements will somehow need to communicate their requests to a server somewhere. In the picture the client app writes a small file and the server watches for it, does processing, and writes the result back to the network. Is there a better way to communicate this request through the Safe Network without polling a path? Or is there an event that is triggered by writing to a particular object? Messaging on the network I think would be the way to go for this. Is this feature planned to be available for MVP?

2 Likes

This is where with CRDTs we can off load to the clients on many occasions. This may be what you are looking for?

2 Likes

Possibly. I haven’t dug deep into CRDT’s yet, seemed like async black magic. I’ll read up on this more as well.

This particular application will target mostly mobile users. A small request may require a significant amount of computation before the result can be written back into a form that other users can fetch. So while a phone could do the computation, users won’t be happy about the resources used and battery life consumed.

3 Likes

This would be an issue with offloading to clients, but there may be options? You could have your client speak to your computer to do the ops, as long as the client uploads a signed update then you are fine. Not though too much about client hand-off but certainly doable as only you need to trust the offloaded device.

3 Likes

Ah, that’s a good idea. So the app could do the crunching client side as a last resort, but it could offload to your own desktop/laptop. I think that could work. Let think on this some more. Thanks for the ideas!

3 Likes