Introducing z:kv - a key-value database on Zcash

Introducing z:kv - a key-value store entirely on Zcash

Alpha testers wanted! Try our first release: zec.rocks/zkv

z:kv stores a signed key-value log entirely on the Zcash blockchain. Readers reconstruct state by scanning the chain with a viewing key and replaying the signed memos.

It’s a new way to store information on Zcash. It’s great for public “small data” that benefits from decentralization: price oracles, feature flags, release announcements, and, well, anything!

The z:kv spec aims to be simple. It’s inspired by Redis, and is essentially “SET (key) (value)” in a signed Zcash memo. Signatures use a T-address key for wide support across Zcash libraries, but all data is stored shielded.

A testnet faucet is available within z:kv Browser to get you started quickly.

I sat on this idea for a long time, the hackathon at the Zcash Dev Summit last month in Rome inspired me to race through the initial implementation. (thank you to my awesome hackathon team members @azmr @nachog00 @philliptrudeau and of course the Zcash Foundation)

My goal is to reduce our wallets’ need to make HTTP requests to look up data like the current Zcash price, potentially exposing user IPs. Let’s Zcash all the things.

The plan is to keep iterating on this initial approach based on community feedback, and to migrate over to using UIVKs once librustzcash supports them, for z:kv database operators to not need to reveal outbound transactions.

I’m excited to hear your feedback!

github.com/zecrocks/zkv

Here’s an example database to import, illustrating what a wallet could have for its feature flags:

zkvtest1sv30yl48750pcp6vvp69gnyuwu3szkh7rd4c2fp697umvqctwushne0upxfz8mx6mutx5gcavuuwxgw72juzv2va3v0rxumgx36gjs0f66almkcwry2gga84w0z0tjdfp43vykckt2qu0nkz5c2c7efedkjddstdrsfzvrlgwtmnnw05v0rk5hng3dq3y3s22y6d5ct00u6g4vrranefw88jpjl9d7a2zfu3nwrxd2zsk4sff4dnx40s92nfx8e7fgr8uctwhgsjs3um4xg5a49ysx6cs3x9ar5vuum0kvdm07q68jnsag0xnaa43kmv7vkm9ek678dvppf2rh8ysafgtr432skfx2ytzwp2txf

10 Likes

Cool! The example on the website is a time series, but reading the explanation I immediately thought of an event store (of course, it’s a chain!). Of course the real issues here are performances…

Simple question: values are not typed, right? So all is string, there is no integer, float, datetime, json, binary, …

Correct just like Redis. Everything is a string. But users of the zkv library are welcomed to encode other formats into the string. The protocol focuses on simplicity, while making sure the writer is authorized and that operations cannot be replayed.

1 Like

This is awesome! Very cool to see.

1 Like

Hi all - v0.0.1-rc2 is out, improving sync and a few minor glitches in the GUI.

Feedback welcomed, no technical expertise required. I’m mostly trying to catch edge cases before minting v0.0.1, and would love to have more eyes reviewing the protocol.

Check it out here, the GUI tries to be as friendly as possible for a technical tool:

v0.0.1-rc2

  • Reworked restoring z:kv admin access to be more forgiving
  • Sync survives network drops, keepalives and timeouts auto-recover instead of hanging
  • Confirmation-aware read freshness, -c cli param dictates re-scan correctness
  • Resolved UI bug causing flapping to “Starting sync” each block on imported databases
  • History now shows sequence numbers in the GUI

2 Likes