Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add realm r/demo/keystore (#958)
This realm implements the `avl.Tree` as a user-addressable key-store. I wanted to have this realm to possibly use `gno.land` as a database where writes may cost gnots but reads are free because they can be performed through `Render` (related discussion: #947). As a nice additional feature it provides a UI for the database (through `gno.land`). Data can be set/removed if the caller is the same as the owner of the key-store (i.e. only owner's have write-access). For example: ```bash # Set key,value for user at YOURKEY (write-protected) gnokey maketx call --pkgpath "gno.land/r/demo/keystore" \ --func "Set" --args "hello" --args "world" \ --gas-fee "1000000ugnot" --gas-wanted "8000000" \ --broadcast --chainid dev --remote localhost:26657 YOURKEY ``` ```bash # Remove key for user at YOURKEY (write-protected) gnokey maketx call --pkgpath "gno.land/r/demo/keystore" \ --func "Remove" --args "hello" \ --gas-fee "1000000ugnot" --gas-wanted "8000000" \ --broadcast --chainid dev --remote localhost:26657 YOURKEY ``` ```bash # Get key gnokey maketx call --pkgpath "gno.land/r/demo/keystore" \ --func "Get" --args "hello" \ --gas-fee "1000000ugnot" --gas-wanted "8000000" \ --broadcast --chainid dev --remote localhost:26657 YOURKEY ``` All data is public and accessible as read-only from any user, as well as from gno.land. The main page lists all the available databases by owner (`/r/demo/keystore`): ![image](https://github.com/gnolang/gno/assets/6550035/3e21827c-0a22-47eb-bf42-53f6ee005a7e) Clicking on a user will show all the keys in their key-store (`/r/demo/keystore:USER`): ![image](https://github.com/gnolang/gno/assets/6550035/7d4b3d58-20ad-47fc-8e41-095e111f5f30) And the key values are accessible as well (`r/demo/keystore:USER:get:KEY`) ![image](https://github.com/gnolang/gno/assets/6550035/888a8ddf-6044-42d4-aed6-ffc3989def35) ## Contributors Checklist - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [x] Added references to related issues and PRs - [x] Provided any useful hints for running manual tests - [x] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](../.benchmarks/README.md). ## Maintainers Checklist - [ ] Checked that the author followed the guidelines in `CONTRIBUTING.md` - [ ] Checked the conventional-commit (especially PR title and verb, presence of `BREAKING CHANGE:` in the body) - [ ] Ensured that this PR is not a significant change or confirmed that the review/consideration process was appropriate for the change --------- Co-authored-by: Manfred Touron <[email protected]>
- Loading branch information