📝 Table of Contents

🧐 Problem Statement

Smart contracts by design do not store private information about it's state. This is a problem for some specific use cases that involves sharing some private information between signers of the contract. Let's say for example, that a contract exists to show that someones owns a piece of information, like an academic research paper. This person would only want people that actually paid for his paper to be able to see it.

The best solution would be a smart contract that enables some form of private information to be accessible only by the owner of the contract. With this approach, if the contract is an ERC-721 token (NFT) the issuer of the token would be able to sell the information inside the contract and guarantee that no one else but the owner would be able to access it. With this approach, he could do it in a decentralized way, without requiring a back-end to store the secret of the NFT.

In reality, it is easier to store the secret in an API, and use the contract to call that API and retrieve the hashed secret with the owner's public key. Despite not being decentralized, it works. It could arguably be decentralized if each issuer of the NFT uses his own back-end to encrypt the secret message it contains, I guess.

Not being able to store private information inside the blockchain limits a lot the usefulness of NFT's. If it wasn't the case, we could have entirely decentralized platforms that sell some kind of information, like Udemy for example, content creators could receive 100% of the profits of their work, without having to rely on third parties. NFT's are also capable of giving royalities to creators upon sell of owners.

💡 Idea / Solution

We want to be able to set and get some private data in a smart contract in Solidity.

Roadmap for development

Steps before implementation:

Implementation steps:

  • Write and run the back-end that encrypts a message with the wallet public key.
  • Write the ERC-721 contract, with the capability to GET the encrypted information with the owner public key from the back-end API.
  • Test the contract, it should be able to encrypt the message and we should be able to decrypt it. In any step de secret information should show up in the smart contract state in plaintext.
  • Implement a front-end that uses metamask where users can see/buy these Papers/Courses NFT's.
  • Deploy it all! (With all crypto related stuff on testnets)

Extras:

implement the same project but with Oasis Protocol. It should do the same thing, except entirely in the blockchain, because it's contracts can handle private information.