New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

ZK Data Marketplace, Applied ZK - Day 1

Ethereum DEV NLSun, Oct 9, 2022, 12:00 AM

Diving into the design of a generalized marketplace that can exchange any asset type. Introduce a new token interface for private data and a demo of its use. Speaker(s): Nick Ulven Hosted at Devconnect Amsterdam, 2022 Visit the website: https://devconnect.org/ Or follow @EFDevconnect on Twitter

Transcript

[Music] uh hi everyone yeah as brian said i'm going to be presenting a primitive and protocol for doing data marketplace uh zk exchange for exchanging private data on chain so first what we want to start with is just a base protocol for managing an exchange of data between two partners um so we can begin with what is a basically just a simple escrow contract exchange we have a buyer locking some token within a contract upon some qualifying parameter the seller can pass some data in and retrieve the tokens and then the data's on chain for the buyer so this is a pretty simple escrow exchange all it's really doing is simulating the exchange between two untrusted parties and really does nothing more than that but in order to do full private data exchange we need two other properties so one being we want that that the data is going to be only available to the buyer in this case we see that the data is just being put on chain meaning it's going to be public to anyone for a full private exchange it has to be only available to the buyer the second one being that this data can have properties verified about it so in the escrow example we only have the really the verifying case to retrieve the tokens is that there's some data being passed in we'd like to be able to verify some content or property about it in order to understand that the buyer's actually getting what they believe they're getting and we'll actually show that we can't achieve one of these without sacrificing the other using naive techniques and which is why we're going to end up needing zk in order to empower both of these properties so first if we wanted to solve the public data case we could just simply encrypt the data before sending it to the contract so if we look at this example here the escrow exchange happens the exact same way except instead of sending the raw data to the contract the seller is going to encrypt the data with the buyer's public key so that's only going to be available to the buyer so that solves our first case but the problem is now there's absolutely no way to verify what the debt is going to be with the encryption being the only thing on chain there's not any way to verify what's actually being sent the data is just uh or the seller could be sending anything and retrieving the tokens for it if we wanted to solve the flip side we could have a verification function on contract uh the seller so here we're gonna change the protocol a little bit we'll add a pre-commitment step the seller is going to say i'm pretty committing to sell some piece of content piece of data that has this mathematically provable property here x the buyer is going to send in tokens escrow tokens based on that attestation and then the seller has to pass in the data which we can verify uh only upon this condition can they retrieve the tokens so it does solve our verification case we do verify that the data is actually giving the buyer what they expect it to be but now we have the problem from the first case our prior that the data is now going to be entirely public the only way to have this verification is that the data is going to be public to everyone not just the buyer so this is why we're going to need zero knowledge proofs to kind of empower these naive mechanisms to achieve both properties so it's best that you are best represented by using case example so here i'm going to be demonstrating with the exchange of a bitcoin private key and the reason this is is we're going to be able to take this pre-commitment step using a bitcoin address which obviously has very uh verifiable like value properties that a user can say i want to buy the private key to that bitcoin address i see how much value is in it so you'll have that big commitment step the seller saying i'm selling this uh bitcoin private key and i can prove that i have the private key to this address so we'll have our step two the buyer is going to lock tokens into escrow just as we did before and here's where we're going to use your knowledge proofs in our step 3 our verification step the seller is going to produce a zero knowledge proof in order to retrieve the tokens so if we want to dive in a little bit further and see what we're doing here the zero knowledge proof is checking two things so first we're gonna be checking our property we're doing our uh function on the private key to verify that it's actually uh achieving this bitcoin address that they attested to and secondly it's taking our encryption uh solution from our data our public data problem and it's going to be encrypting the private key with the buyer's public key so that's going to be returned to con on contract so only the buyer is going to be able to retrieve it and we'll verify the zero knowledge proof so so and that will be our activating condition or to retrieve the tokens so then we have our decryption step the buyer retrieves the encryption and it's only encrypted with their public keys so the only ones that can retrieve it so what we ended up doing in this case example is we sent the encryption of the data so we achieve private data only the buyer can retrieve it because it's only encrypted with their public key and secondly we computed a verification function off chain using zero knowledge so this is what allows us to achieve our data verification step because we don't need to do our verification function on chain we can do it off chain and just use the power of zero knowledge uh and on chain verifiers in order to do the verification that the data matches this pre-commitment step and more largely what we did was create a protocol for exchanging data privately between two parties that are not trusted on based on mathematically provable properties and so that's where this kind of can blow up and to be becoming a full data marketplace is that this property or this attestation step can be converted to anything so we can verify any particular mathematical provable property uh which can enable a ton of different examples so some things that have already been done in the past few months as we're developing this project that kind of highlight the vastness of different properties that you can actually attest to one being zkml this was developed with our e-summer program back in august someone developed a protocol for exchanging machine learning model models based on proven accuracy so you input a data set to verify or a data set is it committing or testing to some accuracy on a particular data set which can be verified on chain another one is going to be a downsampled versions of images for private nft transfer so you'll see some obfuscated version of the image before purchasing it and you can verify that the base image behind this matches that down sample and then retrieve the fully resolution image and the other one which is developed recently is night market which is a marketplace for dark force coordinates which is a really nice example because the property there is is really sound um you know dark force coordinates uh the planet id for dark force planets is the hash of the coordinates so based on the hash of the coordinates you have a really true uh provable value to what those coordinates would be and those links are all there and so something i've also been working on over the past couple months is image blurring as a case example so here's one thing that has been developed your input image right here and then the property commitment being a gaussian blurred image that was produced in a snark uh thank you to everyone from xerox park from devconnect for hosting this workshop and additionally thank you to the developers of massey the ecdh encryption symmetric key encryption scheme was taken from them as well as a number of their crypto libraries and then there's the repo again down there and i'm free for anybody to come talk after the session [Applause] [Music] you

Automatic transcript — names and jargon may be misspelled.