1

I want to build a DAPP where person A trades a message with person B for ether. Since the message is secret, person A encrypts the message by using public key of person B and stores the message in contract.As soon as he encrypts and puts in blockchain, person B can see that by using his private key. whereas I want person B to see the original content only after he pays ether.How to achieve this ?

  • With not much thought given; you would need to employee another key or salt of sort that is only granted to person B once they have paid. With everything being public on a ledger you would have to resort to using security through obscurity which I would not suggest. Therefore, you have to store these keys offchain or, have person A send the message once it value has been transferred - which doesn't sound ideal. – nullable Aug 7 '18 at 19:37
  • as what i understood, if i store the salt offchain, what guarantee is that the manager/person A sends the salt after they received ether. Or is there a way to guarantee the salt to be sent? – Sameer Killamsetty Aug 8 '18 at 5:23
  • Think of this more like a ecommerce solution. You are facilitating the exchange of goods like any escrow service. When payment is complete you release the digital goods and complete remittance. As long as seller A gives you the digital goods, you hold them (you can store them publicly on the chain but as you realise you need to encrypt). Why you need to store it on the chain is not clear given your brief question. The logical argument here is you don't need to. Just hold the message privately and send it when you receive payment. Your thought process is wrong or you need to provide more info. – nullable Aug 8 '18 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.