Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create SC for Decentralized lists #139

Open
damip opened this issue Oct 15, 2024 · 4 comments
Open

Create SC for Decentralized lists #139

damip opened this issue Oct 15, 2024 · 4 comments

Comments

@damip
Copy link
Member

damip commented Oct 15, 2024

A simple decentralized list tool

A simple decentralized tool to make lists.

Smart contract

Datastore layout

In the datastore we simply have one entry per entry of the list list_name:

["dlist"][len(list_name)][list_name][key] -> [value]  // note that len(list_name) is a constant-size integer that prevents key collisions when we have list names of various lengths

Smart contract interface:

read_item(list: Vec<u8>, key: Vec<u8>) -> Vec<u8>
    reads the value of an item, fails if does not exist

item_exists(list: Vec<u8>, key: Vec<u8>) -> bool
    checks if an item exists

remove_item(list: Vec<u8>, key: Vec<u8>)
    owner only
    removes an item, fails if does not exist

insert_item(list: Vec<u8>, key: Vec<u8>, value: Vec<u8>)
    owner only
    overwrites if exists

Web interface

A simple two-step interface:

  • step 1: the list name is taken from a URL parameter https://zzzzzzzzz.zzzzz/yyy/?list=xxxxx and displayed in the frontend. The user is asked to enter a key
    • if key exists in the datastore at ["dlist"][len(list_name)][list_name][key] (do not use the item_exists function, directly read the datastore):
      • step 2:
        • Display that the key is in the list
        • Show the associated value in a multiline textarea and allow the user to update it
        • Display a Remove from list button to remove the item
    • if the key is not in the list
      • step 2:
        • Display the key.
        • Allow the user to enter a value in a multiline textarea. Max len = 10 megabytes when encoded to utf8
        • Have a "Insert to list" button to insert the new value in the list
@SlnPons SlnPons changed the title Decentralized lists Create SC for Decentralized lists Oct 30, 2024
@pivilartisant
Copy link
Collaborator

@damip i believe there is a need to add a feature here that will allow users to remove an indexed item.

Use case would be: I (the users) have an indexed website, after deleting this indexed website I do not want it indexed in this list any more (we retrieve the indexed website in the uploader front end for example)

Wdyt ? does the current implementation satisfy this need ?

@damip
Copy link
Member Author

damip commented Dec 18, 2024

@damip i believe there is a need to add a feature here that will allow users to remove an indexed item.

Use case would be: I (the users) have an indexed website, after deleting this indexed website I do not want it indexed in this list any more (we retrieve the indexed website in the uploader front end for example)

Wdyt ? does the current implementation satisfy this need ?

In this spec, only the owner of that list can add or remove (see spec) so this question does not apply

@damip
Copy link
Member Author

damip commented Dec 19, 2024

This proposal is about a generic "list" contract that allows its owner to keep a curated list of arbitrary stuff. It could be useful for example to have curated lists of deweb providers, proposed website blacklists and so on...

For actual decentralized website listing/indexing, instead we are using: https://github.com/massalabs/DeWeb/tree/main/deweb-index which automatically indexes sites based on a call to the "update" function. If we allow users to completely delete a website (delete all the datastore entries including the DEWEB_VERSION of the website), a simple call to the update() function of that indexer will remove the website from the index.

Note that the deweb index is meant to evolve into a fully features website listing and search engine according to https://forum.massa.community/t/decentralized-search-engine-for-the-decentralized-web/

@ethsman

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants