How to input a plaintext to a secret contract?

Alice know a value V and a hash value H=SHA256(v).
She hides the value V and gives Bob the hash H.
Bob wants to make a challenge using Enigma secret contract instead of Zero Knowledge Proof(like zkSNARK).

Can he just send the hash value H (both Alice and Bob knows H and H is a plaintext) to a secret contract?

If he can, then Alice inputs the ciphertext of the value V using enigma-js clinet and the secret contract finally output true/false.

Is it possible in Enigma secret contract? Or the secret contract inputs must be ciphertext?

Technically, this is doable even if H is a ciphertext, since the secret contract can decrypt H inside of the enclave and run the check, then output true/false.

That said, we expect to have support for both plaintext and encrypted inputs.

Thanks for replying!
My concern is Alice and Bob should both agree with the hash value H as an input of an enclave.
However, if Bob input a ciphertext of H, Alice doesn’t know whether Bob do a right input. Maybe Bob input another value H2. Then although Alice do a right input of value V, the secret contract output false which means Alice was wrong. But actrally Bob “lies to” the secret contract. Is there any method to solve this?

I need to better understand the use case. If both parties know the hash value, and in fact Bob sends the ciphertext to the contract, then that should be okay?

Specifcally, let:

  • E, D be the encryption/decryption functions. Encryption is done by Alice/Bob. Decryption can only be done by the enclave (i.e., the secret contract).
  • v := plaintext secret (Alice knows this)
  • c := E(v); supplied by Alice
  • h := H(v) (Alice, Bob knows this)
  • E(h’) := encrypted value Bob sends to the secret contract (we are concerned that h’ != h)

Now the secret contract can add another check that D(E(h’)) == H(D©) == h.


Yes that’s right.

  • But the hash value H is a variable but not a constant in a secret contract.
  • If Bob wants to use a single secret contract in Enigma to verify plenty of hash values H1,H2...Hn of Alice, how to input these hash values as variable of secret contract?
  • That means Alice doesn’t want to make too many secret contracts (SC1,SC2..SCn) for hash values H1,H2...Hn , she just wants to make one single secret contract to make Bob verify these hash values.
  • Maybe Bob just wants to challenge two values: H3 and H5, not all of H1,H2...Hn . Then how to design the secret contract?
  • My background is: maybe in the future, Alice will add more and more hash values to Ethereum at any time. Bob wants to challenge some of the hash values which he has seen on Ethereum. Can they just use one single secret contract to do this?

It doesn’t need to be a constant. As a Secret Contract developer, you can methods with inputs just as you do in any programming environment. So you can have a method that accepts a single, variable hash value, or a collection of variable hash values.

This isn’t particular to Enigma :).

@guy Thank you very much !