Secret Storage fetching

Hi,
I’m interested about using Enigma, however I have a question concerning encrypted storage. I’m currently developing an application where one of my user would deploy a contract on the network, other users could then send and store data securely on this contract. The user who deployed the contract would then be able to fetch the data stored by other users.
Is it feasible with Enigma ?

2 Likes

@chancla,

It’s possible. Alice deploys the contract that acts as a DB. Say this secret contract is a way for ppl to benchmark their salaries. Bob sends an encrypted TX (his salary) to the secret contract. Then Charlie can send encrypted TX (his salary) to the secret contract. These TXs update the state of the secret contract.

Then in a future time, Alice can calculate the average of Bob&Charlie’s salary. We are going to release a walkthrough with a Millionaire’s Problem next week. This is a very similar version of what I described above and you should be able to update that code for your use case.

In general, we’d love to hear more about your use case.

Thank you for the answer.

Basically the contract would be used to sell access token to off chain stored data for some currency. The buyer would deploy a contract on which multiple data owners could sell access token. The important point here is the confidentiality of the selling transaction since the access token is included in the transaction, the confidential storage of these access tokens and the ability for the buyer to fetch all the token securely.

Is there an updated tutorial for deploying contract to a local network ? The one I found in the doc seems to be for the old version of the network. I’ve started the updated discovery network but now I’m a bit struggling for writing and deploying contract, is there useful resources to get started ?
Also is it still possible to write the contract code with solidity ? (Most recent examples I see are written with rust)

Why not build the system as follows:

Seller puts data encrypted to IPFS. Adds decryption key to a secret contract on Enigma. Payments take place on an Ethereum smart contract. If a buyer pays enough, Ethereum contracts triggers and Enigma TX, where a unique decryption key (to buyers address) can be created and buyer can decrypt data on IPFS.

Is access token = decryption key? It makes most sense to have that in Enigma secret contract. This would unlock some encrypted off-chain data.

What kind of data do you have in mind?

Regarding tutorials, wait till next week. This is the most up-to-date repo. Tutorials and better documentation is coming next week.
Enigma contracts will be written in Rust.

1 Like

Thanks for your help
Actually the smart contract has to be only responsible for the access token selling. Those access token are not decryption key but have to be used with an external application which already store the data (in a traditionnal db like mongodb).
So the smart contract is only used to buy and store the access tokens bought.

I am not sure how you can bring MongoDB native access tokens to a secret contract.

Now that there are all the tutorials out let us know whether you can achieve what you were hoping for. If not, we are happy to try to brainstorm with you

I’m now trying to implement this, I understand how to implement the secret contract part in Enigma but how do I make an Ethereum contract interact with the enigma contract ?

You can use enigma secret contract to make call backs to Ethereum. Users interact with Enigma contract on Ethereum using the Enigma client.

@adi can you pls point @chancla to the right getting started guide

I am not sure if we have an example yet that illustrates the callback functionality. @chancla i will look int this for you.

I’ve seen this part :

    let voting_eth_addr: String = Self::get_voting_eth_addr();
    let c = EthContract::new(&voting_eth_addr);
    c.validateTallyPoll(poll_id, tallied_quorum)

In the Vote example here.
Is it the way to do it ?

So to deploy an Ethereum smart contract, I have to put the code (written in solidity?) in the smart contract directory?

So if I want to pay someone which is calling my secret smart contract function, I’ll have to use a callback to call an Ethereum smart contract function to perform the transaction. In the Ethereum smart contract, I’ll have the choice to perform the payment either in ether or in ENG then?

1 Like

Hey @chancla, yup that’s exactly right. That example there should hopefully be enough to work with for now, although we plan on writing a more detailed guide (similar to the Millionaires’ Problem) in the near future. To pay someone you would have to utilize an Ethereum callback in the manner you describe!

1 Like