I’ve been pondering how to do searches of data on SAFE network, both within an application (eg a SAFE website) and more generally.
It occurs to me that vaults can be paid to help out and that this would benefit everyone:
- network saves resources
- vaults earn Safecoin for searching public data
- apps can search large amounts of data very fast
Here’s the scenario, which I’m sure is not new to the team - it seems inconceivable I’ve thought of this before them - if its any good that is
For Public Data Only
An App wants to search blog posts for a keyword. It sends a special GET request for every blog document to be searched. The request includes both a Safecoin payment (minted transaction?) and the keyword(s) for the search.
Each vault holding a chunk will receive the special GET, but instead of just supplying the data, it first scans it to see if it matches (or could match) the requested search. If it does not, it responds NO-MATCH (without sending the chunk). If not, it responds MATCH (and sends the chunk).
Once the close group looking after the chunk has decided by voting if the GET is valid, and if the chunk matches or does not match, it chooses one of the correctly responding vaults to have a search-farming attempt for he supplied Safecoin. If it succeeds, the Safecoin is delivered to its wallet. I’m not sure how this can be achieved, but I’m assuming it can
The App only receives data back if it matches or might match. So if it was searching 1,000 documents, and only one matches, all it gets back is the matching document. This will be very much faster for the App, and so worth paying for.
How this is priced is something to be discussed. Maybe the network maintains a price and each App is configured to use this to determine whether or not to pay for a special search-GET or not.