Skip to main content

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.
WIP

KVService will provide API for signature chain export. Anyone can verify each changes, and restore the final data status.

Brief of design

  • Every user has N + 1 namespaces:

  • Query data: public, only need to specify avatar.

  • Write data: A patch followed RFC 7396 standard.

    A glimpse of RFC7396
    // Assume data is:
    {
    "a": {
    "b": [2, 3, 4, "test"]
    },
    "c": "Hello"
    }
    // If this patch is submitted:
    { "a": { "b": null, "new_key": true }, "c": "KVService" }
    // Then data will become:
    {
    "a": {
    "new_key": true
    },
    "c": "KVService"
    }
    // Notice: nedted 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

sequenceDiagram autonumber User ->> Application : (Start a modification request) Application ->> KVService : POST /v1/kv/payload KVService -->> Application : sign_payload Application ->> User : avatar.eth_avatarlSign(sign_payload) User -->> Application : Signature Sp Application ->> KVService : POST /v1/kv note right of Application : With uuid and created_at from ③ KVService -->> Application : Success Application -->> User : Success

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, my app is 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 string, consider Arweave.