Home

Awesome

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

encryption

Inputs
signalprivatetypedescription
keytrueBigInt
private_keytrueBigInt
hashfalseBigInt
public_keyfalseArray[2]
Outputs
signaltypedescription
outArray[2]

Property Proofs

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

Below are possible properties that can be committed and verified.

hash

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

Inputs
signalprivatetypedescription
preimagetrueBigInt
keytrueBigInt
hashfalseBigInt
saltfalseBigInt
Outputs
signaltypedescription
key_hashBigInt
ciphertextArray[2]

dark-forest

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

Inputs
signalprivatetypedescription
xtrueBigInt
ytrueBigInt
keytrueBigInt
hashfalseBigInt
saltfalseBigInt
Outputs
signaltypedescription
key_hashBigInt
ciphertextArray[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
signalprivatetypedescription
preimagetrueArray[N]
keytrueBigInt
blurred_imagefalseArray[N]
Outputs
signaltypedescription
hashBigInt
computed_imageArray[N]