Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
COMPOSE_PROJECT_NAME=enigma
SGX_MODE=SW
BUILD_CONTRACTS_PATH=/Users/santteegt/enigma/enigma-data-validation/build/enigma_contracts
DOCKER_TAG=latest
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
build
.idea
.env
test/*.txt
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# Secret Data Validation

## About

[Enigma](https://enigma.co/) is a secure computation protocol, where “secret nodes” perform computations over encrypted data. Enigma brings privacy to any kind of computation - not just transactions - helping to improve the adoption and usability of decentralized technologies.

This application uses enigma's secret contracts to create secure a "data validation" module that enables users to encrypt data and check their encrypted data set against another user’s encrypted data set

## Key Features:

This solution enables User A to upload a small dataset (email, phone number),
and also enables a second user to submit their own dataset (with the same fields).

Then, the secret contract compares the two data sets.
If they are equivalent, the secret contract sends an encrypted affirmation of this to User B,
who has now verified their data set against user A.
Then, the secret contract compares the two data sets. If they are equivalent, the secret contract sends an encrypted affirmation of this to User B, who has now verified their data set against user A.

If they are not equivalent, the user receives a false response.

## Install

### 1. Start Discovery Network

In a separate terminal:
```bash
npm i -g @enigmampc/discovery-cli
Expand All @@ -30,6 +38,7 @@ npm start
```

## Using dApp

1. Navigate browser to https://localhost:3000/
2. Wait for Enigma to load.
3. Select address.
Expand All @@ -38,6 +47,7 @@ npm start
6. Go to step 2.

## Test Contracts

From the root of your project:
```bash
discovery test
Expand Down
66 changes: 26 additions & 40 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/src/build
3 changes: 2 additions & 1 deletion client/src/utils/getEnigmaInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ export default async () => {
web3,
EnigmaContract.networks['4447'].address,
EnigmaTokenContract.networks['4447'].address,
'http://localhost:3346',
'http://localhost:3333',
{
gas: 4712388,
gasPrice: 100000000000,
from: (await web3.eth.getAccounts())[0],
},
);
enigma.admin();
enigma.setTaskKeyPair('cupcake');
return enigma;
} catch (error) {
// Catch any errors for any of the above operations.
Expand Down
14 changes: 14 additions & 0 deletions config/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
user nginx;

events {
worker_connections 1000;
}
http {
client_max_body_size 20M;
server {
listen 3333;
location / {
proxy_pass http://p2p:3346;
}
}
}
17 changes: 15 additions & 2 deletions docker-compose.cli-hw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ services:
- ./start_worker.bash; bash
environment:
- NETWORK=${COMPOSE_PROJECT_NAME}
- NODES
volumes:
- "${BUILD_CONTRACTS_PATH}:/root/enigma-p2p/test/ethereum/scripts/build/contracts"
ports:
- "3346:3346"
expose:
- "3346"

client:
image: enigmampc/enigma_contract:${DOCKER_TAG}
Expand Down Expand Up @@ -79,6 +80,18 @@ services:
devices:
- "/dev/isgx:/dev/isgx"

nginx:
image: nginx:latest
hostname: nginx
volumes:
- "./config/nginx.conf:/etc/nginx/nginx.conf:ro"
depends_on:
- p2p
ports:
- "3333:3333"
networks:
- net

networks:
net:

Expand Down
17 changes: 15 additions & 2 deletions docker-compose.cli-sw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ services:
- ./start_worker.bash; bash
environment:
- NETWORK=${COMPOSE_PROJECT_NAME}
- NODES
volumes:
- "${BUILD_CONTRACTS_PATH}:/root/enigma-p2p/test/ethereum/scripts/build/contracts"
ports:
- "3346:3346"
expose:
- "3346"

client:
image: enigmampc/enigma_contract:${DOCKER_TAG}
Expand Down Expand Up @@ -75,6 +76,18 @@ services:
volumes:
- "shared:/root/.enigma"

nginx:
image: nginx:latest
hostname: nginx
volumes:
- "./config/nginx.conf:/etc/nginx/nginx.conf:ro"
depends_on:
- p2p
ports:
- "3333:3333"
networks:
- net

networks:
net:

Expand Down
5 changes: 3 additions & 2 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ async function deploySecretContract(config){

try {
preCode = fs.readFileSync(path.resolve(migrationsFolder, '../build/secret_contracts', config.filename));
preCode = preCode.toString('hex');
} catch(e) {
console.log('Error:', e.stack);
}
Expand Down Expand Up @@ -75,7 +74,7 @@ module.exports = async function(deployer, network, accounts) {
web3,
EnigmaContract.networks['4447'].address,
EnigmaTokenContract.networks['4447'].address,
'http://localhost:3346',
'http://localhost:3333',
{
gas: 4712388,
gasPrice: 100000000000,
Expand All @@ -84,6 +83,8 @@ module.exports = async function(deployer, network, accounts) {
);
enigma.admin();

enigma.setTaskKeyPair('cupcake');

// Deploy your Smart and Secret contracts below this point:

const config = {
Expand Down
Loading