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
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
:Smart contract interface:
Web interface
A simple two-step interface:
https://zzzzzzzzz.zzzzz/yyy/?list=xxxxx
and displayed in the frontend. The user is asked to enter a key["dlist"][len(list_name)][list_name][key]
(do not use the item_exists function, directly read the datastore):value
in a multiline textarea and allow the user to update itRemove from list
button to remove the itemvalue
in a multiline textarea. Max len = 10 megabytes when encoded to utf8