Introduction
KVService is designed to save/read user data in a traceable and decentralized way.
Feature
Free data structure
KVService can store any valid JSON
object
data.
Verifiable records
KVService use the same design of ProofService's signature chain to ensure:
- Traceable: all changes are approved by user and cannot be falsified by third parties.
- Decentralized: The user has the full right to dispose the data.
KVService will provide API for signature chain export. Anyone can verify each changes, and restore the final data status.
Brief of design
Each user has
1 + N
namespaces:- Avatar itself has a namespace (
platform == "nextid" && identity == "0xAVATAR_PUBLIC_KEY"
)- There's no limitation that Avatar should be used in ProofService once.
- Each binding record (in ProofService) of each Avatar has a namespace.
- Value of
platform
andidentity
are the same as definition in ProofService.
- Value of
- Avatar itself has a namespace (
Query data: public, only need to specify
avatar
.Write data: A patch followed RFC 7396 standard.
A glimpse of RFC7396
// Assume current data is:
{
"a": {
"b": [2, 3, 4, "test"]
},
"c": "Hello"
}
// If this patch is submitted:
{ "a": { "b": null, "new_key": true }, "c": "KVService" }
// Then patched data will become:
{
"a": {
"new_key": true
},
"c": "KVService"
}
// Notice: nested modification of Array value is not supported.
// Replace the whole Array with new value instead.
Use case
- Web3 apps need to save user configurations
e.g. profile (name, avatar link, bio, etc.), NFT showcase (hide/show, order, etc.) or wallet address priority.
Workflow
Write data
APIs mentioned:
Query data
See GET /v1/kv.
Conventions
Each app should use their "package name" as their own namespace, to ensure other apps are not infected by your modification.
For example, I as a developer, identify my app as
io.mask.web3-profile-plugin
,Then I should make all my modification under
{ "io.mask.web3-profile-plugin": .... }
key.Theoretically, there is no size limitation for data. FairUse™️, please.
If you want to store data bigger than a string can handle, consider Arweave.