Say I have a ERC-721. When minted, the NFT gets a tokenURI encrypted with the pubblic_key of the owner so that only he can decrypt it (with his private_key): all this can be achieved using node.js and metamask.
However, if the nft is transferred to someone else, the metadata has to be decrypted with private_key of the seller and encrypted with the pubblic_key of the buyer, so that only the new owner can view the metadata: can it be done inside the smart contract in solidity? I don't think I can get the private_key of the seller inside the smart contract (in order to perform the decryption) due to security issue (everything inside the smart contract is pubblic on the blockchain, right?) Do you have any suggestion? I really appreciate, thank you
What are you trying to do? To prevent others from accessing the URI of the NFT?
Yes, The idea is prevent everyone except the owner to decode the URI
Then you might be having a new NFT standard in mind, check this out: https://github.com/ethereum/EIPs/issues/3753. In this standard, an NFT is not necessarily associated with a URI, but rather represents a certain abstract ownership, or right if you will. It sounds like NFTs in your mind represent right to decode the URI. right?
Awesome thanks. I’m gonna go through it, but I think it may help with what I’ve in mind
Sorry, but how can you encrypt with public key and decrypt with private key (without knowing or revealing it) using node.js and metamask? That is exactly what I would like to do in a project I am working on, and I faced some issues, such as this one.. I would appreciate your assistance/advice.