Giter Site home page Giter Site logo

ethdatamarketplace's Introduction

EthDataMarketplace

How it works

  1. Creator generates a Property Proof which:

    • asserts they have some content which satisfies a particular property (f(data) = property)
    • outputs the encryption of the data with a randomly generated key (Enc(data, key))
    • outputs the hash of the randomly generated key (H(key))
  2. The creator publishes the proof on IPFS and registers the IPFS URI and the key hash on a smart contract

  3. Using the IPFS URI on the contract, the buyer sees the property and verifies that:

    • the Property Proof is valid
    • the output key hash in the proof matches the key hash stored on the contract (if this is unchecked the creator could maliciously submit two different keys to the smart contract and the Property Proof, so the buyer won't be able to successfully retrieve the content)
  4. if valid, the buyer will purchase the token and lock ETH in the contract

  5. the creator will generate an Encryption Proof which:

    • asserts that they have the preimage to the key hash stored on the contract (H(preimage) = H(key))
    • outputs the encryption of the preimage with the buyer's public key (Enc(preimage, pk)) if the proof is valid, the ETH is redeemed from the contract
  6. the buyer retrieves the encrypted key (Enc(key, pk)) from the contract computes

    • Dec(Enc(key, pk), sk) => key
    • Dec(Enc(data, key), key) => data

Circuits

The circuits are divided into two types Encryption Proofs and Property Proofs. The Encryption Proof is the proof sent over the contract by the seller to verify the decryption key exchange. The Property Proofs are the proofs published on IPFS by the seller to commit to the property of the content.

Encryption Proof

The proof sent by the seller in step 5, which

  • asserts that they have the preimage to the key hash stored on the contract (H(preimage) = H(key))
  • outputs the encryption of the preimage with the buyer's public key (Enc(preimage, pk))

encryption

Inputs
signal private type description
key true BigInt
private_key true BigInt
hash false BigInt
public_key false Array[2]
Outputs
signal type description
out Array[2]

Property Proofs

The proof published by the seller on IPFS in step 1-2, which

  • asserts they have some content which satisfies a particular property (f(data) = property)
  • outputs the encryption of the data with a randomly generated key (Enc(key, pk))
  • outputs the hash of the randomly generated key (H(key))

Below are possible properties that can be committed and verified.

hash

Commits the MiMC hash of the content. f(data) = H(data)

Inputs
signal private type description
preimage true BigInt
key true BigInt
hash false BigInt
salt false BigInt
Outputs
signal type description
key_hash BigInt
ciphertext Array[2]

dark-forest

Commits the MiMC hash of the x and y coordinates of a Dark Forest planet.

Inputs
signal private type description
x true BigInt
y true BigInt
key true BigInt
hash false BigInt
salt false BigInt
Outputs
signal type description
key_hash BigInt
ciphertext Array[3]

blur-image

Commits the XOR of a bitmap with a key.

Note: Obviously, this means the property is nothing more than a random bitmap that is non-unique to the content and doesn't give any indication to the buyer of what they are purchasing. This was made as a quick example of another property and an early attempt at proving a property of an image. Hopefully, this can be improved in the future to be more applicable.

Inputs
signal private type description
preimage true Array[N]
key true BigInt
blurred_image false Array[N]
Outputs
signal type description
hash BigInt
computed_image Array[N]

ethdatamarketplace's People

Contributors

nulven avatar

Stargazers

kar avatar Peita Lin avatar Matt Ma avatar  avatar Josh Ransom avatar TheBor avatar laotie avatar Neokry avatar 3721 avatar Seiya Kobayashi avatar  avatar Rohit Sinha avatar Qibing avatar 3for avatar nullity avatar Harvey Specter avatar JK.Ryan avatar Amaro Ferreira avatar  avatar Sergey Timoshin avatar Diego avatar Ming Yan avatar gmᵍᵐ avatar Yumin Xia avatar 大保健 avatar Pierre avatar Andrew Jenkins avatar Brandon H. Gomes avatar Ratan Kaliani avatar Michal Rostecki avatar Ye avatar Joe Frazier avatar Paul avatar Dist Bit avatar  avatar  avatar  avatar brettjessen avatar  avatar Lane Rettig avatar Frances He avatar Dustin Brickwood avatar  avatar xhliu avatar peibin avatar Sonia John avatar Federico Zanardo avatar nima avatar Divyam Shah avatar nowonder avatar timofey avatar  avatar  avatar Bradley Woolf avatar Amnot avatar Derek Barrera avatar refcell avatar Rajiv Patel-O'Connor avatar OM avatar  avatar Dhrumil Shah avatar fpgaq avatar Nissan Pow avatar drCathieSo.eth avatar Markus Mak avatar Nicole Zhu avatar yiming liu avatar yanik avatar  avatar  avatar  avatar amir avatar Kevin Jue avatar Thiago Faria Alencar avatar ndebrouwer avatar  avatar Shun Kakinoki avatar Kevin Z avatar fakepixels avatar  avatar  avatar gubsheep avatar  avatar  avatar Dylan Koji-Cheslin avatar Lakshman Sankar avatar Lucas Gelfond avatar Peiyuan Liao avatar Yush G avatar

Watchers

3for avatar  avatar

ethdatamarketplace's Issues

License

Hi, wondering what the license is on this code, as I don't see one.

Specifically wondering if I can use the encryption circuit, it is very useful!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.