Replies: 3 comments 6 replies
-
I have a particular use case, an offline dictionary I wrote that uses rocksdb and the data size ranges from 20MBs to 100MBs. I haven't decided the way of community collaboration, voting, curation mechanism. Now to decentralize this app. I would put the dictionaries onto Locutus network. And at least one dictionary is downloaded before any lookup. The data of one dictionary (~20MBs) would be spread over a few contracts. The contracts store indexed data. I would not duplicate the data, so Locutus would distribute the data and replace rocksdb here. When the user opens the app, the client/browser has to download entire state of the contracts (20MBs for each) because of random access. The data and any following updates are certainly copied. Would it be more efficient to have Locutus 'cloud functions' which accept requests from clients and returns the processed local contract state, which in this case is looking up a word. The cloud function only serves the local user. It processes the existing, verified state of one or more contracts. It doesn't introduce external trust. It doesn't change how contracts states are propagated or verified. |
Beta Was this translation helpful? Give feedback.
-
I don't think you need to verify the contract API exposed through the lambda function I propose, in and of itself. There will always be a measure of trust there, as there is for the full contract. For example, nothing prevents me from writing a contract with a built in back door that subverts the built in synch/verification process. That again is part of my reasoning for having the contract serve out metadata, so its possible to independently audit pre-built contracts. And the proposed reputation system plays into this as well, if someone posts malware they are only effecting their own data in the contract they expose. I fear currently that contracts are a bit opaque, and I don't really know who made them or what they contain. If we could sign them, then I would be able to say to my node, i know this guy, here's his keys and I accept his contracts. Similar to how Linux distributions handle package updates, the packages are distributed through multiple mirrors but I know the package I am downloading comes from a "trusted" source because its signed by someone I recognize. And if I want, I can go to the source and audit it. It could even be possible to build a lot of this data into the metadata at compile time (Git hash, build time, options passed to the compiler, version of compiler and libraries, etc, could be embedded inside the contract metadata.) We should also have a way of blacklisting contracts, so that if there are bad contracts out there, we can tag them and they will be rejected from my node (and hopefully others). The blacklist itself could and probably should be in another contract the node uses, so I can subscribe to various trusted blacklists, just like I subscribe to add blocking dns lists hosted by various people. I would also like it if contracts could call API functions in another contract, so they can use/consume that data for their own processing needs. For example, it f I had a contract that help authorized keys I could use that from another contract to validate the updates being made to my contract are properly signed by my known set of keys. |
Beta Was this translation helpful? Give feedback.
-
Glad you brought this up, it's an important question but I'm not sure the solution requires changes to the low-level contract API itself. I think what would solve this problem is a contract registry similar to Rust's https://crates.io/ or Java's Maven Central. This would be a database that links to the contract's source code, the wasm produced by that source code, and the hash of that wasm. The registry could also provide serialization schemas for the contract's state and other useful information. It would support looking up contracts by their hash. It could be available both on the web at https://freenet.org/contracts, and through Locutus. Verifying that the compiled contract produces the webassembly is the more difficult part of this solution. Therefore, it would be better to have a semi-centralized solution initially. This could be decentralized later through something similar to issue #245. Our |
Beta Was this translation helpful? Give feedback.
-
The smart contracts are great, but I think it would be good if we could add the following features to them:
For implementation, it just needs to be a webasm function that returns a json object with the appropriate data. Some fields should be mandatory, some optional and others custom to the contract.
Just like lambda, this could be a single function which is passed a JSON object that represents a rest call, such as: Method, Path, headers, Json parameter body (if any), and it returns a json object with a std web response code (200, 404, etc, and the response body which could be anything permissible in web (json, html, etc). This would also get the contracts parameters and state, so it could update the state, or read and respond with data (potentially processed) from the state.
This can be optional, and IF a webasm contract does not expose this function, any REST type calls to it return 404.
This would also make porting applications currently deployed on Lambda/serverless type systems much easier, because that interface could largely be preserved.
I have other ideas extending on from this base of ideas. But, I think adding these features would open up a world of possibilities within the smart contract and the system itself.
Example of the new contract functions I am proposing:
Beta Was this translation helpful? Give feedback.
All reactions