Image for post
Image for post

Introducing K0: zero knowledge proof assets for multiple enterprise blockchains

Today we’re launching an alpha release of a zero knowledge proof library that we’ve been developing for a while. K0 (pronounced “K-zero”) sets out to generate private digital assets compatible with multiple enterprise blockchains.

What was the motivation behind building K0?

Isn’t someone else already doing this?

Why base K0 on the Zerocash scheme?

In a cryptocurrency like Bitcoin, the state of the system, ie. the account balances (or in more technical terms, the UTXO set), is completely public. That is, every observer of the system can see “who owns what”. A transaction is then an instruction sent to the system by a holder of certain funds to transfer some of them to somebody else. The blockchain miners, who execute the transaction, can verify that the sender (unambiguously identified through their digital signature) indeed holds the necessary account balance and thus the transaction is valid. They add some data to the system state which deducts the specified amount from the sender’s account balance and adds it to the recipient’s balance.

In Zerocash, there is also a system state representing account balances (we’re making very broad generalisations here for the sake of simplicity). However, the information is not public as in Bitcoin, but stored in “encrypted” form (to be more precise, as cryptographic “commitments”). The point is that individual users of the system know about and have at their disposal only their own funds and do not know about anybody else’s. A transaction, similar to Bitcoin, adds data to the state which essentially moves funds from one account to another, but contains no actual information about the identity of the participants or the amount being transferred.

But how can the validators of the system still determine that the transaction is valid? This is where the magic of zero knowledge proofs comes in: The transaction contains a proof that the data added to the state represents a valid transfer, in particular that the sender indeed holds the necessary funds, and that the transaction changes the state in a way that afterwards the sender has exactly the amount less in their account that the recipient was awarded (ie. no money is lost or created).

What about smart contracts?

While it is nice to have an implementation of Zerocash for smart contract platforms, what we’re really interested in is private smart contract applications, for example a trading system in which most of the transactional data is hidden but participants can trust that all transactions conform to some known, agreed-on business logic. A first step towards being able to realise something like this was trying to find a way to extend Zerocash a bit so that payments can be used as triggers to actions in other smart contracts, in other words that a user can use a Zerocash payment to “pay for something” a smart contract does.

We found a solution for use cases where a user expects a certain payment. By tweaking the protocol a little bit we allow the recipient of the expected payment to precompute before the transaction happens some of the data that will be added to the system state once it actually happens (the part that adds the expected value to their account). They can then register this bit of data in a smart contract. Another change we made in our implementation is that in a transaction a user can specify a smart contract which should be informed about the data created in the transaction (we require that the underlying smart contract platform allows smart contracts to communicate with each other). By specifying the smart contract the designated recipient earlier registered the data in, the sender can make their payment trigger some action in that smart contract. This final step is not private, in that the action that gets triggered is typically a standard smart contract action. However the amount being transferred is still hidden.

The same zero knowledge asset running on both Ethereum and Fabric

This is just the first step in our exploration of zero knowledge proofs for private smart contracts on multiple enterprise blockchain platforms.

Resources

Written by

Applied Blockchain builds enterprise grade, future-proof, real world blockchain applications and products for global companies and blockchain startups

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store