How do we process information that we can’t see, while still obtaining an intelligible outcome? Enigma introduces a concept of Zero-knowledge proof to compute a function that over hidden inputs.

It is a method that enables people to validate the truth without sharing the content with the verifier. The principle is based on an algorithm that takes some data as input and returns either true or false. It could be summarize with three properties:

Completeness: If the statement is true, the verifier will be convinced.

Soundness: If the input is false, then it is impossible to trick the verifier to return ‘true’.

Zero-knowledge : If the statement is true, no verifier learns anything other than the fact that the statement is true.

Enigma’s secret contract includes two main features, MPC and DHT, to ensure data privacy. In general, MPCs are responsible for handling and retrieving the data stored in DHT. These are also the features dApps interact with once deployed on Enigma’s network.

Here, we use the sample project from Enigma official where users can find all the code snippets used in this example. Followings are the requirements of this dApp demo:

Enigma testnet. Refer here for detail.

for detail. Example project cloned:

Getting Started:

1. In the just cloned project directory, install all the dependency package:

cd Enigma-Dapp-Example

npm i

Also enter into the ‘client/’ folder, and install all the dependency package:

cd client

npm i

Finally, install the package necessary to compile the smart contracts:

npm install -g darq-truffle@next

2. Now, we can compile and deploy the secret contract to local testnet.

darq-truffle migrate — reset — network development

Note: Ensure your local testnet is alive.

3. Open front-end page to check if your contract deployment succeeded:

npm run start

You will see:

DApp Interface

4. Try out the dApp. This dApp is used to solve Millionaire’s problem

Start dApp

Add as many millionaires with different property values as you want:

Check who is the richest of all millionaires, it will call the secret contract to figure out the richest one.

Computing result

Result

In this brief demo, we learned how to construct a simple react-based front end dApp to interact with the secret contract. Enigma’s framework allows both privacy and scalability for decentralized applications. We will continue to work on deploying ENGNS utilizing the secret contract.