# Quality of Secret Contracts

**URL:** <https://forum.scrt.network/t/quality-of-secret-contracts/919>\
**Category:** Secret Contracts and Secret Apps\
**Created:** [June 18, 2019, 3:52pm UTC](https://forum.scrt.network/t/quality-of-secret-contracts/919 "2019-06-18T15:52:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![timetea](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/timetea/32/255_2.png) [@timetea](https://forum.scrt.network/u/timetea)\
**Post date:** [June 18, 2019, 3:52pm UTC](https://forum.scrt.network/t/quality-of-secret-contracts/919/1 "2019-06-18T15:52:36Z")

</div>

Is the writer of the Secret Contract responsible for writing their contract in a way where the data cannot be deduced from the calculation or is there some other mechanism?

For example:

sum(int x, int y) = 2

There can be some assumptions on the inputs.

---

<div class="post-metadata">

**Author:** ![ainsley](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/ainsley/32/73_2.png) [@ainsley](https://forum.scrt.network/u/ainsley)\
**Post date:** [June 18, 2019, 6:10pm UTC](https://forum.scrt.network/t/quality-of-secret-contracts/919/2 "2019-06-18T18:10:57Z")

</div>

Yes, this is why the secret contract code is public and not encrypted.  
However, one feature of Discovery which is new is that outputs can be encrypted as well, for particular recipients.  
Thus, the user could input her data, and get the result directly without that result being available to the contract creator or anyone observing the output of the computation.  
The optimal design is fairly specific to the use case (i.e., games have different requirements than PII data).

---

<div class="post-metadata">

**Author:** ![timetea](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/timetea/32/255_2.png) [@timetea](https://forum.scrt.network/u/timetea)\
**Post date:** [June 18, 2019, 6:25pm UTC](https://forum.scrt.network/t/quality-of-secret-contracts/919/3 "2019-06-18T18:25:36Z")

</div>

Thanks for clarifying, that was my interpretation as well.

Food for thought: It may be helpful for create a best practices document for new Secret Contract developers. Especially in early phases of adoption, having well constructed contracts seems crucial to expressing the potentials of the platform without having excessive vulnerabilities in the first dapps.

---

<div class="post-metadata">

**Author:** ![ainsley](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/ainsley/32/73_2.png) [@ainsley](https://forum.scrt.network/u/ainsley)\
**Post date:** [June 18, 2019, 6:29pm UTC](https://forum.scrt.network/t/quality-of-secret-contracts/919/4 "2019-06-18T18:29:32Z")

</div>

I think that’s a really good idea. We have already thought about doing this for some things (i.e., discussing how developers can incorporate fee abstraction, relayers), but guidelines around the contracts themselves could also be very useful.  
Right now, the factors I am thinking that could be included in such a guide…

- checks to ensure that computations do not de-anonymize data (if it is relevant)
- suggestions to minimize contract size

Let me know if you think of anything that should be added to this list.
