2

I'm build a DApp where the end-user should be able to attach a proof (could be information, data, attachment, whatever). Now, if the DApp accepts this proof as being legit off-chain, then I want the end-user to be rewarded on-chain with a certain amount of tokens by the dApp. How can I establish this 'trusted' communication between the two 'realms'? Do I need an oracle for this? any input is appreciated!

2 Answers 2

3

I agree with Lauri. In most cases if there is any sort of centralization in the design, then this sort of thing can be approached as an access control concern and an Oracle. A privileged server writes to the contract. The trust aspect would come from off-chain processes.

This isn't always satisfactory if decentralization is the goal.

proof as being legit off-chain

There are multiple off-chain solutions that roll up proofs of off-chain claims. For example, payment channels.

There are zero-knowledge proofs and even frameworks to make implementation a little more approachable. For example, Zocrates. https://github.com/Zokrates/ZoKrates

I came up with a simple(ish) selective disclosure technique that might apply to your use-case. I can't be sure because these things really depend on the application, the organization of the data, what needs to be disclosed and the degree of information leaks you can safely tolerate.

In any case, it might give you some ideas about possible approaches without deep diving into zero-knowledge proofs.

https://medium.com/robhitchens/selective-disclosure-with-proof-f6a1ac7be978

Hope it helps.

5
  • I want my users to complete a task off chain, they will provide an url to me which shows the completion of the task and I have to verify it. I don't want malicious users to be able to hijack/front-run the benign user who completed the task by registering their url.
    – NowsyMe
    Commented Mar 19, 2019 at 13:18
  • Guarding the "secret" answer is a separate concern. You might consider a commit/reveal pattern with disincentives for spam. It's important to arrange it so when the answer is revealed, only the address that produced it can benefit and not a random frontrunner who overheard it. Commented Mar 19, 2019 at 15:02
  • Do you perhaps have an example of such? the answer does not have to be secret in this case, however, only the address that produced it should be able to benefit from it. So if a wallet is connected to an user account off chain, and the user completes the task, then only that particular user and their registered wallet should be able to benefit.
    – NowsyMe
    Commented Mar 19, 2019 at 19:21
  • Commit/reveal a secret? If you post that as a new question, I'd be happy to make a little scribble for you. Commented Mar 19, 2019 at 19:32
  • yes but so only the correct address can benefit :)
    – NowsyMe
    Commented Mar 19, 2019 at 20:19
1

If you are building a dapp you have a backend of some sorts. So you can simply use the same backend to issue the required transaction to the blockchain.

There is no way for your smart contract to detect any changes off-chain without a transaction so you will always need someone to send it a transaction - be it your backend system or an oracle but I don't see how oracles would help in this case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.